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

backend config does not accept vars #12200

Closed
michalmedvecky opened this issue Feb 23, 2017 · 2 comments
Closed

backend config does not accept vars #12200

michalmedvecky opened this issue Feb 23, 2017 · 2 comments

Comments

@michalmedvecky
Copy link

Terraform Version

Terraform v0.9.0-beta1 (4e96da5+CHANGES)

Affected Resource(s)

remote backends

Terraform Configuration Files

storage.tf

terraform {
  backend "swift" {
    path = "${var.env}"
  }
}

and terraform.tfvars:

env = "dev"

Expected Behavior

swift container should be called dev

Actual Behavior

swift container is called ${var.env}

Steps to Reproduce

  1. terraform init
  2. swift list
@apparentlymart
Copy link
Contributor

Hi @michalmedvecky! Sorry this doesn't work the way you expected.

There's some discussion of this limitation and the intended workarounds over in the comments of #12067. The summary of that is that for a multi-state configuration one can omit the remote configuration from what's checked in to version control and then generate (either manually or via script) a one-off configuration file that contains the desired settings, editing or replacing this file each time you want to talk to a new environment.

In 0.9 this is safer than with terraform remote config since changing the backend config won't cause Terraform to try to copy the current active state over the top of the newly-selected state, as 0.8 and earlier did when running terraform remote config.

I'm going to close this issue just because we already have an open place where this is being discussed and I'd like to keep the discussion consolidated.

(That PR actually addresses the UX quirk implied by your report here, making Terraform generate an explicit error about interpolations not being permitted rather than simply accepting it and passing the raw expression to the backend.)

@ghost
Copy link

ghost commented Apr 16, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants