Cause drift, detect it, and decide what to do about it
Task
Make a change outside the code, discover it the way a scheduled plan would, and then take both possible decisions -- revert and adopt -- so you have done each once.
Steps
- Apply a small environment from code and confirm a second apply reports no changes.
- Change something by hand outside the tool -- rename a container, change a label, alter a file the template manages.
- Run plan WITHOUT applying, and save the output to
lab/drift-plan.txt. Record which resource it wants to change and whether it says update or REPLACE. - Apply, confirm the manual change was reverted, and write in
lab/decisions.mdwhat this proves about an emergency fix made in a console at 2am. - Now make a second manual change that is actually CORRECT, update the code to match it instead, and confirm plan is empty. Record that as the adopt decision.
Verify
test -s lab/drift-plan.txt && grep -Eci 'change|update|replace|~|-/\+' lab/drift-plan.txt
grep -Eci 'revert' lab/decisions.md
grep -Eci 'adopt' lab/decisions.md
Both decisions must be recorded. Drift left undecided is the state that causes the surprise, because the next apply decides for you.
This is an independent study companion for CompTIA Cloud+ CV0-004 and is not produced by or endorsed by CompTIA.