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

Make sure Terragrunt commands can be configured with -lock=true #788

Merged
merged 1 commit into from
Mar 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/terraform/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TgApplyAllE(t testing.TestingT, options *Options) (string, error) {
return "", TgInvalidBinary(options.TerraformBinary)
}

return RunTerraformCommandE(t, options, FormatArgs(options, "apply-all", "-input=false", "-lock=false", "-auto-approve")...)
return RunTerraformCommandE(t, options, FormatArgs(options, "apply-all", "-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
18 changes: 18 additions & 0 deletions modules/terraform/apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,21 @@ func TestParallelism(t *testing.T) {
duration := end.Sub(start)
require.Greater(t, int64(duration.Seconds()), int64(25))
}
func TestTgApplyUseLockNoError(t *testing.T) {
t.Parallel()

testFolder, err := files.CopyTerragruntFolderToTemp("../../test/fixtures/terragrunt/terragrunt-no-error", t.Name())
require.NoError(t, err)

options := WithDefaultRetryableErrors(t, &Options{
TerraformDir: testFolder,
TerraformBinary: "terragrunt",
Lock: true,
})

out := TgApplyAll(t, options)

require.Contains(t, out, "Hello, World")
// make sure -lock CLI option is passed down correctly
require.Contains(t, out, "-lock=true")
}
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", "-lock=false")...)
return RunTerraformCommandE(t, options, FormatArgs(options, "destroy-all", "-force", "-input=false")...)
}
2 changes: 2 additions & 0 deletions modules/terraform/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import (
var TerraformCommandsWithLockSupport = []string{
"plan",
"apply",
"apply-all",
"destroy",
"destroy-all",
"init",
"refresh",
"taint",
Expand Down