Open leighmhart opened 7 years ago
I would like the same feature for different reasons. We have several identical environments, prod, stage, test/dev, and the only difference between them is the size of the instances and clusters. We use the same terraform directory for them, and switch off between them by changing which tfvar file is used. We also expect that the backend (the tfstate file) will get saved to different locations.
For example, we have:
dev.tfvars
stage.tfvars
prod.tfvars
The tfvars files looks like this:
env_name = "dev"
<other stuff...>
And we would like to do this with our backend:
terraform {
required_version = "~> 0.9.8"
backend "s3" {
bucket = "xxxxxx-terraform-backend"
key = "infrastructure/terraform/xxxxx/${var.env_name}/terraform.tfstate"
region = "us-east-1"
profile = "yyyyyy"
}
}
+1
+1
Can anyone tell me... In Terraform can we have custom names for state files and copy the state files to different location, while these values are being passed via variables? I have several clusters and environments with same configuration, I like to have all of them in single statck/folder.
Thanks in Advance, Bijesh
+1
+1
I'm having exact same issue. It would be really great to have variable interpolations in backend. This way we could build modules with more flexibility.
+1. Would be gr8 to have interpolation for backend config.
Or at the least, allow very "basic" interpolation. Like, it needs to be a variable supplied on the command line, env var, or through the vars file.
+1
As an alternative, for consul backend. It appears that we can use environment variables for everything except path. Path is the one thing we need either variable interpolation for or to have exposed via env.
https://www.terraform.io/docs/backends/types/consul.html
why is CONSUL_PATH not a supported env variable?
+1
+1
+1
+1
+1
+1
Hi there,
I'd like to use variables to configure backend for remote state storage and locking (s3 in this case) so that I can pop my remote-state.tf file into our GCP project template repository and not worry about anyone (including me) forgetting to set the key properly (so that tfstates are unique per project in the bucket).
Example:
The error output for 0.9.6 is as follows:
I get the explanation here - makes perfect sense that I can't use ${module.project.id} as part of my key-name (because the remote state contains that value and - well - chicken/egg) - however, I should be able to access variables defined in variables.tf / terraform.tfvars as those are still local resources?
Thanks for any consideration!
Regards
Leigh