IssueRaiser

Support separate backend configurations for each workspace

### Terraform Version Terraform v0.10.8 ### Terraform Configuration Files ```hcl terraform { backend "s3" {} } ``` ### Debug Output N/A ### Crash Output N/A ### Expected Behavior I should be able to run any terraform command with `TF_WORKSPACE=...` to separate the operations between different states, as originally requested in #14447, and implemented for the new workspaces terminology in #14952. I would expect that, therefore, in order for this to work terraform would need to configure the backends for each workspace separately, so that multiple states can be manipulated in parallel. Switching workspaces should not cause any messages about the backend being reconfigured. ### Actual Behavior `terraform init` does not care about workspace; it always tries to reconfigure the _current_ backend when I switch to a new workspace and then initialize that one for a new state. ### Steps to Reproduce Please list the full steps required to reproduce the issue, for example: 1. `TF_WORKSPACE=foo terraform init -backend-config=bucket=mybucket -backend-config=region=us-east-1 -backend-config=key=foo.tfstate` 2. `TF_WORKSPACE=bar terraform init -backend-config=bucket=mybucket -backend-config=region=us-east-1 -backend-config=key=bar.tfstate` Terraform will say the backend configuration has changed and will ask to copy state from s3. ### Important Factoids Our team uses one tfstate per AWS region per environment. So for instance our qa environment has state files for us-west-2, us-eas

Posted by 2rs2ts on Nov 11, 2017, 12:28 AM

Tags

Related issues

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

reliability (E-commerce)

Support separate backend configurations for each workspace

2rs2tsNov 11, 2017, 12:28 AM

### Terraform Version Terraform v0.10.8 ### Terraform Configuration Files ```hcl terraform { backend "s3" {} } ``` ### Debug Output N/A ### Crash Output N/A ### Expected Behavior I should be able to run any terraform command with `TF_WORKSPACE=...` to separate the operations between different states, as originally requested in #14447, and implemented for the new workspaces terminology in #14952. I would expect that, therefore, in order for this to work terraform would need to configure the backends for each workspace separately, so that multiple states can be manipulated in parallel. Switching workspaces should not cause any messages about the backend being reconfigured. ### Actual Behavior `terraform init` does not care about workspace; it always tries to reconfigure the _current_ backend when I switch to a new workspace and then initialize that one for a new state. ### Steps to Reproduce Please list the full steps required to reproduce the issue, for example: 1. `TF_WORKSPACE=foo terraform init -backend-config=bucket=mybucket -backend-config=region=us-east-1 -backend-config=key=foo.tfstate` 2. `TF_WORKSPACE=bar terraform init -backend-config=bucket=mybucket -backend-config=region=us-east-1 -backend-config=key=bar.tfstate` Terraform will say the backend configuration has changed and will ask to copy state from s3. ### Important Factoids Our team uses one tfstate per AWS region per environment. So for instance our qa environment has state files for us-west-2, us-eas

Comments (0)

No comments yet. Start the discussion.

Comment on this issue