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

Do not reconfigure for cloud backend #98

Merged

Conversation

dex4er
Copy link
Contributor

@dex4er dex4er commented Aug 3, 2022

Cloud backend doesn't like -reconfigure argument and there is proper condition in the code but somehow it is hardcoded in array initialization.

@minamijoyo
Copy link
Owner

Hi @dex4er, Have you tried the is_backend_terraform_cloud option introduced in v0.3.2+? It allows you to skip the -reconfigure flag when switching remote state backend to the Terraform Cloud. If it doesn't help you, please open a new bug report with a reproduction case.
https://github.com/minamijoyo/tfmigrate/tree/v0.3.4#is_backend_terraform_cloud

@dex4er
Copy link
Contributor Author

dex4er commented Aug 4, 2022

@minamijoyo of course I tried is_backend_terraform_cloud = true and it can't work correctly because it is ignored then tfmigrate dies because of terraform init -reconfigure additional option.

See: this condition https://github.com/minamijoyo/tfmigrate/blob/master/tfexec/terraform.go#L262 adds 2nd -reconfigure to the array defined in https://github.com/minamijoyo/tfmigrate/blob/master/tfexec/terraform.go#L257

In other words:

Without this patch if Terraform Cloud is used tfmigrate always breaks with

Error: Invalid command-line option

The -reconfigure option is for in-place reconfiguration of state backends
only, and is not needed when changing Terraform Cloud settings.

With my patch tfmigrate breaks with this error only when is_backend_terraform_cloud = false and works correctly when is_backend_terraform_cloud = true.

@minamijoyo
Copy link
Owner

@dex4er Thank you for your patch! It looks good but acceptance tests are failing due to an unrelated timeout issue. I tried to rerun but still failing.
I fixed the timeout issue in #100. Could you rebase this branch on the latest master?

@dex4er dex4er force-pushed the no-reconfigure-for-cloud-backend branch from 943fe1b to 74716e6 Compare August 5, 2022 09:47
@dex4er
Copy link
Contributor Author

dex4er commented Aug 5, 2022

@minamijoyo please redo tests

Copy link
Owner

@minamijoyo minamijoyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix 👍

@minamijoyo minamijoyo merged commit 5fca46b into minamijoyo:master Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants