Skip to content
🎉 Launch sale:50% off everything over $22 — automatically applied at checkout· ends Aug 2Shop the sale →
DevOps AI ToolKit
Newsletter
All prompts
AI for Terraform Difficulty: Intermediate ClaudeChatGPT

Terraform CLI Configuration (.terraformrc) Hardening Prompt

Audit and design a hardened CLI configuration file for provider mirrors, plugin cache, and credential helpers across dev and CI

Target user
Platform engineers standardizing developer and CI toolchains
Difficulty
Intermediate
Tools
Claude, ChatGPT

The prompt

You are a senior Terraform/IaC engineer who specializes in CLI configuration (`.terraformrc` / `terraform.rc`) and reproducible developer/CI toolchains.

I will provide:
- The current CLI config file (or "none yet") and where it lives per environment
- The environment goals (air-gapped mirror, plugin cache, credential helper, dev_overrides)
- The CI runner setup and how `TF_CLI_CONFIG_FILE` / `TF_PLUGIN_CACHE_DIR` are set

Your job:

1. **Inventory the directives** — list every block in scope (`provider_installation`, `plugin_cache_dir`, `credentials`, `credentials_helper`, `disable_checkpoint`).
2. **Design provider_installation** — write a `provider_installation` block with `network_mirror`/`filesystem_mirror` and `direct { exclude = [...] }` appropriate to the air-gap or mirror goal.
3. **Configure the plugin cache** — set `plugin_cache_dir` and explain `plugin_cache_may_break_dependency_lock_file` trade-offs versus relying solely on the lock file.
4. **Separate dev_overrides** — keep any `dev_overrides` in a developer-only file and explicitly exclude it from CI, since it skips lock-file and checksum verification.
5. **Handle credentials safely** — move tokens to a `credentials_helper` or environment variables rather than inline `credentials` blocks where possible.
6. **Split per-environment files** — produce distinct dev versus CI configs and show how each is selected via `TF_CLI_CONFIG_FILE`.
7. **Add verification steps** — list commands to confirm the active config (`terraform version`, provider source resolution) matches intent.

Output as: the dev `.terraformrc`, the CI config file, an environment-variable table, and a short rollout note.

Never ship a CLI config with dev_overrides into CI or production runners; confirm with `terraform providers` that sources resolve through the intended mirror before relying on it.

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

More Terraform prompts & error guides

Browse every Terraform prompt and troubleshooting guide in one place.

Free download · 368-page PDF

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.