0
0
Terraformcloud~5 mins

Lifecycle customization in Terraform - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is lifecycle customization in Terraform?
It is a way to control how Terraform creates, updates, or deletes resources by setting special rules inside the resource block.
Click to reveal answer
beginner
What does the prevent_destroy lifecycle argument do?
It stops Terraform from deleting a resource, even if you run a destroy command or remove it from the config.
Click to reveal answer
intermediate
Explain the purpose of ignore_changes in lifecycle customization.
It tells Terraform to ignore changes to specified resource attributes so they won't trigger updates.
Click to reveal answer
intermediate
How does create_before_destroy affect resource updates?
Terraform creates the new resource first before deleting the old one to avoid downtime.
Click to reveal answer
beginner
Give an example use case for lifecycle customization in Terraform.
Protecting a database instance from accidental deletion by using prevent_destroy.
Click to reveal answer
Which lifecycle argument prevents Terraform from deleting a resource?
Acreate_before_destroy
Bignore_changes
Cprevent_destroy
Dreplace_triggered_by
What does ignore_changes do in Terraform lifecycle?
AIgnores changes to specified attributes
BDeletes resource attributes
CCreates resource before destroying old one
DTriggers replacement on attribute change
Why use create_before_destroy in lifecycle?
ATo prevent resource creation
BTo delete resource before creating new
CTo ignore resource changes
DTo create new resource before deleting old
Which lifecycle argument helps avoid accidental resource deletion?
Aignore_changes
Bprevent_destroy
Ccreate_before_destroy
Dreplace_triggered_by
Can lifecycle customization affect resource update behavior?
AYes, it can ignore changes or control update order
BNo, only creation and deletion
CNo, lifecycle only controls destroy
DYes, but only for resource import
Describe the main lifecycle customization options in Terraform and their effects.
Think about how Terraform handles create, update, and delete actions.
You got /3 concepts.
    Explain a scenario where you would use lifecycle customization to protect a resource.
    Consider resources that are costly or risky to lose.
    You got /3 concepts.