From 7c2c9b82a321ad292e53fc08475f77d0ce7699fb Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 12 Oct 2016 18:43:26 -0700 Subject: [PATCH] terraform: interpolation for multi-var checks both ".0" and "" suffix --- terraform/context_apply_test.go | 2 ++ terraform/node_output.go | 4 ++++ terraform/node_resource_destroy.go | 7 ++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/terraform/context_apply_test.go b/terraform/context_apply_test.go index 8c2af8a70..698c5da5a 100644 --- a/terraform/context_apply_test.go +++ b/terraform/context_apply_test.go @@ -1783,6 +1783,8 @@ func TestContext2Apply_multiVar(t *testing.T) { t.Fatalf("err: %s", err) } + t.Logf("End state: %s", state.String()) + actual := state.RootModule().Outputs["output"] if actual == nil { t.Fatal("missing output") diff --git a/terraform/node_output.go b/terraform/node_output.go index 08bb892d6..c10c6e4f8 100644 --- a/terraform/node_output.go +++ b/terraform/node_output.go @@ -37,6 +37,10 @@ func (n *NodeApplyableOutput) ReferenceableName() []string { func (n *NodeApplyableOutput) References() []string { var result []string result = append(result, ReferencesFromConfig(n.Config.RawConfig)...) + for _, v := range result { + result = append(result, v+".destroy") + } + return result } diff --git a/terraform/node_resource_destroy.go b/terraform/node_resource_destroy.go index 640f5d158..6ef7b7d5f 100644 --- a/terraform/node_resource_destroy.go +++ b/terraform/node_resource_destroy.go @@ -30,7 +30,12 @@ func (n *NodeDestroyResource) CreateBeforeDestroy() bool { // GraphNodeReferenceable, overriding NodeAbstractResource 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