Browse Source

Merge pull request #128 from rodush/master

fix: -force is deprecated, use -auto-approve to delete in tf15
pull/129/head
Jacob McCann 4 years ago
committed by GitHub
parent
commit
4efa5651dc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      plugin.go
  2. 10
      plugin_test.go

2
plugin.go

@ -300,7 +300,7 @@ func tfDestroy(config Config) *exec.Cmd {
if config.InitOptions.LockTimeout != "" { if config.InitOptions.LockTimeout != "" {
args = append(args, fmt.Sprintf("-lock-timeout=%s", config.InitOptions.LockTimeout)) args = append(args, fmt.Sprintf("-lock-timeout=%s", config.InitOptions.LockTimeout))
} }
args = append(args, "-force") args = append(args, "-auto-approve")
return exec.Command( return exec.Command(
"terraform", "terraform",
args..., args...,

10
plugin_test.go

@ -113,27 +113,27 @@ func TestPlugin(t *testing.T) {
{ {
"default", "default",
args{config: Config{}}, args{config: Config{}},
exec.Command("terraform", "destroy", "-force"), exec.Command("terraform", "destroy", "-auto-approve"),
}, },
{ {
"with parallelism", "with parallelism",
args{config: Config{Parallelism: 5}}, args{config: Config{Parallelism: 5}},
exec.Command("terraform", "destroy", "-parallelism=5", "-force"), exec.Command("terraform", "destroy", "-parallelism=5", "-auto-approve"),
}, },
{ {
"with targets", "with targets",
args{config: Config{Targets: []string{"target1", "target2"}}}, args{config: Config{Targets: []string{"target1", "target2"}}},
exec.Command("terraform", "destroy", "-target=target1", "-target=target2", "-force"), exec.Command("terraform", "destroy", "-target=target1", "-target=target2", "-auto-approve"),
}, },
{ {
"with vars", "with vars",
args{config: Config{Vars: map[string]string{"username": "someuser", "password": "1pass"}}}, args{config: Config{Vars: map[string]string{"username": "someuser", "password": "1pass"}}},
exec.Command("terraform", "destroy", "-var", "username=someuser", "-var", "password=1pass", "-force"), exec.Command("terraform", "destroy", "-var", "username=someuser", "-var", "password=1pass", "-auto-approve"),
}, },
{ {
"with var-files", "with var-files",
args{config: Config{VarFiles: []string{"common.tfvars", "prod.tfvars"}}}, args{config: Config{VarFiles: []string{"common.tfvars", "prod.tfvars"}}},
exec.Command("terraform", "destroy", "-var-file=common.tfvars", "-var-file=prod.tfvars", "-force"), exec.Command("terraform", "destroy", "-var-file=common.tfvars", "-var-file=prod.tfvars", "-auto-approve"),
}, },
} }

Loading…
Cancel
Save