Loading...
Loading...
<!-- Hi there, Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html. If your issue relates to a specific Terraform provider, please open it in the provider's own repository. The index of providers is at https://github.com/terraform-providers . --> ### Terraform Version <!--- Run `terraform -v` to show the version, and paste the result between the ``` marks below. If you are not running the latest version of Terraform, please try upgrading because your issue may have already been fixed. --> ``` 0.12.13 ``` ### Terraform Configuration Files <!-- Paste the relevant parts of your Terraform configuration between the ``` marks below. For large Terraform configs, please use a service like Dropbox and share a link to the ZIP file. For security, you can also encrypt the files using our GPG public key. --> ```hcl terraform { backend "azurerm" { resource_group_name = "rg-terraform" storage_account_name = "mystorageaccountname" container_name = "tfstate" key = "terraform.tfstate" subscription = "{some UUID}" } } ``` ### Debug Output <!-- Full debug output can be obtained by running Terraform with the environment variable `TF_LOG=trace`. Please create a GitHub Gist containing the debug output. Please do _not_ paste the debug output in the issue, since debug output is long. Debug output may contain sensitive information. Please review it before posting publicly, and if you are concerned feel free to encrypt the files using the HashiCorp security public key. --> ### Crash Output <!-- If the console output indicates that Terraform crashed, please share a link to a GitHub Gist containing the output of the `crash.log` file. --> ### Expected Behavior <!-- What should have happened? --> I was converting from using a `remote` backend to a `azurerm` backend. I had configured the `azurerm` backend incorrectly and provided the `subscription` field which doesn't exist instead of the `subscription_id` field. Terraform should have validated the backend and told me that the configuration was incorrect before attempting to copy the configuration to the new backend.. ### Actual Behavior <!-- What actually happened? --> No validation occurred and terraform reported that the provider had been successfully initialized. The response from the CLI was ``` Initializing the backend... Initializing provider plugins... Terraform has been successfully initialized! You may now begin working with Terraform. Try running "terraform plan" to see any changes that are required for your infrastructure. All Terraform commands should now work. If you ever set or change modules or backend configuration for Terraform, rerun this command to reinitialize your working directory. If you forget, other commands will detect it and remind you to do so if necessary. ``` When I ran `terraform plan`, the remote backend was still used instead of `azurerm` and in the `terraform.tfstate` file, the backend was still set to remote. ### Steps to Reproduce <!-- Please list the full steps required to reproduce the issue, for example: 1. `terraform init` 2. `terraform apply` --> 1. Create a new terraform config with `remote` as a backend. 2. `terraform init` 3. Change the backend to `azurerm` and provide the `subscription` parameter instead of `subscription_id`. 4. Run `terraform init`. 5. The `terraform.tfstate` file should still have `remote` listed as the backed and no message to migrate the workspaces will be received. 6. If you delete the backend manually from the `terraform.tfstate` file, validation will now run correctly and you will receive a message that it is configured incorrectly. ``` Initializing the backend... Error: Unsupported argument on backend.tf line 7, in terraform: 7: subscription = "b7d5a52e-843d-45fe-997f-6990f3549a8e" ``` ### Additional Context <!-- Are there anything atypical about your situation that we should know? For example: is Terraform running in a wrapper script or in a CI system? Are you passing any unusual command line options or environment variables to opt-in to non-default behavior? --> ### References <!-- Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example: - #6017 -->
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.