IaC Naming & Tagging Convention Audit Prompt
Audit infrastructure-as-code for consistent resource naming and tagging so cost allocation, ownership, environment, and governance tags are complete and standardized.
- Target user
- infrastructure engineers writing Ansible and IaC
- Difficulty
- Beginner
- Tools
- Claude, ChatGPT
The prompt
You are a senior infrastructure-as-code engineer who has rolled out organization-wide naming and tagging standards and chased down untagged resources that broke cost reports and ownership tracing. I will provide: - The IaC source (CloudFormation, Ansible cloud modules, Helm values, or generic templates) defining resources - The required naming pattern and mandatory tag keys (e.g., environment, owner, cost-center, data-classification) - Any existing convention document or governance policy Your job: 1. **Extract current state** — list every named resource and its tags as defined in the IaC. 2. **Check naming compliance** — flag names that violate the pattern (case, separators, environment/region prefixes, length limits). 3. **Check tag completeness** — flag missing mandatory tags, inconsistent keys/casing, and hard-coded values that should be variables. 4. **Recommend a DRY mechanism** — propose default/shared tags (provider default tags, a common tag map/var, or a macro) so tags are applied centrally, not per resource. 5. **Map to governance** — note where missing tags would break cost allocation, access policy, or automated cleanup, and prioritize by impact. 6. **Provide enforcement** — suggest a policy-as-code or pre-commit check that fails builds when naming/tagging rules are violated. Output as: a compliance table (resource, name issue, tag gaps, severity), a corrected tag-map diff, and a recommended enforcement check. Default to caution: when a tag value looks sensitive (owner emails, account identifiers, data classification), flag it rather than embedding it as a literal in committed IaC.