From 051582d32ad8888d2d095ce9069a9aa9d70b88a7 Mon Sep 17 00:00:00 2001 From: Sander van Harmelen Date: Wed, 12 Apr 2017 23:25:15 +0200 Subject: [PATCH] Add the close provider and provisioner transformers (#13102) --- terraform/graph_builder_apply.go | 4 ++++ terraform/graph_builder_apply_test.go | 28 +++++++++++++++++++++++++++ terraform/graph_builder_import.go | 3 +++ terraform/graph_builder_plan.go | 4 ++++ terraform/graph_builder_plan_test.go | 11 +++++++++++ terraform/graph_builder_refresh.go | 3 +++ 6 files changed, 53 insertions(+) diff --git a/terraform/graph_builder_apply.go b/terraform/graph_builder_apply.go index 61242586a..38a90f277 100644 --- a/terraform/graph_builder_apply.go +++ b/terraform/graph_builder_apply.go @@ -123,6 +123,10 @@ func (b *ApplyGraphBuilder) Steps() []GraphTransformer { // Target &TargetsTransformer{Targets: b.Targets}, + // Close opened plugin connections + &CloseProviderTransformer{}, + &CloseProvisionerTransformer{}, + // Single root &RootTransformer{}, } diff --git a/terraform/graph_builder_apply_test.go b/terraform/graph_builder_apply_test.go index b62833103..a1c02dfa8 100644 --- a/terraform/graph_builder_apply_test.go +++ b/terraform/graph_builder_apply_test.go @@ -510,6 +510,18 @@ module.child.provider.aws provider.aws module.child.provisioner.exec provider.aws +provider.aws (close) + aws_instance.create + aws_instance.other + module.child.aws_instance.create + module.child.aws_instance.other + provider.aws +provisioner.exec (close) + module.child.aws_instance.create +root + meta.count-boundary (count boundary fixup) + provider.aws (close) + provisioner.exec (close) ` const testApplyGraphBuilderDoubleCBDStr = ` @@ -533,6 +545,15 @@ meta.count-boundary (count boundary fixup) aws_instance.B (destroy) provider.aws provider.aws +provider.aws (close) + aws_instance.A + aws_instance.A (destroy) + aws_instance.B + aws_instance.B (destroy) + provider.aws +root + meta.count-boundary (count boundary fixup) + provider.aws (close) ` const testApplyGraphBuilderDestroyCountStr = ` @@ -546,4 +567,11 @@ meta.count-boundary (count boundary fixup) aws_instance.B provider.aws provider.aws +provider.aws (close) + aws_instance.A[1] (destroy) + aws_instance.B + provider.aws +root + meta.count-boundary (count boundary fixup) + provider.aws (close) ` diff --git a/terraform/graph_builder_import.go b/terraform/graph_builder_import.go index 7fa76ded7..7070c59e4 100644 --- a/terraform/graph_builder_import.go +++ b/terraform/graph_builder_import.go @@ -62,6 +62,9 @@ func (b *ImportGraphBuilder) Steps() []GraphTransformer { // This validates that the providers only depend on variables &ImportProviderValidateTransformer{}, + // Close opened plugin connections + &CloseProviderTransformer{}, + // Single root &RootTransformer{}, diff --git a/terraform/graph_builder_plan.go b/terraform/graph_builder_plan.go index 275cb32f3..02d869700 100644 --- a/terraform/graph_builder_plan.go +++ b/terraform/graph_builder_plan.go @@ -116,6 +116,10 @@ func (b *PlanGraphBuilder) Steps() []GraphTransformer { // Target &TargetsTransformer{Targets: b.Targets}, + // Close opened plugin connections + &CloseProviderTransformer{}, + &CloseProvisionerTransformer{}, + // Single root &RootTransformer{}, } diff --git a/terraform/graph_builder_plan_test.go b/terraform/graph_builder_plan_test.go index 02366fe4f..23526a9ac 100644 --- a/terraform/graph_builder_plan_test.go +++ b/terraform/graph_builder_plan_test.go @@ -65,6 +65,17 @@ openstack_floating_ip.random provider.openstack provider.aws openstack_floating_ip.random +provider.aws (close) + aws_instance.web + aws_load_balancer.weblb + aws_security_group.firewall + provider.aws provider.openstack +provider.openstack (close) + openstack_floating_ip.random + provider.openstack +root + provider.aws (close) + provider.openstack (close) var.foo ` diff --git a/terraform/graph_builder_refresh.go b/terraform/graph_builder_refresh.go index 8fed21d61..88ae3380c 100644 --- a/terraform/graph_builder_refresh.go +++ b/terraform/graph_builder_refresh.go @@ -115,6 +115,9 @@ func (b *RefreshGraphBuilder) Steps() []GraphTransformer { // Target &TargetsTransformer{Targets: b.Targets}, + // Close opened plugin connections + &CloseProviderTransformer{}, + // Single root &RootTransformer{}, }