Skip to content

Commit

Permalink
terraform: state filter wasn't comparing resource names
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh authored and jen20 committed May 3, 2016
1 parent e608cb7 commit c552fde
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions terraform/state_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ func (f *StateFilter) filterSingle(a *ResourceAddress) []*StateFilterResult {
continue
}

if a.Name != "" && a.Name != key.Name {
continue
}

// Build the address for this resource
addr := &ResourceAddress{
Path: m.Path[1:],
Expand Down
6 changes: 6 additions & 0 deletions terraform/state_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
"complete.tfstate",
[]string{"module.consul.aws_instance.consul-green[0]"},
Expand Down

0 comments on commit c552fde

Please sign in to comment.