-
Notifications
You must be signed in to change notification settings - Fork 10.3k
TF_WORKSPACE allows workspace names 'terraform workspace' does not #24564
Copy link
Copy link
Closed
Labels
bugconfirmeda Terraform Core team member has reproduced this issuea Terraform Core team member has reproduced this issue
Description
Terraform Version
Terraform v0.12.24
Terraform Configuration Files
Just using a basic S3 backend
terraform {
backend "s3" {
key = "github-actions-tfstate"
}
}Expected Behavior
Workspace names sourced from TF_WORKSPACE should undergo the same syntax checking as the terraform workspace commands and Terraform should error out appropriately.
Actual Behavior
Using TF_WORKSPACE makes it possible to define invalid workspace names.
Steps to Reproduce
terraform initterraform workspace new 'inv${}alid'TF_WORKSPACE='inv${}alid' terraform planterraform workspace list
E.g.:
$ terraform init -backend-config="bucket=${STATE_BUCKET}"
$ terraform workspace new 'inv${}alid'
The workspace name "inv${}alid" is not allowed. The name must contain only URL safe
characters, and no path separators.
$ TF_WORKSPACE='inv${}alid' terraform plan
$ terraform workspace list
* default
inv${}alid
$ terraform workspace select 'inv${}alid'
The workspace name "inv${}alid" is not allowed. The name must contain only URL safe
characters, and no path separators.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugconfirmeda Terraform Core team member has reproduced this issuea Terraform Core team member has reproduced this issue