Course overview
Lesson 2 of 8 · 3 promptsAI for DevOps Engineers
LESSON 02 OF 8

Infrastructure as Code

3 prompts for DevOps Engineers

Prompts for DevOps Engineers: copy one, fill it in, paste it into your AI.

Track progress as a member

In this lesson

  1. 01Generate Terraform Module SkeletonUse this when you need a clean starting module for a common cloud resource.
  2. 02Review Terraform Plan For RisksUse this when you want a plain-English risk summary of planned infrastructure changes.
  3. 03Convert Manual Setup Steps to AnsibleUse this when you have a documented setup process and want an idempotent playbook draft.
1Copy the promptClick Copy on the prompt you need.
2Paste it into your AIChatGPT, Claude, Gemini or Copilot.
3Fill in the {{brackets}}Your own details, or let the AI ask you.
4Follow up and checkUse the follow-ups, then check the facts.
01

Generate Terraform Module Skeleton

Use this when you need a clean starting module for a common cloud resource.

Prompt

Role You are a DevOps engineer who writes reusable Terraform modules. You optimise for a small, reviewable skeleton that follows Terraform conventions and can be extended safely by the team.

Context you provide

  • {{cloud_provider}} — aws, azure, google or similar
  • {{resource_type}} — the resource the module wraps
  • {{module_name}} — short name for the module
  • {{required_inputs}} — variables the caller must set
  • {{optional_inputs}} — variables that can take defaults
  • {{outputs_needed}} — values the module should expose
  • {{terraform_version}} — minimum version to support
  • {{provider_version_constraint}} — version pin for the provider
  • {{naming_convention}} — how resources should be named
  • {{tagging_requirements}} — required tags or labels

Instructions

  1. Ask for any missing inputs, then confirm the module scope before writing files.
  2. Produce the file layout: main.tf, variables.tf, outputs.tf, versions.tf, README.md and examples/ with a minimal usage.
  3. In main.tf, define the resource using variable references only. No hardcoded names, regions or account IDs.
  4. In variables.tf, give every variable a type and description, add defaults only where safe, and mark sensitive ones.
  5. In outputs.tf, expose only the requested values, each with a description.
  6. In versions.tf, set required_version plus provider source and version constraint.
  7. Write a README with a usage snippet and input and output tables.
  8. List your assumptions and anything the user should verify against the provider documentation.

Output format One markdown code block per file, each under a filename heading. Short inline comments only. Outside the blocks, add a brief assumptions list. Plain technical tone. Leave out marketing language and long explanations of what Terraform is.

Guardrails Do not invent resource arguments, attribute names or provider version numbers. If unsure, say so and point to the provider documentation. Never include credentials, account IDs or real region names. Flag any change that could destroy or replace existing infrastructure and tell the user to run terraform plan in a sandbox first.

Example cloud_provider: aws, resource_type: aws_s3_bucket, module_name: s3_bucket, required_inputs: bucket_name, outputs_needed: bucket_arn and bucket_id.

Open as its own page

02

Review Terraform Plan For Risks

Use this when you want a plain-English risk summary of planned infrastructure changes.

Prompt

Role — You are a DevOps reviewer who turns Terraform plan output into a plain-English risk summary for engineers and change approvers. Optimise for catching destructive or surprising changes before apply.

Context you provide

  • {{terraform_plan_output}} — pasted terraform plan text or saved plan summary
  • {{environment}} — dev, staging or production
  • {{change_intent}} — what the team thinks this change does
  • {{blast_radius_notes}} — services, data stores or teams affected
  • {{rollback_options}} — known rollback path, or "none known"

Instructions

  1. Ask for any missing inputs, then review the plan.
  2. Group changes by action: create, update in place, replace, destroy.
  3. Flag anything that destroys or replaces stateful resources, or touches networking, IAM or encryption.
  4. For each flagged item, state what changes, the effect on running services, and whether downtime or data loss is plausible.
  5. Compare the plan with {{change_intent}} and list anything it does that the intent does not mention.
  6. Rank risks high, medium or low with a one-line reason, then give a short pre-apply checklist.

Output format Markdown. Open with a two-sentence verdict, then a table of changes by action, a ranked risk list, and the checklist. Under 600 words. Plain English, gloss any Terraform term you use. Leave out praise, filler and restating the whole plan.

Guardrails

  • Do not invent resource names, counts or provider behaviour; if the plan looks truncated, say so and ask for the rest.
  • Label every inference as an assumption, because plan output does not show live runtime state.
  • Tell the user to confirm provider-specific behaviour in the provider documentation and to get sign-off from the environment owner before apply.

Example {{terraform_plan_output}}: "2 to add, 1 to change, 1 to destroy; aws_db_instance.main must be replaced"; {{environment}}: production; {{change_intent}}: add a read replica and resize the primary.

Open as its own page

03

Convert Manual Setup Steps to Ansible

Use this when you have a documented setup process and want an idempotent playbook draft.

Prompt

Role You are a DevOps engineer who converts documented manual setup steps into an idempotent Ansible playbook. You optimise for a draft that is safe to run repeatedly and easy to review.

Context you provide

  • {{manual_steps}}: the documented setup process, step by step.
  • {{target_hosts}}: inventory hostnames or groups.
  • {{os_family}}: e.g. Debian, RHEL, or Windows.
  • {{required_packages}}: list of packages to install.
  • {{service_names}}: services to enable and start.
  • {{config_files}}: paths and source templates.
  • {{variables}}: values that change per environment.
  • {{secrets_handling}}: how secrets are supplied (e.g. vault, env).

Instructions

  1. Ask for any missing inputs, then parse the manual steps into discrete tasks.
  2. Identify which tasks are idempotent and which need conditionals or handlers.
  3. Map each task to the appropriate Ansible module, avoiding raw shell commands unless no module exists.
  4. Structure the playbook with a name, hosts, become, vars_files, tasks, and handlers.
  5. Add comments explaining any non-obvious idempotency logic.
  6. List all assumptions and any steps that require manual verification.
  7. Provide a check mode command to dry-run the playbook.

Output format Return a single YAML playbook draft in a code block. Include a variables section, tasks, and handlers. Add a short assumptions list after the code. Use technical, concise language. Leave out Ansible basics, credentials, and any step you cannot make idempotent without a custom module.

Guardrails

  • Do not invent package names, service names, file paths, or module parameters; use only what the user provides.
  • Flag any step that cannot be made idempotent and suggest a safe alternative.
  • Tell the user to test in a staging environment and check the target OS documentation before production.

Example Manual steps: install nginx, copy nginx.conf, start service. Target hosts: web01, web02. OS: Ubuntu 22.04.

Open as its own page

Skills for these tasks

Give your AI these skills and it does these tasks the expert way. Connect your AI once and it picks them up by itself.