terraform
Skill43 starsChanged 2 months agoMITView on GitHub
Terraform and OpenTofu configuration, modules, testing, state management, and HCL review. Use when working with Terraform, OpenTofu, HCL, tfvars, tftest, state migration, or IaC patterns.
18 other projects use a version of this.
Adopted by
Most recently taken up by
- iuliandita/skillstheir own version, first seen Sep 24, 2026
- AvilaCarlosDev/openclaw-skillstheir own version, first seen Sep 19, 2026
- Rikinshah787/agent-skills-production-skillstheir own version, first seen Aug 10, 2026
- Jylhis/skillstheir own version, first seen Aug 5, 2026
- yoonation/ai-groundedtheir own version, first seen Jul 22, 2026
- magnus919/agent-skillstheir own version, first seen Jul 21, 2026
Used with
Projects with it also use ansible, kubernetes and 4 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
KubementatSkillansible
Ansible automation reference for playbooks, roles, inventory, variables, and modules. Includes Proxmox VE and Docker integration via community.general and community.docker collections. Use when writing playbooks, troubleshooting Ansible runs, or designing automation workflows. Triggers: ansible, playbook, inventory, role, task, handler, vars, jinja2, galaxy, proxmox_kvm, proxmox_lxc, docker_container, docker_compose.
Also in 3 projects that use this
mjunaidcaSkillkubernetes
Production-grade Kubernetes manifests and debugging for containerized applications. This skill should be used when users ask to deploy to Kubernetes, create K8s manifests, containerize for K8s, set up Deployments/Services/Jobs/StatefulSets/CronJobs, create namespaces with resource quotas, set up multi-team isolation, configure ResourceQuota/ LimitRange, secure with RBAC (ServiceAccount, Role, RoleBinding), configure init containers (model download, db wait, migrations), set up sidecars (logging, metrics), or debug pods (CrashLoopBackOff, logs, exec, describe, events). Auto-detects from Dockerfile/code, generates hardened manifests with educational comments. CKAD-aligned.
Also in 3 projects that use this
thomashartmSkillgithub-actions
Manage GitHub Actions workflows. Use when the user wants to list workflows, view run history, check running workflows, trigger workflow_dispatch, view logs, or cancel runs. Auto-detects repository from git remote. Triggers on phrases like "list workflows", "workflow runs", "trigger workflow", "start deploy", "github actions", "view logs", "cancel run", "running workflows".
Also in 4 projects that use this
VercelSkillreact
React renderer for json-render that turns JSON specs into React components. Use when working with @json-render/react, building React UIs from JSON, creating component catalogs, or rendering AI-generated specs.
Also in 4 projects that use this
OpenAISkillnextjs
Next.js App Router expert guidance. Use when building, debugging, or architecting Next.js applications — routing, Server Components, Server Actions, Cache Components, layouts, middleware/proxy, data fetching, rendering strategies, and deployment on Vercel.
Also in 3 projects that use this
akornmeierSkilldocker
Guide for using Docker - a containerization platform for building, running, and deploying applications in isolated containers. Use when containerizing applications, creating Dockerfiles, working with Docker Compose, managing images/containers, configuring networking and storage, optimizing builds, deploying to production, or implementing CI/CD pipelines with Docker.
Also in 4 projects that use this
Other versions18 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 18
- Mindrally/skills★ 266same name
- magnus919/agent-skills★ 109same name
- georgekhananaev/claude-skills-vault★ 28same name
- nimadorostkar/Claude-Skills-collection★ 28same name
- greedychipmunk/agent-skills★ 19same name
- iuliandita/skills★ 7same name
- DongDuong2001/pudo-code-system★ 5same name
- antoniodiaz02/opencode-devops-skills★ 4same name
- benjaminwestern/google-engineer-skills★ 4same name
- yoonation/ai-grounded★ 4same name
8 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository28 other files it gives its agents.
- agent-native-architectureSkill
- brainstormingSkill
- code-reviewSkill
- cpp-systemsSkill
- c-systemsSkill
- debuggingSkill
- document-reviewSkill
- frontend-designSkill
- git-worktreeSkill
- linux-bash-scriptingSkill
- md-docsSkill
- meta-promptingSkill
- nodejs-backendSkill
- orchestrating-swarmsSkill
- php-laravelSkill
- pinescriptSkill
- planningSkill
- postgresqlSkill
- python-servicesSkill
- react-frontendSkill
- receiving-code-reviewSkill
- reflectSkill
- rust-systemsSkill
- simplifying-codeSkill
- test-auditSkill
- verification-before-completionSkill
- writingSkill
- writing-testsSkill
The file
We split this skill into the rules it gives an agent
9 rules. 0 are common, 3 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 16 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 42
Every variable needs type + description.
- Very specific: line 63
Keep modules small (single responsibility).
- Very specific: line 74
Default to for_each: removing a middle item from a count list recreates all subsequent resources.
- Distinctive: line 98
Never hardcode credentials.
- Very specific: line 100
Use moved blocks with from and to addresses for refactoring resource names/modules without destroy-recreate.
- Very specific: line 109
Import existing: import blocks (1.5+) for declarative import, or terraform import ADDR ID
- Very specific: line 114
Use locals with try() to control deletion ordering without explicit depends_on:
- Distinctive: line 130
Run before declaring done:
- Distinctive: line 140
Read the relevant reference before implementing or reviewing the matching behavior:
“Common” is measured: kept by at least 6 in 10 of the 16 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Terraform & OpenTofu
Working rules
- Preserve state and resource addresses during refactoring; inspect the plan for unintended replacement.
- Separate tests with verified local or mocked effects from tests that access real services or create billable infrastructure. Plan mode can still read real data sources; mocked apply can run without infrastructure creation.
File Organization & Naming
| File | Purpose |
terraform.tf | Terraform + provider version requirements |
providers.tf | Provider configurations |
main.tf | Primary resources and data sources |
variables.tf | Input variables (alphabetical) |
outputs.tf | Output values (alphabetical) |
locals.tf | Local values |
- Lowercase with underscores:
web_api, notwebAPIorweb-api - Descriptive nouns excluding resource type:
aws_instance.web_apinotaws_instance.web_api_instance - Singular, not plural
thisfor singleton resources (one of that type per module)- Contextual variable prefixes:
vpc_cidr_blocknotcidr
Block Ordering
Resources: count/for_each (blank line after) → arguments → nested blocks → tags → depends_on → lifecycle (last)
Variables: description → type → default → validation → nullable
Every variable needs type + description. Every output needs description. Mark secrets sensitive = true.
Module Structure
| Type | Scope | Example |
| Resource Module | Single logical group | VPC + subnets, SG + rules |
| Infrastructure Module | Collection of resource modules | Networking + compute for one region |
| Composition | Complete infrastructure | Spans regions/accounts |
module-name/
├── main.tf, variables.tf, outputs.tf, versions.tf
├── examples/
│ ├── minimal/
│ └── complete/
└── tests/
└── defaults.tftest.hclKeep modules small (single responsibility). examples/ double as documentation and integration test fixtures. Semantic versioning for all published modules.
count vs for_each
| Scenario | Use |
| Boolean toggle (create or skip) | count = condition ? 1 : 0 |
| Named/keyed items that may reorder | for_each = toset(list) or map |
| Fixed identical replicas | count = N |
Default to for_each: removing a middle item from a count list recreates all subsequent resources. Use count only for boolean conditionals or truly identical replicas.
Version Pinning
| Component | Strategy | Example |
| Terraform | Pin minor | required_version = "~> 1.9.0" |
| Providers | Pin major | version = "~> 5.0" |
| Modules (prod) | Pin exact | version = "5.1.2" |
| Modules (dev) | Allow patch | version = "~> 5.1.0" |
Key modern features: moved blocks (1.1+), optional() with defaults (1.3+), native testing (1.6+), mock providers (1.7+), cross-variable validation (1.9+), write-only arguments (1.11+).
Stacks (HCP; check current release status): orchestrates multiple configs as a single deployment unit. Evaluate for multi-environment patterns.
State & Security
- Remote backend with locking: S3 with
use_lockfile = true(1.10+), Azure Blob, GCS, or Terraform Cloud. Never local state for shared infrastructure. DynamoDB-based S3 locking (dynamodb_table) is deprecated and slated for removal; preferuse_lockfile. Both may be set at once while migrating an existing table off. - OpenTofu-only:
terraform { encryption { key_provider "pbkdf2" "k" {...} method "aes_gcm" "m" { keys = key_provider.pbkdf2.k } state { method = method.aes_gcm.m } plan { method = method.aes_gcm.m } } }encrypts state and plan files client-side (or viaTF_ENCRYPTION). Roll out with afallback { method = method.unencrypted.x }so existing plaintext state still loads, and never rename a key provider or method without afallbackblock. OpenTofu also acceptsvar.*/local.*inbackend {}arguments and in modulesource/version(resolved atinit; no state or provider-function references); the same HCL is a hard error in Terraform ("A backend block cannot refer to named values"). - Encrypt state at rest. Never commit
.tfstate,.terraform/, or*.tfplan. Always commit.terraform.lock.hcl. default_tagson provider for consistent resource tagging.- Encryption at rest on all storage. Private networking by default; public access is opt-in.
- Least-privilege security groups. No
0.0.0.0/0ingress without explicit justification. - Never hardcode credentials; use assume_role, OIDC, or secrets managers.
- Pre-commit: auto-format first (
terraform fmt -recursiverewrites files), then verify (terraform validate && tflint && trivy config .) - Use
movedblocks withfromandtoaddresses for refactoring resource names/modules without destroy-recreate. Retain historical moves for downstream upgrades; remove only after every affected state has migrated, or as an explicitly breaking module release. lifecycle { ignore_changes = [attr] }suppresses updates only, and it substitutes the prior state value at plan time, on the first plan after the config change, with no "first apply" exception. Two consequences reviewers get backwards: (1) on an already-provisioned resource the literal in the config is never written, andForceNewnever fires becauseignore_changeserased the diff before replacement is evaluated, so a change that replaces a committed value with a placeholder scrubs the repository and leaves the remote value live; (2)ignore_changesdoes not apply on create, so any later-replace, taint,state rm+ re-add, or manual deletion re-seeds the placeholder over a value that was set out of band. Keep only the container resource in configuration and provision the value entirely out of band, or state the restore step in the runbook for every replace path.
Troubleshooting
- State lock stuck:
terraform force-unlock <ID>, only after confirming no other operation running - Resource drift:
terraform plan -refresh-onlyto detect,terraform apply -refresh-onlyto accept - Replace tainted:
terraform apply -replace=ADDR(not deprecatedterraform taint) - Import existing:
importblocks (1.5+) for declarative import, orterraform import ADDR ID
Dependency Management
Use locals with try() to control deletion ordering without explicit depends_on:
locals {
vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this.id, "")
}This forces Terraform to destroy subnets before CIDR associations, which prevents deletion errors.
cidrsubnet(var.vpc_cidr, 8, count.index)for calculated subnet CIDRs; never hardcode subnets- Multi-region:
provider "aws" { alias = "eu_west_1" }+providers = { aws = aws.eu_west_1 }in module blocks
Verify
Run before declaring done:
terraform fmt -check && terraform validate && tflint && trivy config .All commands must pass with zero errors. Inspect providers, data sources, provisioners, and external commands before selecting test files. Include safe plan tests and fully mocked apply tests in completion checks. Keep real-service or infrastructure tests behind the task's authorization and cost boundary. Pass the root-relative test filename, such as terraform test -filter=tests/vpc_unit_test.tftest.hcl, and verify that the intended file completed at least one run; an exit code alone can accept an unknown filter with no tests selected. Use the checked selection recipe in native-test-patterns.md.
Task-specific references
Read the relevant reference before implementing or reviewing the matching behavior:
- For native plan/apply tests, fixture ordering, or CI test selection: native-test-patterns.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

