Open six8 opened 2 years ago
The docs say:
Our convention is to name files by $env-$stage.yaml (e.g. ue2-testing.yaml), so for example an $env could be ue2 (for us-east-2) and the $stage might be testing. Workspace names are derived from the $env-$stage-$project, which looks like ue2-testing-eks.
But it looks like the workspace name is $config_file_name-$project
. This means I can name the file $project-$env-$stage
instead of $env-$stage
and get the desired effect of a project prefix.
Have a question? Please checkout our Slack Community or visit our Slack Archive.
Describe the Feature
To have terraform cloud automatically find workspaces to use with
terraform workspace
on the CLI, you configure it with a prefix:See https://www.terraform.io/docs/language/settings/backends/remote.html#workspaces
terraform-tfe-cloud-infrastructure-automation
puts the environment as a prefix. For exampleue2
. In order for terraform to find the workspaces by prefix, the environment would have to be used:Project name as a prefix seems like a more expected prefix to support this behavior.
Expected Behavior
Workspace pattern is
{project}-{stage}-{env}
instead of{env}-{stage}-{project}
. Essentially a reversed order -- least specific to most specific.Use Case
To be able to use
terraform workspace select
to select a workspace by prefix.Describe Ideal Solution
That the template used to set the workspace name is configurable.
Alternatives Considered
Using the env (ex
ue2-
) as a prefix. This doesn't work well because multiple, unrelated projects are on the same environment.