0
0
Terraformcloud~10 mins

S3 backend configuration in Terraform - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the S3 bucket name for the backend.

Terraform
terraform {
  backend "s3" {
    bucket = "[1]"
  }
}
Drag options to blanks, or click blank then click option'
Abucket-terraform
Bterraform-state
Cstate-bucket-123
Dmy-terraform-state-bucket
Attempts:
3 left
💡 Hint
Common Mistakes
Using a bucket name that does not exist in AWS.
Leaving the bucket name empty or misspelled.
2fill in blank
medium

Complete the code to specify the AWS region for the S3 backend.

Terraform
terraform {
  backend "s3" {
    bucket = "my-terraform-state-bucket"
    region = "[1]"
  }
}
Drag options to blanks, or click blank then click option'
Aus-east-1
Beu-central-1
Cus-west-2
Dap-southeast-1
Attempts:
3 left
💡 Hint
Common Mistakes
Using a region code that does not match the bucket's actual region.
Leaving the region attribute out.
3fill in blank
hard

Fix the error in the backend configuration by completing the missing key for encryption.

Terraform
terraform {
  backend "s3" {
    bucket         = "my-terraform-state-bucket"
    region         = "us-west-2"
    [1] = true
  }
}
Drag options to blanks, or click blank then click option'
Aenable_encryption
Bencrypt
Cencryption
Dencrypted
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect keys like 'encryption' or 'encrypted' which are not recognized.
Misspelling the key.
4fill in blank
hard

Fill both blanks to configure the DynamoDB table for state locking and specify the key name.

Terraform
terraform {
  backend "s3" {
    bucket         = "my-terraform-state-bucket"
    region         = "us-west-2"
    encrypt        = true
    dynamodb_table = "[1]"
    [2]    = "LockID"
  }
}
Drag options to blanks, or click blank then click option'
Aterraform-lock-table
Block_table
Ckey
Dlock_key
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong attribute names like 'lock_table' or 'lock_key'.
Confusing the key name with the table name.
5fill in blank
hard

Fill all three blanks to complete the S3 backend configuration with bucket, region, and encrypt enabled.

Terraform
terraform {
  backend "s3" {
    bucket  = "[1]"
    region  = "[2]"
    encrypt = [3]
  }
}
Drag options to blanks, or click blank then click option'
Amy-terraform-state-bucket
Bus-west-2
Ctrue
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Setting encrypt to false or as a string 'true' instead of boolean true.
Using wrong region or bucket names.