0
0
Terraformcloud~5 mins

Drift detection in CI/CD in Terraform - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is drift detection in the context of CI/CD?
Drift detection is the process of identifying differences between the desired infrastructure state defined in code and the actual state running in the cloud or environment.
Click to reveal answer
beginner
Why is drift detection important in Terraform-based CI/CD pipelines?
It ensures that the infrastructure matches the code, preventing unexpected changes or errors caused by manual updates or external modifications.
Click to reveal answer
beginner
Which Terraform command is commonly used to detect drift?
The command terraform plan compares the current infrastructure state with the configuration files and shows any differences.
Click to reveal answer
intermediate
How can drift detection be automated in a CI/CD pipeline?
By running terraform plan as part of the pipeline and failing the build if unexpected changes are detected.
Click to reveal answer
beginner
What is a common real-life analogy for drift detection?
It's like checking your house keys against a checklist before leaving to make sure nothing is missing or changed unexpectedly.
Click to reveal answer
What does Terraform's terraform plan command do in drift detection?
AShows differences between code and actual infrastructure
BDeletes all infrastructure
CDeploys new infrastructure without checking
DOnly formats the code files
Why should drift detection be part of a CI/CD pipeline?
ATo send notifications to users
BTo speed up code compilation
CTo backup code files
DTo automatically detect and prevent unexpected infrastructure changes
What happens if drift is detected during a CI/CD pipeline run?
AThe pipeline can fail to alert the team
BThe pipeline ignores it and continues
CThe infrastructure is deleted
DThe code is automatically changed
Which of these is NOT a cause of drift?
AManual changes made directly in the cloud console
BConfiguration files left unchanged
CExternal scripts modifying resources
DInfrastructure as code updates
What is a simple way to fix drift once detected?
AIgnore the drift and continue
BDelete all resources manually
CRun <code>terraform apply</code> to align infrastructure with code
DRestart the CI/CD server
Explain what drift detection is and why it matters in a Terraform CI/CD pipeline.
Think about how code and real infrastructure can get out of sync.
You got /3 concepts.
    Describe how you would automate drift detection in a CI/CD pipeline using Terraform commands.
    Consider what commands show differences and how the pipeline should respond.
    You got /3 concepts.