terraform: state filter wasn't comparing resource names

This commit is contained in:
Mitchell Hashimoto 2016-04-30 17:52:39 -05:00 committed by James Nugent
parent 0c56144d7f
commit 3480b7ebee
2 changed files with 10 additions and 0 deletions

View File

@ -99,6 +99,10 @@ func (f *StateFilter) filterSingle(a *ResourceAddress) []*StateFilterResult {
continue continue
} }
if a.Name != "" && a.Name != key.Name {
continue
}
// Build the address for this resource // Build the address for this resource
addr := &ResourceAddress{ addr := &ResourceAddress{
Path: m.Path[1:], Path: m.Path[1:],

View File

@ -69,6 +69,12 @@ func TestStateFilterFilter(t *testing.T) {
}, },
}, },
"resource in module 2": {
"resource-in-module-2.tfstate",
[]string{"module.foo.aws_instance.foo"},
[]string{},
},
"single count index": { "single count index": {
"complete.tfstate", "complete.tfstate",
[]string{"module.consul.aws_instance.consul-green[0]"}, []string{"module.consul.aws_instance.consul-green[0]"},