Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define a resource block for an AWS S3 bucket.
Terraform
resource "aws_s3_bucket" "my_bucket" { bucket = [1] acl = "private" }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable name without quotes
Using an ACL value instead of bucket name
Omitting quotes around the bucket name
✗ Incorrect
The bucket name must be a string literal with quotes, representing the unique bucket name.
2fill in blank
mediumComplete the code to specify the AWS region in the provider block.
Terraform
provider "aws" { region = [1] }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes around the region name
Using variable names without defining them
✗ Incorrect
The region value must be a string literal enclosed in quotes.
3fill in blank
hardFix the error in the resource block by completing the lifecycle rule to prevent bucket deletion.
Terraform
resource "aws_s3_bucket" "my_bucket" { bucket = "my-unique-bucket-name" lifecycle { [1] = true } }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect lifecycle attribute names
Confusing lifecycle rules with resource attributes
✗ Incorrect
The correct lifecycle argument to prevent resource destruction is 'prevent_destroy'.
4fill in blank
hardFill both blanks to create an output that shows the bucket ARN.
Terraform
output "bucket_arn" { value = aws_s3_bucket.my_bucket[1][2] }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using brackets instead of dot notation
Using incorrect attribute names
✗ Incorrect
To access the ARN attribute, use dot notation: aws_s3_bucket.my_bucket.arn
5fill in blank
hardFill all three blanks to define a variable with a default value and description.
Terraform
variable "bucket_name" { type = [1] default = [2] description = [3] }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Quoting the type value
Omitting quotes around default or description
Using incorrect variable syntax
✗ Incorrect
The type is unquoted 'string', default and description are string literals with quotes.