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

Terraform Cloud remote state: add allowing a prefix/suffix for organization parameter #25575

Open
binlab opened this issue Jul 14, 2020 · 1 comment

Comments

@binlab
Copy link
Contributor

binlab commented Jul 14, 2020

Current Terraform Version

Terraform v0.12.28

Use-cases

For top-level security reasons - each Workspace e.g. Production, Staging, Development etc in a separate organization with a suffix with an appropriate environment e.g. myOrganization-Production, myOrganization-Staging etc.

Proposal

Would be nice to have the possibility configuring the prefix/suffix of the organization by workspace. For security reasons (state file storing a piece of sensitive information) we want to split different environments by high level (e.g. like it advises by Amazon - each environment in separate AWS account). Now we can't grant permission for some group of people only for e.g. a Staging environment without allowing permission to see a Production environment.

For now this not allowed:

terraform {
  backend "remote" {
    hostname     = "app.terraform.io"
    organization = format("myOrganization-%s", terraform.workspace)
    workspaces {
      name = "aws"
    }
  }
}

fails with an errors:

$ terraform init 
Initializing modules...

Initializing the backend...
Backend configuration changed!

Terraform has detected that the configuration specified for the backend
has changed. Terraform will now check for existing state in the backends.

Error: Function calls not allowed

  on main.tf line 4, in terraform:
   4:     organization = format("myOrganization-%s", terraform.workspace)

Functions may not be called here.
@binlab
Copy link
Contributor Author

binlab commented Apr 20, 2021

@apparentlymart are there any updates according to this issue?
seems like this a related issue #13022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants