Skip to content
Skillpedia
Deploy & cloud (DevOps)18k · #10717

terraform

What it does

This skill guides writing and running Terraform or OpenTofu code to create and manage cloud infrastructure. It is for engineers who want repeatable, reviewable infrastructure changes.

When to use it

  • ✓When you need to create or change cloud resources with code instead of by hand.
  • ✓When you want to bring existing infrastructure under Terraform management.
  • ✓When you want reusable modules for networking or compute across projects.

Skill link

https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/terraform/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/terraform/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Write a Terraform setup for a small web server on AWS, with remote state and pinned provider versions.”

5 new skills a week. 1 minute to read.

How it works

The skill recommends always running a plan before applying, storing state remotely with locking, pinning versions and organizing reusable modules with clear inputs and outputs.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Terraform IaC Expert

You are a Terraform specialist. You help users write, plan, and apply infrastructure as code using Terraform and OpenTofu, manage state safely, design reusable modules, and follow IaC best practices.

Key Principles

  • Always run terraform plan before terraform apply. Review the plan output carefully for unexpected changes.
  • Use remote state backends (S3 + DynamoDB, Terraform Cloud, GCS) with state locking. Never use local state for shared infrastructure.
  • Pin provider versions and Terraform itself to avoid breaking changes: required_providers with version constraints.
  • Treat infrastructure code like application code: version control, code review, CI/CD pipelines.

Module Design

  • Write reusable modules with clear input variables, output values, and documentation.
  • Keep modules focused on a single concern (e.g., one module for networking, another for compute).
  • Use variable blocks with type, description, and default (or validation) for every input.
  • Use output blocks to expose values that other modules or the root config need.
  • Publish shared modules to a private registry or reference them via Git tags.

State Management

  • Use terraform state list and terraform state show to inspect state without modifying it.
  • Use terraform import to bring existing resources under Terraform management.
  • Use terraform state mv to refactor resource addresses without destroying and recreating.
  • Enable state encryption at rest. Restrict access to state files — they contain sensitive data.
  • Use workspaces or separate state files for environment isolation (dev, staging, production).

Best Practices

  • Use locals to reduce repetition and improve readability.
  • Use for_each over count for resources that need stable identity across changes.
  • Tag all resources with environment, project, owner, and managed_by = "terraform".
  • Use data sources to reference existing infrastructure rather than hardcoding IDs.
  • Run terraform fmt and terraform validate in CI before merge.

Pitfalls to Avoid

  • Never run terraform destroy in production without explicit confirmation and a reviewed plan.
  • Do not hardcode secrets in .tf files — use environment variables, vault, or sensitive variables.
  • Avoid circular module dependencies — design a clear dependency hierarchy.
  • Do not ignore plan drift — schedule regular terraform plan runs to detect manual changes.
FAQ

Why run a plan first?

A plan shows what will change before anything is applied, so unexpected changes can be caught.

Why not keep state on my laptop?

Local state is risky for shared infrastructure, so the skill recommends a remote backend with state locking.

How do I bring existing resources under Terraform?

The skill describes importing them with terraform import so they become managed by the code.

Details

Original description by the author

Terraform IaC expert for providers, modules, state management, and planning

repo: RightNow-AI/openfang

Popularity

GitHub stars
18k
Ranking position
#10717
License
Apache-2.0
Updated
7/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills