Feature request: Support workspaces in Terraform #4440
Labels
area/terraform
terraform support issue
stage/pm-review
Waiting for review by our Product Manager, please don't work on this yet
type/feature
Feature request
Currently sam build with the terraform hook use the default workspace. I use workspaces when developing terraform modules to test changes without affecting production infrastructure.
I typically use a pattern where I use the workspace value as the key for selecting value from other map variables. A short example is below.
locals {
Environment = terraform.workspace
log_level = {
"prod" = "INFO"
"dev" = "DEBUG"
}
module "interfolio_uploader_lambda" {
source = "terraform-aws-modules/lambda/aws"
environment_variables = {
"LOG_LEVEL" : local.log_level[local.Environment]
}
... other config ...
}
Proposal
I see a couple of ways to solve this:
terraform init
andterraform workspace select/new <environment>
The text was updated successfully, but these errors were encountered: