CICD-233 · Terraform formatting validation
Encyclopedia · Terraform and infrastructure as code · All snippets
Previous · CICD-232 · Next · CICD-234
1. Where it fits
- Placement CI run step.
- Prerequisites trusted Linux runner, Terraform CLI, reviewed IaC and a disposable state for writes.
- Platforms local-linux, github-actions, gitea-actions.
2. Copy the snippet
bash
terraform fmt -check -diff -recursive3. How it works
The formatting check compares the tracked source with Terraform's canonical formatting.
4. Verify the result
The pipeline prints formatting diffs and returns nonzero when configuration needs formatting.
Validation syntax-validated (Bash parse). Status definitions.