terraform: interpolation for multi-var checks both ".0" and "" suffix

This commit is contained in:
Mitchell Hashimoto 2016-10-12 18:43:26 -07:00
parent 9ac4ee4b52
commit 7c2c9b82a3
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
3 changed files with 12 additions and 1 deletions

View File

@ -1783,6 +1783,8 @@ func TestContext2Apply_multiVar(t *testing.T) {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
t.Logf("End state: %s", state.String())
actual := state.RootModule().Outputs["output"] actual := state.RootModule().Outputs["output"]
if actual == nil { if actual == nil {
t.Fatal("missing output") t.Fatal("missing output")

View File

@ -37,6 +37,10 @@ func (n *NodeApplyableOutput) ReferenceableName() []string {
func (n *NodeApplyableOutput) References() []string { func (n *NodeApplyableOutput) References() []string {
var result []string var result []string
result = append(result, ReferencesFromConfig(n.Config.RawConfig)...) result = append(result, ReferencesFromConfig(n.Config.RawConfig)...)
for _, v := range result {
result = append(result, v+".destroy")
}
return result return result
} }

View File

@ -30,7 +30,12 @@ func (n *NodeDestroyResource) CreateBeforeDestroy() bool {
// GraphNodeReferenceable, overriding NodeAbstractResource // GraphNodeReferenceable, overriding NodeAbstractResource
func (n *NodeDestroyResource) ReferenceableName() []string { func (n *NodeDestroyResource) ReferenceableName() []string {
return nil result := n.NodeAbstractResource.ReferenceableName()
for i, v := range result {
result[i] = v + ".destroy"
}
return result
} }
// GraphNodeReferencer, overriding NodeAbstractResource // GraphNodeReferencer, overriding NodeAbstractResource