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

tfmigrate reports success despite backend not properly configured #129

Closed
florianmutter opened this issue Apr 6, 2023 · 1 comment
Closed

Comments

@florianmutter
Copy link

We forgot to configure the terraform backend properly and got the following logs:

 2023/04/06 12:57:09 [INFO] [runner] unapplied migration files: [2023-04-06-import-puc-hr-records.hcl]
2023/04/06 12:57:09 [INFO] [runner] load migration file: migrations/2023-04-06-import-puc-hr-records.hcl
2023/04/06 12:57:09 [INFO] [migrator] start state migrator plan
2023/04/06 12:57:09 [INFO] [migrator@.] terraform version: 1.4.4
2023/04/06 12:57:09 [INFO] [migrator@.] initialize work dir
2023/04/06 12:57:11 [INFO] [migrator@.] get the current remote state
2023/04/06 12:57:12 [INFO] [migrator@.] override backend to local
2023/04/06 12:57:12 [INFO] [executor@.] create an override file
2023/04/06 12:57:12 [INFO] [migrator@.] creating local workspace folder in: terraform.tfstate.d/default
2023/04/06 12:57:12 [INFO] [executor@.] switch backend to local
2023/04/06 12:57:13 [INFO] [migrator@.] compute a new state
2023/04/06 12:57:17 [INFO] [migrator@.] check diffs
2023/04/06 12:57:20 [INFO] [executor@.] remove the override file
2023/04/06 12:57:20 [INFO] [executor@.] remove the workspace state folder
2023/04/06 12:57:20 [INFO] [executor@.] switch back to remote
Error: /06 12:57:20 [ERROR] [executor@.] failed to switch back to remote: failed to run command (exited 1): /home/runner/work/_temp/0366c15f-c413-424b-89f7-f63bc6dbe449/terraform-bin init -input=false -no-color -reconfigure
stdout:

Initializing the backend...

stderr:

Error: "bucket": required field is not set



Error: /06 12:57:20 [ERROR] [executor@.] please re-run terraform init -reconfigure
2023/04/06 12:57:20 [INFO] [migrator] state migrator plan success!

I think tfmigrate should not report sucess if one of the terraform commands fails.

@florianmutter florianmutter changed the title tfmigrate reports success if backend is not configured properly tfmigrate reports success despite backend not properly configured Apr 6, 2023
@minamijoyo
Copy link
Owner

HI @florianmutter, thank you for reporting the issue! It has been fixed in v0.3.16 via #150. Thanks to @mdb 🎉

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

No branches or pull requests

2 participants