Terraform Module Deprecation Path Prompt
Plan a non-breaking migration when a published Terraform module's interface or behavior must change, so existing consumers can upgrade gradually.
- Target user
- Maintainers of shared internal or public Terraform modules
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a module maintainer who has shepherded breaking module changes across many downstream teams without a flag day. I will provide: - The current module interface (variables, outputs) and the change I need to make - Why the change is needed (renamed input, changed default, removed feature, restructured resources) - How consumers pin the module (registry version, git tag, path) - Constraints (how many teams, how fast they can move, blast radius tolerance) Your job: 1. **Classify the change** — decide whether it is a patch, minor, or major under SemVer, and whether it changes the interface (inputs/outputs) or the underlying resources (state moves/replacements). State the version bump. 2. **Interface-compat shims** — for renamed or restructured inputs, keep the old variables accepting values for one minor version, map them into the new shape via locals, and surface a deprecation message so consumers see the warning while still working. 3. **Default changes** — for a changed default value, explain the risk that existing consumers silently get new behavior; recommend making the new default opt-in for a version, then flipping it in the next major with a clear changelog. 4. **Resource restructures** — when resources are renamed or recomposed, supply `moved` blocks so existing consumers' state follows the new addresses without destroy/create. Call out cases where `moved` cannot help and an `import`/migration guide is required. 5. **Output stability** — preserve old output names alongside new ones for a deprecation window, since downstream tools may parse them. 6. **Communicate** — draft the CHANGELOG entry, an UPGRADING guide with copy-pasteable steps, and an in-code deprecation note (a `check` block or a clearly named null marker variable) so the warning is impossible to miss. 7. **Adoption tracking** — propose how to detect who is still on the old interface (registry download stats, a required `module_contract_version` input, or grep across known repos) before removing the shim. 8. **Removal release** — define the major version that removes the shims, with a hard error guiding stragglers to the upgrade guide. Output as: (a) the version classification, (b) the compat shim code, (c) `moved` blocks where applicable, (d) the CHANGELOG + UPGRADING text. Prefer two-step deprecate-then-remove over a single breaking release.
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 for_each Set vs Map Keys Prompt
Decide whether a `for_each` should iterate a set of strings or a map of objects so instance keys stay stable, readable, and free of churn when the collection changes.
-
Terraform Aliased Provider Passing to Nested Modules Prompt
Wire aliased providers (multi-region, multi-account) down through nested module trees using explicit `configuration_aliases` and `providers = {}` maps instead of implicit inheritance.
-
Terraform Cross-State Resource Migration Prompt
Plan and execute moving resources between two separate Terraform state files — splitting a monolith state or consolidating stacks — using `terraform state mv -state-out` (or `removed`+`import`) safely, with locking, backups, and a verified zero-diff outcome.
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.