Skip to content

Commit ceb613d

Browse files
committed
terraform: don't set destroy module on diff
This is something that should be determined and done during an apply. It doesn't make a lot of sense that the plan is doing it (in its current form at least).
1 parent ab4ebcc commit ceb613d

6 files changed

Lines changed: 6 additions & 54 deletions

File tree

‎go.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
go test ./terraform -Xnew-destroy | grep -E '(FAIL|panic)' | tee /dev/tty | wc -l
1+
go test ./terraform -Xnew-apply -Xnew-destroy | grep -E '(FAIL|panic)' | tee /dev/tty | wc -l

‎terraform/context.go‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -438,11 +438,6 @@ func (c *Context) Apply() (*State, error) {
438438
log.Printf("[WARN] terraform: real graph is experiment, shadow is experiment")
439439
real = shadow
440440
} else {
441-
// TODO: remove before branch is done, we're just not ready for this yet
442-
if c.destroy {
443-
shadow = nil
444-
}
445-
446441
log.Printf("[WARN] terraform: real graph is original, shadow is experiment")
447442
}
448443

@@ -452,6 +447,11 @@ func (c *Context) Apply() (*State, error) {
452447
shadow = real
453448
}
454449

450+
// TODO: remove before branch is done, we're just not ready for this yet
451+
if c.destroy {
452+
shadow = nil
453+
}
454+
455455
// Determine the operation
456456
operation := walkApply
457457
if c.destroy {

‎terraform/diff.go‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,6 @@ func (d *ModuleDiff) IsRoot() bool {
238238
func (d *ModuleDiff) String() string {
239239
var buf bytes.Buffer
240240

241-
if d.Destroy {
242-
buf.WriteString("DESTROY MODULE\n")
243-
}
244-
245241
names := make([]string, 0, len(d.Resources))
246242
for name, _ := range d.Resources {
247243
names = append(names, name)

‎terraform/graph_builder_destroy_plan.go‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ func (b *DestroyPlanGraphBuilder) Steps() []GraphTransformer {
5050
// Attach the configuration to any resources
5151
&AttachResourceConfigTransformer{Module: b.Module},
5252

53-
// Module destroy nodes
54-
&ModuleDestroyTransformer{State: b.State},
55-
5653
// Single root
5754
&RootTransformer{},
5855
}

‎terraform/terraform_test.go‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,6 @@ DIFF:
11391139
DESTROY: aws_instance.foo
11401140
11411141
module.child:
1142-
DESTROY MODULE
11431142
DESTROY: aws_instance.foo
11441143
11451144
STATE:
@@ -1156,10 +1155,8 @@ const testTerraformPlanModuleDestroyCycleStr = `
11561155
DIFF:
11571156
11581157
module.a_module:
1159-
DESTROY MODULE
11601158
DESTROY: aws_instance.a
11611159
module.b_module:
1162-
DESTROY MODULE
11631160
DESTROY: aws_instance.b
11641161
11651162
STATE:
@@ -1176,7 +1173,6 @@ const testTerraformPlanModuleDestroyMultivarStr = `
11761173
DIFF:
11771174
11781175
module.child:
1179-
DESTROY MODULE
11801176
DESTROY: aws_instance.foo.0
11811177
DESTROY: aws_instance.foo.1
11821178

‎terraform/transform_module_destroy.go‎

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)