Complete the code to select the current Terraform workspace.
terraform.workspace == "[1]"
The default workspace in Terraform is named default. Using terraform.workspace returns the current workspace name.
Complete the code to configure a remote backend with an S3 bucket named 'my-terraform-state'.
backend "s3" { bucket = "[1]" key = "state.tfstate" region = "us-east-1" }
The bucket attribute specifies the S3 bucket name where Terraform stores the remote state. Here, it should be my-terraform-state.
Fix the error in the backend configuration by completing the missing attribute for DynamoDB table used for state locking.
backend "s3" { bucket = "my-terraform-state" key = "state.tfstate" region = "us-east-1" dynamodb_table = "[1]" }
The dynamodb_table attribute specifies the DynamoDB table used for state locking. The correct table name here is terraform-locks.
Fill both blanks to create a workspace and select it using Terraform CLI commands.
terraform workspace [1] myworkspace terraform workspace [2] myworkspace
To create a new workspace, use terraform workspace new. To switch to it, use terraform workspace select.
Fill all three blanks to configure a remote backend with S3 bucket, DynamoDB table for locking, and enable encryption.
backend "s3" { bucket = "[1]" key = "terraform.tfstate" region = "us-west-2" dynamodb_table = "[2]" encrypt = [3] }
The bucket is my-remote-state, the dynamodb_table is terraform-lock-table, and encrypt should be set to true to enable encryption.