Recall & Review
beginner
What is a block in Terraform?
A block is a container in Terraform configuration that groups related settings together, like resources, variables, or providers.
Click to reveal answer
beginner
Name the three main parts of a Terraform block.
1. Block type (like resource or variable)<br>2. Block label(s) (like resource name)<br>3. Block body (the settings inside curly braces {}).
Click to reveal answer
beginner
How do you write a resource block for an AWS S3 bucket named 'mybucket'?
resource "aws_s3_bucket" "mybucket" {
bucket = "mybucket"
acl = "private"
}
Click to reveal answer
intermediate
What is the purpose of labels in a Terraform block?
Labels identify the block uniquely within its type, like naming a resource so Terraform can track it.
Click to reveal answer
intermediate
Can blocks be nested inside other blocks in Terraform? Give an example.
Yes, for example, a resource block can contain nested blocks like 'lifecycle' or 'provisioner' to add extra settings.
Click to reveal answer
What symbol encloses the body of a Terraform block?
✗ Incorrect
Terraform block bodies are enclosed in curly braces {}.
Which part of a Terraform block uniquely identifies a resource?
✗ Incorrect
Block labels uniquely identify resources within their block type.
Which of these is NOT a valid Terraform block type?
✗ Incorrect
'function' is not a Terraform block type; resource, variable, and provider are valid.
How many labels can a resource block have at minimum?
✗ Incorrect
A resource block requires two labels: the resource type (e.g., aws_s3_bucket) and the name (e.g., mybucket).
What is the correct order of parts in a Terraform block?
✗ Incorrect
The order is block type, then labels, then block body.
Describe the structure of a Terraform block and explain the role of each part.
Think about how Terraform groups settings and identifies resources.
You got /4 concepts.
Explain how nested blocks work in Terraform and give an example of when you might use one.
Consider extra settings inside a resource.
You got /3 concepts.