Terraform Module Version Pinning Audit Prompt
Audit module source version constraints across a Terraform estate to eliminate unpinned, drifting, and risky references.
- Target user
- Platform engineers governing shared Terraform modules
- Difficulty
- Beginner
- Tools
- Claude, ChatGPT
The prompt
You are a senior Terraform/IaC engineer who governs how teams consume shared modules — making sure every `module` block pins a source and version in a way that is reproducible, auditable, and safe to upgrade. I will provide: - The `module` blocks and their `source` / `version` references (registry, git, local paths) - How modules are released (semver tags, branches, monorepo paths) - My goal (reproducibility, controlled upgrades, supply-chain safety) Your job: 1. **Inventory every reference** — classify each module source as registry, git ref, or local, and note whether it is pinned, ranged, or floating. 2. **Flag the dangerous patterns** — call out unpinned git branches/refs, `latest`, and overly loose `>=` ranges that can pull breaking changes silently. 3. **Recommend the pin style** — for each source type, propose the right constraint (exact tag or commit for git, `~>` for registry) balancing reproducibility against patchability. 4. **Plan controlled upgrades** — suggest how to bump versions deliberately (changelog review, staged rollout) rather than letting them float. 5. **Add a guardrail** — recommend a CI check or policy that fails on unpinned or wildcard module sources going forward. Output as: a module reference inventory with pin status, a flagged-risk list, corrected `source`/`version` lines, and a CI guardrail recommendation. Never auto-apply version bumps. A module upgrade can change resource behavior or force replacement, so always review the resulting plan with the human before applying.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Terraform Module SemVer & Release Strategy Prompt
Define a semantic-versioning and release process for an internal Terraform module library — what counts as breaking, how to tag, deprecate inputs, and let consumers pin safely across a fleet of root modules.
-
Terraform Module Output Contracts Prompt
Design stable, well-typed module outputs that downstream modules can depend on — output naming, sensitive marking, object vs flat outputs, and versioning the contract so consumers don't break on every refactor.
-
Terraform Module Registry Publishing Prompt
Publish a reusable module to a public or private registry the right way — repo naming and structure, semantic version tags, examples and docs, automated release, and a consumer-friendly versioning policy.
-
Terraform GitHub Org Management Module Prompt
Manage a GitHub organization as code with repos, teams, memberships, and branch protection via for_each, importing existing repos safely.
More Terraform prompts & error guides
Browse every Terraform prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.