Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What is immutable infrastructure?
Immutable infrastructure means once a server or resource is created, it is never changed or updated. Instead, if changes are needed, a new resource is created and the old one is replaced.
Click to reveal answer
beginner
Why is immutable infrastructure beneficial?
It reduces errors and inconsistencies because you avoid changing live systems. It also makes deployments predictable and easier to roll back by replacing resources instead of modifying them.
Click to reveal answer
intermediate
How does Terraform support immutable infrastructure?
Terraform creates and manages infrastructure as code. When you change configuration, Terraform can replace resources instead of updating them in place, supporting immutable infrastructure practices.
Click to reveal answer
beginner
What is a common real-life example of immutable infrastructure?
Using containers like Docker is a real-life example. Instead of changing a running container, you build a new container image and deploy it, replacing the old one.
Click to reveal answer
beginner
What happens to the old infrastructure in immutable infrastructure approach?
The old infrastructure is destroyed or decommissioned after the new one is deployed, ensuring only the new, updated resources are running.
Click to reveal answer
What does immutable infrastructure avoid?
AUsing code to manage infrastructure
BChanging live servers directly
CCreating new servers
DReplacing old resources
✗ Incorrect
Immutable infrastructure avoids changing live servers directly by replacing them instead.
In Terraform, how is immutable infrastructure usually implemented?
ABy updating resources in place
BBy ignoring configuration changes
CBy replacing resources when configuration changes
DBy manually editing servers
✗ Incorrect
Terraform replaces resources when configuration changes to support immutable infrastructure.
Which of these is a benefit of immutable infrastructure?
AMore manual updates
BIncreased configuration drift
CUnpredictable deployments
DEasier rollback
✗ Incorrect
Immutable infrastructure makes rollback easier by replacing resources instead of modifying them.
What happens to old resources in immutable infrastructure?
AThey are destroyed after replacement
BThey remain running alongside new ones
CThey are updated
DThey are ignored
✗ Incorrect
Old resources are destroyed after the new ones are deployed to keep infrastructure clean.
Which technology is a common example of immutable infrastructure?
ADocker containers
BManual server updates
CTraditional virtual machines
DDirect database edits
✗ Incorrect
Docker containers are often used as immutable infrastructure by replacing containers instead of changing them.
Explain the concept of immutable infrastructure and why it is useful.
Think about how you would update a server without changing it directly.
You got /3 concepts.
Describe how Terraform helps implement immutable infrastructure.
Consider how Terraform manages resources when you change your code.
You got /3 concepts.
Practice
(1/5)
1. What does the term immutable infrastructure mean in Terraform?
easy
A. Replacing resources instead of modifying them in place
B. Changing resources directly without replacement
C. Manually updating resources outside Terraform
D. Using mutable variables to configure resources
Solution
Step 1: Understand the definition of immutable infrastructure
Immutable infrastructure means you do not change existing resources but replace them entirely when updates are needed.
Step 2: Compare options with this definition
Only Replacing resources instead of modifying them in place describes replacing resources instead of modifying them, which matches the concept.
Final Answer:
Replacing resources instead of modifying them in place -> Option A
Quick Check:
Immutable infrastructure = Replace, not modify [OK]
Hint: Immutable means replace, not change existing resources [OK]
Common Mistakes:
Thinking mutable means immutable
Confusing manual updates with Terraform-managed changes
Assuming resources are changed in place
2. Which Terraform lifecycle argument helps implement immutable infrastructure by creating new resources before destroying old ones?
easy
A. ignore_changes
B. prevent_destroy
C. create_before_destroy
D. replace_triggered_by
Solution
Step 1: Identify lifecycle arguments related to resource replacement
Terraform lifecycle has arguments like create_before_destroy, prevent_destroy, ignore_changes, and replace_triggered_by.
Step 2: Match argument to immutable infrastructure behavior
Create_before_destroy ensures new resource is created before old one is destroyed, supporting immutable infrastructure.
Final Answer:
create_before_destroy -> Option C
Quick Check:
Lifecycle create_before_destroy = create new before delete old [OK]
Hint: Use create_before_destroy to replace safely [OK]
Common Mistakes:
Confusing prevent_destroy with create_before_destroy
Using ignore_changes which skips updates but doesn't replace
Misunderstanding replace_triggered_by purpose
3. Given this Terraform resource snippet with lifecycle:
5. You want to deploy a web server with immutable infrastructure using Terraform. Which combination of lifecycle settings and resource management best supports this goal?
hard
A. Use ignore_changes on all attributes to prevent updates
B. Use create_before_destroy = true and avoid manual changes outside Terraform
C. Use prevent_destroy = true to stop any resource replacement
D. Manually update resources and disable Terraform lifecycle rules
Solution
Step 1: Identify lifecycle settings that enable immutable infrastructure
Create_before_destroy = true ensures new resource is ready before old is removed, supporting immutable infrastructure.
Step 2: Consider resource management best practices
Avoid manual changes outside Terraform to keep infrastructure consistent and manageable.
Final Answer:
Use create_before_destroy = true and avoid manual changes outside Terraform -> Option B