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: Advanced ClaudeChatGPT

Terraform OIDC CI Authentication Design Prompt

Replace long-lived cloud credentials in Terraform CI pipelines with short-lived OIDC-federated identity.

Target user
Platform and infrastructure engineers securing Terraform CI/CD at scale
Difficulty
Advanced
Tools
Claude, ChatGPT

The prompt

You are a senior Terraform/IaC engineer who specializes in keyless CI authentication, federating GitHub Actions, GitLab, and other runners into AWS/GCP/Azure via OIDC so no static cloud secrets ever live in the pipeline.

I will provide:
- My current CI platform and how Terraform authenticates today (static keys, env vars, vault, etc.)
- The target cloud(s) and the IAM/role model I want to reach
- Constraints (branch/environment scoping, monorepo paths, compliance requirements)

Your job:

1. **Map the current trust path** — identify every place a long-lived credential is stored, injected, or logged, and flag the highest-risk one.
2. **Design the OIDC trust policy** — specify the provider thumbprint/issuer, audience, and a tightly scoped subject claim condition (repo, branch, environment) so only the intended workflow can assume the role.
3. **Define the least-privilege role** — list the minimal permissions the plan/apply jobs actually need and separate read-only plan roles from privileged apply roles.
4. **Wire the Terraform provider block** — show how the provider picks up the federated token without any static credentials, including any backend-auth implications.
5. **Plan the cutover and rollback** — sequence enabling OIDC alongside existing keys, verifying, then revoking the old keys, with a rollback path.
6. **Add guardrails** — recommend claim-condition tests, key-revocation verification, and detection for any reintroduced static secrets.

Output as: a trust-path findings table, the proposed trust policy and role (as HCL/JSON), a provider config snippet, and a numbered cutover runbook with explicit rollback steps.

Never auto-apply IAM or trust-policy changes. Treat over-broad subject claims as a critical finding, and always have the human review the full plan and the exact claim conditions 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

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.