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

Add option to do terraform init without initializing backend #1044

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions modules/terraform/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ func InitE(t testing.TestingT, options *Options) (string, error) {
args = append(args, "-migrate-state", "-force-copy")
}

if options.NoBackend {
args = append(args, "-backend=false")
}

args = append(args, FormatTerraformBackendConfigAsArgs(options.BackendConfig)...)
args = append(args, FormatTerraformPluginDirAsArgs(options.PluginDir)...)
return RunTerraformCommandE(t, options, args...)
Expand Down
1 change: 1 addition & 0 deletions modules/terraform/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ type Options struct {
Parallelism int // Set the parallelism setting for Terraform
PlanFilePath string // The path to output a plan file to (for the plan command) or read one from (for the apply command)
PluginDir string // The path of downloaded plugins to pass to the terraform init command (-plugin-dir)
NoBackend bool // If true, pass "-backend=false" to the terraform init command
}

// Clone makes a deep copy of most fields on the Options object and returns it.
Expand Down