Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update terragrunt support to use terragrunt run-all plan / apply / destroy #896 #910

Merged
merged 7 commits into from
May 31, 2021
2 changes: 1 addition & 1 deletion modules/terraform/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TgApplyAllE(t testing.TestingT, options *Options) (string, error) {
return "", TgInvalidBinary(options.TerraformBinary)
}

return RunTerraformCommandE(t, options, FormatArgs(options, "apply-all", "-input=false", "-auto-approve")...)
return RunTerraformCommandE(t, options, FormatArgs(options, "run-all", "apply", "-input=false", "-auto-approve")...)
}

// ApplyAndIdempotent runs terraform apply with the given options and return stdout/stderr from the apply command. It then runs
Expand Down
1 change: 1 addition & 0 deletions modules/terraform/apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ func TestTgApplyUseLockNoError(t *testing.T) {
TerraformDir: testFolder,
TerraformBinary: "terragrunt",
Lock: true,
EnvVars: map[string]string{"TF_LOG": "DEBUG"}, // debug level to get -lock CLI option passed down
brikis98 marked this conversation as resolved.
Show resolved Hide resolved
})

out := TgApplyAll(t, options)
Expand Down
1 change: 1 addition & 0 deletions modules/terraform/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var commandsWithParallelism = []string{
"apply",
"destroy",
"plan-all",
"run-all",
"apply-all",
"destroy-all",
}
Expand Down
2 changes: 1 addition & 1 deletion modules/terraform/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ func TgDestroyAllE(t testing.TestingT, options *Options) (string, error) {
return "", TgInvalidBinary(options.TerraformBinary)
}

return RunTerraformCommandE(t, options, FormatArgs(options, "destroy-all", "-force", "-input=false")...)
return RunTerraformCommandE(t, options, FormatArgs(options, "run-all", "destroy", "-auto-approve", "-input=false")...)
}
1 change: 1 addition & 0 deletions modules/terraform/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var TerraformCommandsWithLockSupport = []string{
"plan",
"apply",
"apply-all",
"run-all",
"destroy",
"destroy-all",
"init",
Expand Down
3 changes: 2 additions & 1 deletion modules/terraform/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ func TgPlanAllExitCodeE(t testing.TestingT, options *Options) (int, error) {
return 1, fmt.Errorf("terragrunt must be set as TerraformBinary to use this method")
}

return GetExitCodeForTerraformCommandE(t, options, FormatArgs(options, "plan-all", "--input=false", "--lock=true", "--detailed-exitcode")...)
return GetExitCodeForTerraformCommandE(t, options, FormatArgs(options, "run-all", "plan", "--input=false",
"--lock=true", "--detailed-exitcode")...)
}

// Custom errors
Expand Down