Complete the code to specify the backend type in Terraform.
terraform {
backend "[1]" {}
}The backend type defines where Terraform stores its state. "local" stores state on your local machine.
Complete the code to specify the bucket name for an S3 backend.
terraform {
backend "s3" {
bucket = "[1]"
}
}The bucket name is a unique identifier for your S3 bucket where Terraform state is stored.
Fix the error in the backend configuration by completing the region field.
terraform {
backend "s3" {
bucket = "terraform-bucket"
region = "[1]"
}
}The AWS region must be specified in the correct format, such as "us-west-2".
Fill both blanks to configure the DynamoDB table and key for state locking.
terraform {
backend "s3" {
bucket = "terraform-bucket"
region = "us-west-2"
dynamodb_table = "[1]"
key = "[2]"
}
}The DynamoDB table is used for state locking to prevent concurrent changes. The key is the path to the state file.
Fill all three blanks to complete the backend configuration with encryption and profile.
terraform {
backend "s3" {
bucket = "terraform-bucket"
region = "us-west-2"
encrypt = [1]
dynamodb_table = "terraform-lock-table"
profile = "[2]"
key = "[3]"
}
}Encryption should be enabled with true. The AWS profile is often "default" unless you use a named profile. The key is the state file path.