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

A `check` block prints `Warning: Check block assertion failed` but the apply succeeds. Is this a problem?

AdvancedTroubleshootingModules, Variables, Sensitive Values and Workspaces
Answer

Likely causes → By design, check blocks (1.5+) only warn; they don't block applies. A failed assertion means a health condition isn't met (for example an endpoint returns non-200).

Diagnose → Read the assertion's error_message and test the target manually (curl -s -o /dev/null -w '%{http_code}' https://api.example.com/health).

Fix → Investigate the real problem. If it must block, use a precondition/postcondition on the resource instead.

Prevent → Send check failures from CI/HCP drift runs to alerting, so warnings aren't ignored.

All Terraform questions Roadmap: Terraform

More on Modules, Variables, Sensitive Values and Workspaces