IssueRaiser

Using variables in terraform backend config block

### Terraform Version v0.9.0 ### Affected Resource(s) terraform backend config ### Terraform Configuration Files ```hcl variable "azure_subscription_id" { type = "string" default = "74732435-e81f-4a43-bf68-ced435436edf" } variable "azure_tenant_id" { type = "string" default = "74732435-e81f-4a43-bf68-ced435436edf" } terraform { required_version = ">= 0.9.0" backend "azure" { resource_group_name = "stuff" storage_account_name = "morestuff" container_name = "terraform" key = "yetmorestuff.terraform.tfstate" arm_subscription_id = "${var.azure_subscription_id}" arm_tenant_id = "${var.azure_tenant_id}" } } ``` ### Expected Behavior Variables are used to configure the backend ### Actual Behavior ``` Error initializing new backend: Error configuring the backend "azure": Failed to configure remote backend "azure": Couldn't read access key from storage account: Error retrieving keys for storage account "morestuff": autorest#WithErrorUnlessStatusCode: POST https://login.microsoftonline.com/$%7Bvar.azure_tenant_id%7D/oauth2/token?api-version=1.0 failed with 400 Bad Request: StatusCode=400. ``` ### Steps to Reproduce 1. `terraform apply` ### Important Factoids I wanted to extract these to variables because i'm using the same values in a few places, including in the provider config where they work fine.

Posted by glenjamin on Mar 23, 2017, 8:06 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.4,500 issues0 comments

github (Other)

Using variables in terraform backend config block

glenjaminMar 23, 2017, 8:06 PM

### Terraform Version v0.9.0 ### Affected Resource(s) terraform backend config ### Terraform Configuration Files ```hcl variable "azure_subscription_id" { type = "string" default = "74732435-e81f-4a43-bf68-ced435436edf" } variable "azure_tenant_id" { type = "string" default = "74732435-e81f-4a43-bf68-ced435436edf" } terraform { required_version = ">= 0.9.0" backend "azure" { resource_group_name = "stuff" storage_account_name = "morestuff" container_name = "terraform" key = "yetmorestuff.terraform.tfstate" arm_subscription_id = "${var.azure_subscription_id}" arm_tenant_id = "${var.azure_tenant_id}" } } ``` ### Expected Behavior Variables are used to configure the backend ### Actual Behavior ``` Error initializing new backend: Error configuring the backend "azure": Failed to configure remote backend "azure": Couldn't read access key from storage account: Error retrieving keys for storage account "morestuff": autorest#WithErrorUnlessStatusCode: POST https://login.microsoftonline.com/$%7Bvar.azure_tenant_id%7D/oauth2/token?api-version=1.0 failed with 400 Bad Request: StatusCode=400. ``` ### Steps to Reproduce 1. `terraform apply` ### Important Factoids I wanted to extract these to variables because i'm using the same values in a few places, including in the provider config where they work fine.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue