Complete the code to reference the current Terraform workspace.
output "current_workspace" { value = terraform.[1] }
The terraform.workspace expression returns the name of the current workspace.
Complete the code to conditionally set a variable based on the current workspace.
variable "env" { default = terraform.[1] == "prod" ? "production" : "development" }
Use terraform.workspace to get the current workspace and compare it.
Fix the error in the code to correctly output the workspace name.
output "workspace_name" { value = terraform.[1] }
terraform.workspace is a property, not a function, so no parentheses are needed.
Fill both blanks to create a resource name that includes the current workspace.
resource "aws_s3_bucket" "example" { bucket = "my-app-$[1]-$[2]" acl = "private" }
The bucket name uses terraform.workspace and a variable var.env to include environment details.
Fill all three blanks to create a tag map including the workspace and environment.
tags = {
Name = "app-$[1]"
Environment = "$[2]"
Workspace = terraform.[3]
}The tag Name uses var.env, Environment is set to a string, and Workspace uses terraform.workspace.