Interview Prep/Terraform/Modules, Variables, Sensitive Values and Workspaces

`Error: Resource postcondition failed` — `The selected AMI must be for the x86_64 architecture.` after a data source returns a new image.

AdvancedTroubleshootingModules, Variables, Sensitive Values and Workspaces
Answer

Likely causes → The postcondition caught a bad lookup result: filters matched an arm64 image published recently.

Diagnose → terraform console → data.aws_ami.app.architecture and .name.

Fix → Tighten filters (architecture = x86_64, exact name pattern, owners) so the lookup is deterministic.

Prevent → Keep postconditions on lookups whose results matter; they turn surprises into clear plan-time errors.

All Terraform questions Roadmap: Terraform

More on Modules, Variables, Sensitive Values and Workspaces