From 4fc3bd0b791e0d6bc4c056c2362aba900afdcbaf Mon Sep 17 00:00:00 2001 From: Roman Dushko Date: Fri, 21 May 2021 14:58:59 +0200 Subject: [PATCH 1/2] fix: -force is deprecated, use -auto-approve to delete in tf15 --- plugin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.go b/plugin.go index 5ec1d72..e89e373 100644 --- a/plugin.go +++ b/plugin.go @@ -300,7 +300,7 @@ func tfDestroy(config Config) *exec.Cmd { if 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( "terraform", args..., From c2449db94be953f879cee57c0786689b4b36b250 Mon Sep 17 00:00:00 2001 From: Roman Dushko Date: Tue, 1 Jun 2021 16:08:05 +0200 Subject: [PATCH 2/2] fix: unit tests for tf destroy (use -auto-approve) --- plugin_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin_test.go b/plugin_test.go index d14e770..bce7901 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -113,27 +113,27 @@ func TestPlugin(t *testing.T) { { "default", args{config: Config{}}, - exec.Command("terraform", "destroy", "-force"), + exec.Command("terraform", "destroy", "-auto-approve"), }, { "with parallelism", args{config: Config{Parallelism: 5}}, - exec.Command("terraform", "destroy", "-parallelism=5", "-force"), + exec.Command("terraform", "destroy", "-parallelism=5", "-auto-approve"), }, { "with targets", 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", 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", 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"), }, }