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 possible to use Terraform init -reconfigure #839

Closed
renanqts opened this issue Mar 29, 2021 · 2 comments · Fixed by #923
Closed

Make possible to use Terraform init -reconfigure #839

renanqts opened this issue Mar 29, 2021 · 2 comments · Fixed by #923
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@renanqts
Copy link

renanqts commented Mar 29, 2021

I didn't find a way or issue here mentioning a way to pass -reconfigure into TF init.

type Options struct {
TerraformBinary string // Name of the binary that will be used
TerraformDir string // The path to the folder where the Terraform code is defined.
// The vars to pass to Terraform commands using the -var option. Note that terraform does not support passing `null`
// as a variable value through the command line. That is, if you use `map[string]interface{}{"foo": nil}` as `Vars`,
// this will translate to the string literal `"null"` being assigned to the variable `foo`. However, nulls in
// lists and maps/objects are supported. E.g., the following var will be set as expected (`{ bar = null }`:
// map[string]interface{}{
// "foo": map[string]interface{}{"bar": nil},
// }
Vars map[string]interface{}
VarFiles []string // The var file paths to pass to Terraform commands using -var-file option.
Targets []string // The target resources to pass to the terraform command with -target
Lock bool // The lock option to pass to the terraform command with -lock
LockTimeout string // The lock timeout option to pass to the terraform command with -lock-timeout
EnvVars map[string]string // Environment variables to set when running Terraform
BackendConfig map[string]interface{} // The vars to pass to the terraform init command for extra configuration for the backend
RetryableTerraformErrors map[string]string // If Terraform apply fails with one of these (transient) errors, retry. The keys are a regexp to match against the error and the message is what to display to a user if that error is matched.
MaxRetries int // Maximum number of times to retry errors matching RetryableTerraformErrors
TimeBetweenRetries time.Duration // The amount of time to wait between retries
Upgrade bool // Whether the -upgrade flag of the terraform init command should be set to true or not
NoColor bool // Whether the -no-color flag will be set for any Terraform command or not
SshAgent *ssh.SshAgent // Overrides local SSH agent with the given in-process agent
NoStderr bool // Disable stderr redirection
OutputMaxLineSize int // The max size of one line in stdout and stderr (in bytes)
Logger *logger.Logger // Set a non-default logger that should be used. See the logger package for more info.
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)
}

Terraform reconfigure makes easy to fix issues in the backend

https://www.terraform.io/docs/cli/commands/init.html#backend-initialization

@yorinasub17 yorinasub17 added good first issue Good for newcomers enhancement New feature or request help wanted labels Apr 7, 2021
@yorinasub17
Copy link
Contributor

Seems reasonable to add a new option for to configure it! We are a bit buried with other initiatives, so most likely won't get to implement this anytime soon, but happy to review a PR if you are up for it.

@wasfree
Copy link

wasfree commented Jun 11, 2021

Since terraform v0.15.4 behavior on terraform init has changed. If init now encounters a change to the stored backend configuration, it will always return an error when neither -reconfigure or -migrate-state is supplied. This change was merged in hashicorp/terraform#28718 . PR to add this missing options has been raised see: #923

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants