-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow
terraform init
to fail in additional codepaths
allow `terraform init` to fail -- as expected -- in instances where a non-legacy Terraform is used against a legacy TF state for the purposes of `state replace-provider`-ing _also_ when invoking `terraform init` from within `OverrideBackendToLocal`. This addresses the _second_ `init` error seen in the logs: ``` 2023/08/28 14:52:35 [INFO] [runner] load migration file: test.hcl 2023/08/28 14:52:35 [INFO] [migrator] start state migrator plan 2023/08/28 14:52:35 [INFO] [migrator@.] terraform version: 1.5.5 2023/08/28 14:52:35 [INFO] [migrator@.] initialize work dir 2023/08/28 14:52:35 [INFO] [migrator@.] ignoring error 'Error: Invalid legacy provider address' initilizing work dir; the error is expected when using Terraform >= 0.13 with a legacy Terraform state 2023/08/28 14:52:35 [INFO] [migrator@.] get the current remote state 2023/08/28 14:52:35 [INFO] [migrator@.] override backend to local 2023/08/28 14:52:35 [INFO] [executor@.] create an override file 2023/08/28 14:52:35 [INFO] [migrator@.] creating local workspace folder in: terraform.tfstate.d/default 2023/08/28 14:52:35 [INFO] [executor@.] switch backend to local 2023/08/28 14:52:35 [INFO] [migrator@.] compute a new state 2023/08/28 14:52:36 [INFO] [migrator@.] check diffs 2023/08/28 14:52:36 [INFO] [executor@.] remove the override file 2023/08/28 14:52:36 [INFO] [executor@.] remove the workspace state folder 2023/08/28 14:52:36 [INFO] [executor@.] switch back to remote 2023/08/28 14:52:36 [ERROR] [executor@.] failed to switch back to remote: failed to run command (exited 1): terraform init -input=false -no-color -reconfigure stdout: Initializing the backend... Successfully configured the backend "s3"! Terraform will automatically use this backend unless the backend configuration changes. stderr: Error: Invalid legacy provider address This configuration or its associated state refers to the unqualified provider "null". You must complete the Terraform 0.13 upgrade process before upgrading to later versions. 2023/08/28 14:52:36 [ERROR] [executor@.] please re-run terraform init -reconfigure 2023/08/28 14:52:36 [INFO] [migrator] state migrator plan success! ``` This seeks to address feedback from @minamijoyo: #145 (comment) Signed-off-by: Mike Ball <mikedball@gmail.com>
- Loading branch information
Showing
5 changed files
with
33 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters