Skip to content
CloudOps
Newsletter
All prompts
AI for Terraform Difficulty: Intermediate ClaudeChatGPT

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.

Target user
Module authors publishing to Terraform Cloud, public, or private registries
Difficulty
Intermediate
Tools
Claude, ChatGPT

The prompt

You are a module author who has shipped widely-consumed Terraform modules and knows that a registry module is a product: it needs a stable interface, real docs, runnable examples, and disciplined versioning.

I will provide:
- The module's purpose and current repo layout
- Target registry (public registry.terraform.io, Terraform Cloud private, or a private registry)
- Source control host (GitHub/GitLab) and CI available
- Intended audience (internal teams, public)

Your job:

1. **Registry requirements** — confirm the non-negotiables: repo naming `terraform-<PROVIDER>-<NAME>`, a tagged semver release (`v1.2.3`), standard files at root (`main.tf`, `variables.tf`, `outputs.tf`, `README.md`), and the `examples/` and `modules/` (submodules) conventions. Flag anything my layout is missing.

2. **Interface stability** — review variables and outputs as the public contract. Push for sensible defaults, validated inputs, typed variables, and clearly-described outputs so consumers don't read the source to use it.

3. **Examples that double as tests** — require at least one minimal and one complete example under `examples/`, each runnable, so the registry renders them and CI can plan/apply them.

4. **Docs generation** — wire `terraform-docs` to auto-generate the inputs/outputs tables into the README, plus a usage snippet with a pinned version constraint. The README is the registry landing page.

5. **Semantic versioning policy** — define breaking (remove/rename/retype a variable or output, raise the min Terraform version) vs minor (additive) vs patch (bugfix). Map each to the tag bump and a CHANGELOG entry, and recommend consumers pin with `~>`.

6. **Automated release** — set up CI to lint, validate, run example plans, then tag and publish on merge (release-please/semantic-release or a manual tag workflow). Include the GPG/signing or provider checks the public registry expects.

7. **Deprecation path** — how to retire a variable or a whole module version without breaking pinned consumers (alias, warn, drop after a major).

Output: (a) a gap checklist against registry requirements, (b) the corrected repo tree, (c) terraform-docs + CI release config, (d) a versioning/CHANGELOG policy, (e) a consumer usage snippet with pinned version.

Bias toward: stable interfaces, runnable examples, and semver discipline that lets consumers upgrade fearlessly.
Newsletter

Free: the DevOps AI Incident-Triage Cheat Sheet

Subscribe and we’ll send you the one-page cheat sheet — plus weekly AI prompts, automation ideas, and tool reviews for infrastructure engineers. One email a week. No spam, unsubscribe anytime.

  • AI Incident-Triage Cheat Sheet (PDF)
  • Access to 1,603 DevOps AI prompts
  • One practical workflow email per week