Infrastructure as Code AI Prompts
146 free, production-ready Infrastructure as Code AI prompts — copy-paste ready for ChatGPT, Claude, or Cursor. Every prompt ships with fill-in placeholders, a worked example, and production-safety notes, so you get a usable answer on the first try.
- Infrastructure as Code Intermediate
Ansible Vault Secrets Management Prompt
Use Ansible Vault — encrypt secrets, vault IDs, multi-vault setups, integration with external secret managers.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Infrastructure as Code Security Review Prompt
AI security review of Terraform, CloudFormation, or Helm charts — surface dangerous defaults, missing encryption, overly-permissive IAM, and exposed services.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
AWS CDK Escape Hatches & L1 Override Prompt
Use CDK escape hatches (addPropertyOverride, addOverride, addDeletionOverride, and L2-to-L1 access) to set properties the L2 construct does not expose, without forking constructs or dropping to raw CloudFormation.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Intermediate
CloudFormation Dynamic References for SSM & Secrets Manager Prompt
Replace hardcoded secrets and config in CloudFormation templates with resolve dynamic references to SSM Parameter Store and Secrets Manager, including versioning, rotation, and no-echo handling.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
CloudFormation Macros & Template Transform Authoring Prompt
Design and safely operate CloudFormation macros (Lambda-backed template transforms) to DRY up templates, inject standards, and expand shorthand — with idempotency, error handling, and change-set safety.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
Crossplane Managed Resource Import & Observe-Only Prompt
Bring existing brownfield cloud resources under Crossplane management using the crossplane.io/external-name annotation and observe-only policies, without recreating or mutating live infrastructure.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
Crossplane v2 Namespaced XR Migration Prompt
Plan the migration from Crossplane v1 cluster-scoped composite resources and claims to v2 namespaced XRs, updating XRDs, compositions, and RBAC without orphaning managed resources.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
IaC Provider & SDK Major Version Upgrade Plan Prompt
Plan a safe major-version upgrade of an IaC provider or SDK (Pulumi provider, CDK v2/aws-cdk-lib, CloudFormation resource types, OpenTofu provider) with breaking-change triage and a no-replace rollout.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
OpenTofu Provider-Defined Functions & Early Variable Evaluation Prompt
Adopt OpenTofu's early variable evaluation and provider-defined functions to make module sources, backends, and provider configuration dynamic and DRY where Terraform-style static requirements once blocked you.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
Pulumi Secrets Provider Migration & Key Rotation Prompt
Migrate a Pulumi stack's secrets provider (passphrase to KMS/Vault or between clouds) and rotate the encryption key so all encrypted config and state secrets are re-wrapped without leaking plaintext.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
Pulumi Transformations & Aliases Refactor Prompt
Refactor Pulumi resource names, parents, and structure at scale using aliases and stack transformations so URNs change on paper but no live resource is destroyed or replaced.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
Crossplane Composition Revision Rollout & Pinning Prompt
Roll out changes to a Crossplane Composition safely across many live claims — using CompositionRevisions, revision pinning, and automatic-vs-manual update policies so a bad composition change cannot ripple into every managed resource at once.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
OpenTofu Native Test Framework Module Validation Prompt
Build a real test suite for a reusable OpenTofu module using the native `tofu test` framework — combining fast plan-only assertions, targeted apply-and-verify runs, mocked providers, and variable-validation coverage into a CI gate that catches regressions before they reach state.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
Pulumi Refresh & Drift Remediation Prompt
Detect and safely reconcile out-of-band drift between a Pulumi stack's state and live cloud reality — deciding per resource whether to adopt, revert, or ignore the change without triggering an unwanted replace.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
AWS CDK Pipelines Self-Mutating CI/CD Prompt
Design a self-mutating AWS CDK Pipelines deployment — a pipeline that updates its own definition, deploys application stages across accounts with approvals, and runs infrastructure tests as gates, without hand-managed CodePipeline wiring.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Intermediate
CloudFormation Change Set Review Prompt
Review a CloudFormation change set before you execute it — classifying every action as add, modify, or replace, flagging the replacements that destroy data, and turning a raw describe-change-set JSON into a go/no-go deployment decision.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
Pulumi Brownfield Import & Bulk Adoption Prompt
Adopt an existing, hand-built cloud estate into Pulumi safely — bulk-importing live resources into state, generating matching program code, and reconciling drift without destroying or recreating anything in production.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
Click-Ops to IaC Conversion Prompt
Reverse-engineer manually-created (click-ops) cloud resources into clean infrastructure-as-code and import them into state without recreating or disrupting live resources, across any IaC tool.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
IaC Code Review Checklist Generator Prompt
Generate a practical, tool-agnostic pull-request review checklist for infrastructure-as-code that covers correctness, security, blast radius, idempotency, and operability — so human reviewers catch what scanners miss.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
IaC Compliance Control Mapping & Evidence Prompt
Map a compliance framework's controls to enforceable infrastructure-as-code guardrails and generate the audit evidence trail — so 'we're compliant' is provable from code and CI, not asserted in a spreadsheet, across any IaC tool.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
IaC Disaster Recovery & Multi-Region Design Prompt
Design infrastructure-as-code so a region or environment can be stood up, failed over, or rebuilt from code — parameterized region/account inputs, replicated state, and a tested rebuild path — across any IaC tool.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Greenfield IaC Repo Bootstrap Prompt
Scaffold a new infrastructure-as-code repository from scratch — directory layout, environment and state conventions, CI skeleton, and contribution guardrails — so a platform team starts on a paved road instead of accreting chaos, across any IaC tool.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
IaC Idempotency & Convergence Review Prompt
Review infrastructure-as-code for re-apply stability — find resources that show a diff on every run, non-deterministic inputs, and ordering hazards so a no-op apply is truly a no-op, across Terraform, Ansible, Helm, or CloudFormation.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Large IaC Codebase Refactor Plan Prompt
Plan a safe, incremental refactor of a large or tangled infrastructure-as-code codebase — decompose monoliths, untangle dependencies, and sequence the work so live infrastructure is never recreated mid-flight, across any IaC tool.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
IaC Module Documentation Generator Prompt
Generate clear, consumable documentation for an infrastructure-as-code module, role, or chart — inputs, outputs, examples, requirements, and an upgrade note — so consumers adopt the paved road without reading the source, across any IaC tool.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Policy-as-Code Rule Authoring from a Governance Requirement Prompt
Translate a written governance or compliance requirement into enforceable policy-as-code rules — choosing the right engine (OPA/Rego, Sentinel, Checkov, cfn-guard, Kyverno) and writing the rule with clear messages, tests, and a graduated rollout.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
IaC State Backend & Topology Strategy Prompt
Design where IaC state lives and how it's split — remote backends, locking, and state/stack boundaries — so blast radius is contained, plans stay fast, and teams can work without stepping on each other, across any stateful IaC tool.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Bicep existing Resources & Scope Targeting Review Prompt
Audit a Bicep deployment's use of the existing keyword and deployment scopes so references resolve to real resources and modules target the correct subscription, resource group, or management group.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
cdk8s Construct Library Design Prompt
Design a reusable cdk8s construct library that turns raw Kubernetes manifests into typed, composable building blocks with sane defaults and validation.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
Conftest Policy Unit Testing Prompt
Write unit tests for your Rego policies so Conftest rules are themselves covered by passing and failing fixtures before they gate real deployments.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
Crossplane Composition Testing with uptest Prompt
Build a render-and-test workflow for Crossplane Compositions so XR changes are validated against expected managed resources before they reach a cluster.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
IaC Ephemeral Preview Environments Prompt
Design per-pull-request ephemeral infrastructure environments that spin up on open, expose a preview, and tear down automatically so they never leak cost or orphaned resources.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
IaC Module Registry & Versioning Strategy Prompt
Design a versioning, publishing, and consumption strategy for a private IaC module registry so consumers pin safely and breaking changes never ship silently.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
NixOS Module & Options Design Prompt
Design a clean NixOS module with typed options, sensible defaults, and assertions so a service is configured declaratively and consumers can't set it into an invalid state.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
Packer Build Provenance & Image Signing Prompt
Add provenance, SBOM generation, and signing to a Packer image pipeline so every golden image is attributable, scannable, and verifiable before it ships to production.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
SaltStack Reactor & Orchestrate Event-Driven Automation Prompt
Design a Salt reactor and orchestrate workflow that responds to events on the bus safely, with loop guards and idempotent orchestration instead of runaway reactions.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
Ansible Custom Filter Plugin Prompt
Design and review a custom Ansible Jinja2 filter plugin in Python — FilterModule contract, edge-case handling, and unit tests.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Ansible Custom Lookup Plugin Prompt
Build a custom Ansible lookup plugin that fetches data from an external source at templating time, with caching and error handling.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible NX-OS and IOS Network Modules Prompt
Write idempotent Ansible playbooks for Cisco NX-OS and IOS devices using resource modules, with safe config replace and rollback.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible Pull Mode GitOps Bootstrap Prompt
Design an ansible-pull workflow where nodes self-converge from a Git repo on a schedule, including bootstrap, locking, and reporting.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Ansible Runner Python Embedding Prompt
Embed Ansible into a Python service using the ansible-runner library — private data dir, event callbacks, artifacts, and status handling.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
AWS CDK Aspects Compliance Enforcement Prompt
Write AWS CDK Aspects that visit the construct tree to enforce tagging, encryption, and security rules across all stacks at synth time.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
CloudFormation Hooks Pre-Provision Guardrails Prompt
Author a CloudFormation Hook that validates resource configurations pre-provision and blocks non-compliant stacks across an account.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Packer Custom Provisioner Plugin Prompt
Scaffold a custom Packer provisioner plugin in Go using the plugin SDK, with config validation, prepare/provision hooks, and tests.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Pulumi Dynamic Providers Custom Resource Prompt
Implement a Pulumi dynamic provider to manage a resource with no native provider, with correct create/update/delete and diff logic.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible Galaxy Requirements Pinning Prompt
Design a requirements.yml for roles and collections that pins versions reproducibly, handles transitive collection dependencies, and supports air-gapped or private Galaxy mirrors.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Beginner
Ansible Host Pattern and Limit Targeting Prompt
Construct precise Ansible host patterns and --limit expressions so a play hits exactly the intended hosts, with safety guards that prevent an empty or over-broad target from running fleet-wide.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible-lint Custom Ruleset and Profile Configuration Prompt
Author an .ansible-lint configuration that selects the right enforcement profile, tunes skip/warn lists, and adds custom rules so CI fails on real problems without drowning teams in noise.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Ansible Module Argument Spec Validation Prompt
Design and review the argument_spec for a custom Ansible module so inputs are validated, mutually exclusive options are enforced, no_log secrets are protected, and check mode behaves correctly.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible module_defaults Group Configuration Prompt
Use module_defaults and action groups to centralize repeated module parameters (cloud auth, connection settings, common flags) so playbooks stay DRY without hiding security-relevant arguments.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Ansible Strategy Plugin and Mitogen Tuning Prompt
Choose and tune the right Ansible execution strategy (linear, free, host_pinned, Mitogen) and forks/pipelining settings to speed up large plays without breaking ordering guarantees.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible Vault Rekey and Rotation Workflow Prompt
Design a safe ansible-vault rekey workflow that rotates the vault password and the underlying secrets across multiple environments without breaking running playbooks or CI.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
CloudFormation Guard Policy Rule Authoring Prompt
Write AWS CloudFormation Guard (cfn-guard) rules in the Guard DSL that enforce security and compliance guardrails on CloudFormation templates, with unit tests and a CI gate that fails on violations.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Terratest Go Infrastructure Test Suite Prompt
Design a Terratest suite in Go that provisions real infrastructure, asserts on outputs and live behavior, and tears everything down cleanly even when assertions fail.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Ansible async & poll Long-Running Task Review Prompt
Review Ansible async/poll usage for long-running tasks so jobs survive SSH timeouts, get polled or fire-and-forget correctly, and clean up async job files.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Ansible Callback Plugin & Output Logging Review Prompt
Design and review Ansible callback plugins and logging configuration for readable output, audit trails, and CI/JSON integration without leaking secrets.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible changed_when & failed_when Tuning Prompt
Review and tune changed_when/failed_when on command, shell, and module tasks so Ansible reports accurate change and failure status and stays idempotent.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible Connection Plugin Selection Review Prompt
Review Ansible connection plugin choices (ssh, winrm, psrp, docker, local, network_cli) and their settings for correct, secure, and performant transport per host group.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Ansible serial Rolling Update Strategy Prompt
Design and review Ansible serial/batch rolling updates with health gating and max_fail_percentage so deployments roll safely across a fleet without taking everything down.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible Tags & Selective Execution Review Prompt
Review and rationalize Ansible tag strategy so --tags/--skip-tags runs hit exactly the intended tasks without skipping setup or dependencies.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
CloudFormation Nested Stacks Refactor Prompt
Refactor a large monolithic CloudFormation template into well-bounded nested stacks with clean parameters, exports, and update safety.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Beginner
IaC Naming & Tagging Convention Audit Prompt
Audit infrastructure-as-code for consistent resource naming and tagging so cost allocation, ownership, environment, and governance tags are complete and standardized.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Beginner
IaC Pre-Commit Hooks & Guardrails Prompt
Design a pre-commit guardrail suite for IaC repos that lints, formats, scans for secrets and misconfigurations, and blocks bad infrastructure code before it lands.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible Blocks, Rescue & Always Error Handling Prompt
Design resilient Ansible plays that group tasks into blocks with rescue and always sections so partial failures roll back cleanly instead of leaving hosts half-configured.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Ansible Delegation & run_once Orchestration Prompt
Coordinate cluster-aware rollouts in Ansible using delegate_to, run_once, and serial so leader-only actions, load-balancer drains, and rolling restarts happen in the right order on the right host.
- Claude
- Copilot
Open prompt - Infrastructure as Code Intermediate
cloud-init Cross-Distro User-Data Design Prompt
Author portable cloud-init user-data that bootstraps instances consistently across Ubuntu, Debian, Rocky, and Amazon Linux despite differing package managers, users, and module support.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Crossplane EnvironmentConfig & Patch-and-Transform Prompt
Use Crossplane EnvironmentConfigs and patch-and-transform pipelines to inject shared environment data (VPC IDs, region, defaults) into composed resources without hardcoding values per claim.
- Claude
- Cursor
Open prompt - Infrastructure as Code Advanced
Crossplane ProviderConfig Multi-Tenancy Prompt
Design Crossplane ProviderConfig and credential-injection patterns so multiple teams or accounts share one control plane without leaking cloud credentials across tenant boundaries.
- Claude
- Gemini
Open prompt - Infrastructure as Code Intermediate
Test Kitchen for Ansible Role Verification Prompt
Stand up a kitchen-ansible test harness that converges a role across multiple platforms and verifies the result with InSpec, catching regressions before they reach inventory.
- Claude
- Cursor
Open prompt - Infrastructure as Code Advanced
Pulumi CrossGuard Policy Pack Authoring Prompt
Build a Pulumi CrossGuard policy pack that enforces guardrails at preview and update time, blocking non-compliant resources with clear remediation messages across every stack.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Pulumi Unit Testing with Resource Mocks Prompt
Write fast, offline unit tests for Pulumi programs using the runtime mocks API so you can assert resource properties and policy without ever hitting a cloud provider.
- Claude
- Copilot
Open prompt - Infrastructure as Code Advanced
Sentinel Policy-as-Code Authoring Prompt
Write and test HashiCorp Sentinel policies that gate infrastructure runs by enforcement level, using imports and mocks to validate plans before they ever apply.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible Network Automation Prompt
Automate network device configuration with Ansible — vendor-neutral facts, config templating, intent-based source of truth, dry-run diffs, and safe rollback — across switches, routers, and firewalls without bricking the fabric.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
CDK for Terraform (CDKTF) Program Design Prompt
Architect a CDK for Terraform codebase in TypeScript or Python — stacks, constructs, provider/module bindings, state, and synth-to-Terraform CI — so you get real programming languages without losing Terraform's plan/apply guarantees.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Beginner
Devbox Reproducible Dev Environments Prompt
Stand up reproducible, isolated developer environments with Devbox (Nix under the hood) — pinned toolchains, per-project shells, init scripts, and CI parity — without forcing the team to learn Nix.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Goss and InSpec Image Compliance Testing Prompt
Write automated server-spec tests with Goss (or InSpec) to validate golden images and provisioned hosts — packages, services, ports, files, users, and CIS controls — and wire them into the image build pipeline as a gate.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Jsonnet and Tanka Kubernetes Config Prompt
Generate and structure Kubernetes manifests with Jsonnet and Grafana Tanka — libraries, abstractions, environments, and diff-gated apply — for teams that have outgrown YAML templating but want stronger composition than Helm or Kustomize.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Kustomize Overlays and Components Prompt
Design a maintainable Kustomize structure — base, environment overlays, reusable components, patches, and generators — that scales across clusters without YAML duplication or template sprawl.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
OpenTofu Migration from Terraform Prompt
Plan and execute a safe migration from Terraform to OpenTofu — version pinning, state compatibility, provider/registry differences, CI swap, and rollback — without touching live infrastructure.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
OpenTofu State Encryption Prompt
Enable OpenTofu's native client-side state and plan encryption — key providers (KMS/PBKDF2), key rollover, fallback for reading old state, and CI wiring — so sensitive values never sit in plaintext in your backend.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Pulumi ESC Environments and Secrets Prompt
Centralize configuration and secrets with Pulumi ESC — composable environments, dynamic cloud credentials via OIDC, and consumption from Pulumi, Terraform, and plain shells — without scattering secrets across stacks.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible Galaxy Collection Publishing & Versioning Prompt
Package, version, and publish an Ansible collection to Galaxy or a private Automation Hub — with semantic versioning, changelogs, dependency pins, and a CI release pipeline that signs and verifies artifacts.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Bicep Module Registry & Private ACR Publishing Prompt
Stand up a private Bicep module registry in Azure Container Registry — publishing versioned, OCI-packaged modules with aliases, restore, and a CI pipeline so teams consume pinned shared infrastructure modules.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Checkov Custom Policy Authoring Prompt
Write and test custom Checkov policies (YAML graph checks and Python checks) to enforce org-specific IaC guardrails across Terraform, CloudFormation, and Kubernetes — with suppressions, severities, and a CI gate that fails on real risk only.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
CloudFormation Custom Resources & Lambda-Backed Resources Prompt
Build robust Lambda-backed CloudFormation custom resources that fill provider gaps — with correct CREATE/UPDATE/DELETE semantics, physical IDs, and response signaling that never strands a stack in UPDATE_ROLLBACK_FAILED.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Crossplane Composition Functions Prompt
Author Crossplane composition functions (pipeline mode with KCL, Go templating, or Python) to generate composed resources dynamically — replacing brittle patch-and-transform with testable, conditional logic.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Helm Chart Hooks & Lifecycle Management Prompt
Design correct, idempotent Helm hooks (pre/post install, upgrade, delete) for migrations, backups, and smoke tests — with weights, deletion policies, and failure handling that won't wedge a release.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Packer HCL2 Multi-Cloud Build Matrix Prompt
Refactor Packer into HCL2 with shared build blocks and a source matrix that bakes equivalent images across AWS, Azure, and GCP in parallel — one provisioning path, many targets, with consistent tagging and manifests.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Pulumi Stack References & Cross-Stack Outputs Prompt
Wire Pulumi stacks together safely with StackReferences and typed outputs — drawing clean boundaries between network, platform, and app layers without circular dependencies or leaked secrets.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
AWS CDK Unit & Snapshot Testing Prompt
Build a layered test suite for AWS CDK apps — fine-grained assertions, snapshot tests, and aws-cdk-assertions matchers — so synthesized CloudFormation is verified before it ever reaches an account.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Bicep Deployment Stacks & What-If Prompt
Adopt Azure Deployment Stacks with Bicep for lifecycle-managed, drift-protected resource groups, and wire what-if previews into CI so every change is reviewed before it lands.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Chef Cookbook to Ansible Migration Prompt
Plan and execute a phased migration off Chef cookbooks to Ansible roles — mapping recipes, attributes, data bags, and search to Ansible equivalents while keeping the fleet converged throughout.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
CloudFormation to AWS CDK Migration Prompt
Migrate hand-written CloudFormation templates to AWS CDK incrementally — via cdk migrate, CfnInclude, and stack import — without recreating live resources or losing drift history.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Helm Values Schema & Validation Prompt
Author a strict values.schema.json and template-time guardrails for a Helm chart so bad overrides fail at lint/install time with clear messages instead of producing broken Kubernetes objects.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
IaC Blast-Radius & Dependency Graph Review Prompt
Analyze an infrastructure plan or change set for blast radius — what gets replaced, what depends on it, and what could cascade — before approving the apply, across any IaC tool.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
OPA Gatekeeper Admission Policy Prompt
Author OPA Gatekeeper ConstraintTemplates and Constraints that enforce cluster policy at admission — with dryrun rollout, audit, and mutation — without breaking existing workloads.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Pulumi Automation API Self-Service Prompt
Build an embedded self-service platform with the Pulumi Automation API — programmatic stack up/destroy, parameterized environments, and guardrails — instead of shelling out to the CLI in CI.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
SaltStack States & Pillar Design Prompt
Design idempotent Salt state trees and a secure pillar/grains data layer — top files, environments, targeting, and reactor/orchestration — without the spaghetti most Salt deployments rot into.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
AWS CDK Construct Design Prompt
Design layered AWS CDK constructs (L2/L3) with sane defaults, escape hatches, and unit + snapshot tests — so app teams consume a paved-road construct instead of hand-rolling CloudFormation.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Azure Bicep Module Authoring Prompt
Design clean, reusable Azure Bicep modules with typed parameters, sane defaults, output contracts, and a registry publishing flow — instead of one sprawling main.bicep per environment.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Crossplane Providers & XRD API Design Prompt
Design Crossplane CompositeResourceDefinitions (XRDs) and provider configs that expose a clean, opinionated self-service platform API to app teams — abstracting cloud resources behind claims.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Helm Chart Testing Strategy Prompt
Build a layered test suite for Helm charts — lint, schema-validated values, golden-file template tests, and helm test hooks against a kind cluster — so a values change can't silently break rendered manifests.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
IaC Cost Estimation CI Gate Prompt
Wire Infracost (or equivalent) into pull-request CI so infrastructure changes show a cost diff and breach a budget gate before merge — turning cloud spend into a reviewable, policy-enforced number.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
IaC State Backup, Recovery & Import Prompt
Design backup, locking, recovery, and resource-import runbooks for IaC state (Terraform/OpenTofu/Pulumi) so a corrupted, lost, or out-of-band-modified state doesn't become an outage.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Ignition & Butane Immutable OS Provisioning Prompt
Provision Flatcar/Fedora CoreOS nodes with Butane configs compiled to Ignition — declarative, first-boot-only host setup for immutable, auto-scaling infrastructure where cloud-init is the wrong fit.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Kyverno Policy Authoring Prompt
Write, test, and roll out Kyverno policies (validate, mutate, generate) for Kubernetes admission control — enforcing org standards on infra manifests without writing Rego.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Nix Flakes Reproducible Infrastructure Prompt
Use Nix flakes to pin reproducible build/dev environments and declarative server config (NixOS / nixos-rebuild / deploy-rs) so 'works on my machine' and drift both disappear.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
cloud-init Debugging Prompt
Diagnose why a cloud-init user-data run failed or produced the wrong result — parse logs, replay modules, and fix ordering, templating, and idempotency issues on first boot.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
CloudFormation StackSets Multi-Account Prompt
Design CloudFormation StackSets to roll out baseline infrastructure and guardrails across many AWS accounts and regions with safe deployment waves and automatic Organizations enrollment.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Crossplane Composition Design Prompt
Design Crossplane XRDs, Compositions, and Composition Functions that expose a clean, opinionated platform API while hiding cloud-provider sprawl from application teams.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
GitOps for Infrastructure Prompt
Design a GitOps workflow that reconciles cloud and platform infrastructure (not just app manifests) from Git using Flux/Argo plus an IaC operator, with safe drift handling and promotion.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Helm Umbrella & Library Charts Prompt
Design Helm umbrella charts and shared library charts that compose subcharts, eliminate boilerplate via named templates, and keep values overrides sane across many services.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Cross-Tool IaC Migration Prompt
Plan and execute a migration between IaC tools (e.g. CloudFormation→Terraform, Terraform→Pulumi, or into Crossplane) by importing existing resources without destroying live infrastructure.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Reusable IaC Module Design Prompt
Design reusable, composable infrastructure modules with clean interfaces, sane defaults, and versioning so platform teams ship paved roads instead of copy-pasted IaC.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
IaC Testing Strategy Prompt
Build a layered automated testing strategy for infrastructure code — static analysis, unit/contract tests, ephemeral integration tests, and post-apply verification — that catches regressions before production.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Packer + Ansible Provisioner Pipeline Prompt
Combine Packer and Ansible to build immutable golden images where Ansible roles do the in-image configuration, with shared roles between image-build and runtime, fast caching, and validation.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Pulumi Typed Component Resources Prompt
Design reusable Pulumi ComponentResources in a real programming language — typed inputs/outputs, secret handling, stack references, and tests — to build a typed platform SDK for your teams.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
cloud-init Bootstrap Configuration Prompt
Write safe, idempotent cloud-init user-data that bootstraps instances on first boot — users, packages, mounts, network, and a config-management handoff — without secrets leaking into metadata.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
CloudFormation Template Review Prompt
Review a CloudFormation (or CDK-synthesized) template for correctness, drift resistance, and safe updates — intrinsic functions, change-set surprises, deletion policies, and the resources that recreate when you least expect it.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Helm Chart Generator & Refactor Prompt
Generate a production-grade Helm chart from scratch or refactor a messy one — sane values schema, templating helpers, sub-charts, hooks, and upgrade safety — without hardcoding environment-specific cruft.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
IaC Drift Detection & Reconciliation Prompt
Build a cross-tool strategy to detect and reconcile drift between declared IaC and live infrastructure — scheduled detection, classification of drift causes, and a safe path back to convergence without nuking out-of-band fixes.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
IaC Secrets Management Strategy Prompt
Design how secrets flow through IaC across tools — keep them out of code and state, inject at deploy/runtime via a secrets manager, and rotate without manual re-deploys.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Multi-Environment IaC Promotion Pipeline Prompt
Design a dev → stage → prod promotion pipeline for infrastructure where the same code ships to every environment, differences live in config, and prod changes are reviewed, gated, and reversible.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Packer Golden Image Pipeline Prompt
Design a Packer build that produces hardened, reproducible golden machine images across clouds — provisioners, versioning, CVE scanning, and a bake-vs-boot decision framework.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Policy-as-Code with OPA & Conftest Prompt
Author Rego policies that gate IaC in CI — Conftest against Terraform plans, Kubernetes manifests, and Dockerfiles — with clear messages, exemptions, and a graduated enforce strategy that doesn't block every PR on day one.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Pulumi Program Design & Review Prompt
Architect or review a Pulumi program in a real programming language — stack/config layout, component resources, secret handling, and the failure modes that come from mixing imperative code with declarative infra.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible Jinja2 Templates Advanced Patterns Prompt
Use advanced Jinja2 in Ansible — filters (default, map, selectattr), lookups, complex conditionals, custom filters.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible Drift Detection with Check Mode Prompt
Detect configuration drift — periodic --check runs, --diff, integration with monitoring, alerts on drift.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible CI/CD Lint & Test Pipeline Prompt
Build Ansible CI/CD pipelines — lint, syntax check, Molecule tests, vault validation, deploy stages.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Ansible Custom Modules Development Prompt
Write custom Ansible modules in Python — module contract, AnsibleModule class, argument spec, idempotency, error handling.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible Dynamic Inventory for Cloud Prompt
Configure dynamic inventory plugins — AWS (aws_ec2), GCP (gcp_compute), Azure (azure_rm), keyed_groups, filters, caching.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
AWX / Ansible Automation Platform Prompt
Configure AWX (Ansible Tower/AAP) — job templates, surveys, workflow templates, credentials, projects, scaling.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible Facts & Caching Prompt
Tune Ansible fact gathering — gather_subset, custom facts, local facts, cache backends (jsonfile, Redis), staleness.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Ansible Performance Tuning Prompt
Speed up Ansible playbooks — forks, pipelining, async, smart gathering, fact caching, mitogen.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Advanced
Ansible External Secrets (HashiCorp Vault) Prompt
Integrate Ansible with HashiCorp Vault — secret lookup at runtime, AppRole auth, KV v2, dynamic secrets, caching.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible SSH Configuration Prompt
Configure SSH for Ansible — keys, jump hosts, control persist, agent forwarding, known_hosts, parallel connections.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible Become / Privilege Escalation Prompt
Configure Ansible privilege escalation — become, become_user, become_method, restrict sudo, password handling.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible Collections Design Prompt
Build and use Ansible Collections — FQCN, requirements.yml, ansible-galaxy collection install, custom collections.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible Role Generator Prompt
Generate a complete, idempotent Ansible role with proper directory structure, defaults, handlers, molecule tests, and OS-family conditionals.
- Claude
- ChatGPT
- Cursor
Open prompt - Infrastructure as Code Advanced
Ansible Molecule Testing Prompt
Test Ansible roles with Molecule — scenarios, drivers (Docker/Podman/Vagrant), verifiers (Ansible/Testinfra), idempotence.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible Roles Structure Best Practices Prompt
Design Ansible roles — defaults vs vars, meta dependencies, role parameters, tags, idempotency.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible Loops & Control Prompt
Use Ansible loops correctly — loop vs with_items, complex loops, retries, loop_var, nested loops, performance.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible Handlers & Notification Prompt
Use Ansible handlers correctly — notify, listen, force handlers, multi-handler chains, when handlers don't fire.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible Idempotency Design Prompt
Make Ansible tasks idempotent — when to use changed_when / failed_when, check mode, validating shell tasks.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible Variable Precedence Prompt
Debug Ansible variable scope — precedence rules, override behavior, hostvars, magic vars, set_fact lifetime.
- Claude
- ChatGPT
Open prompt - Infrastructure as Code Intermediate
Ansible Inventory Design Prompt
Design Ansible inventories — static vs dynamic, group hierarchy, host_vars / group_vars, multi-environment patterns.
- Claude
- ChatGPT
Open prompt
About these Infrastructure as Code AI prompts
This is a free, curated collection of Infrastructure as Code AI prompts for DevOps and platform engineers — prompt templates that turn Claude, ChatGPT, or Cursor into a focused Infrastructure as Code assistant. Instead of re-explaining your setup every time, each prompt has fill-in placeholders, a realistic worked example, and explicit safety and back-out notes, so it's safe to use against production Infrastructure as Code.
Browse all 146 above, or explore the wider Infrastructure as Code prompts and troubleshooting guides, the full DevOps AI prompt library, and run or compare any prompt live in the Prompt Workspace. Hit a production issue instead? Try the free Incident Assistant.