
Terraform Infra
- 56 installs
- 36 repo stars
- Updated July 14, 2026
- oimiragieo/agent-studio
Helps with ai & agent building tasks.
About
terraform-infra is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted development.
- terraform-infra
- AI & Agent Building
- AI-coding skill
Terraform Infra by the numbers
- 56 all-time installs (skills.sh)
- Ranked #6,750 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/oimiragieo/agent-studio --skill terraform-infraAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 56 |
|---|---|
| repo stars | ★ 36 |
| Last updated | July 14, 2026 |
| Repository | oimiragieo/agent-studio ↗ |
What it does
Helps with ai & agent building tasks.
Files
Terraform Infrastructure Skill
Installation
The skill invokes the Terraform CLI. Install:
- macOS:
brew tap hashicorp/tap && brew install hashicorp/tap/terraform - Windows:
choco install terraformor download from HashiCorp - Linux (apt): Add HashiCorp repo then
sudo apt update && sudo apt install terraform(see HashiCorp install)
Verify: terraform --version
Cheat Sheet & Best Practices
Workflow: terraform init → terraform fmt → terraform validate → terraform plan -out=tfplan → review → terraform apply tfplan. Use terraform show tfplan to inspect.
Hacks: Always run plan before apply; never apply blind. Use remote state (e.g. S3 + lock) for team work. Prefer -auto-approve only in CI with reviewed plans. Use terraform state list and terraform state show <resource> to debug. Use service accounts / workload identity in pipelines; avoid static keys.
Certifications & Training
HashiCorp Terraform Associate (004): IaC concepts, Terraform fundamentals, state, modules, Terraform Cloud. Learning path. Skill data: init → fmt → validate → plan -out → apply; remote state; no blind apply.
Hooks & Workflows
Suggested hooks: Pre-apply: run terraform plan -out=tfplan and gate on review. CI: apply only after plan approval. Use with devops (primary).
Workflows: Use with devops (primary). Flow: init → plan → review → apply; use state commands for debugging. See ci-cd-implementation-rule for pipeline integration.
Overview
Provides 90%+ context savings vs raw Terraform MCP server. Includes critical safety controls for infrastructure operations.
Requirements
- Terraform CLI (v1.0+)
- Cloud provider credentials configured
- Working directory with .tf files
Tools (Progressive Disclosure)
Planning & Validation
| Tool | Description | Confirmation |
|---|---|---|
| plan | Generate terraform plan | No |
| validate | Validate configuration | No |
| fmt | Format terraform files | No |
State Operations
| Tool | Description | Confirmation |
|---|---|---|
| show | Display current state | No |
| list | List state resources | No |
| state-mv | Move resource in state | Yes |
Workspace Operations
| Tool | Description | Confirmation |
|---|---|---|
| workspace-list | List workspaces | No |
| workspace-select | Select workspace | No |
| workspace-new | Create workspace | Yes |
Execution (⚠️ Dangerous)
| Tool | Description | Confirmation |
|---|---|---|
| apply | Apply changes | REQUIRED |
Blocked Operations
| Tool | Status |
|---|---|
| destroy | BLOCKED |
| state-rm | BLOCKED |
Quick Reference
# Initialize
terraform init
# Plan changes
terraform plan -out=tfplan
# Validate
terraform validate
# Apply (requires -auto-approve for automation)
terraform apply tfplanConfiguration
- Working directory: Must contain terraform files
- TFVAR\*: Variable values via environment
- TF_WORKSPACE: Active workspace
Safety Controls
⚠️ terraform apply ALWAYS requires confirmation ⚠️ terraform destroy is BLOCKED by default ⚠️ State modifications require confirmation ⚠️ Review plan output before apply
Agent Integration
- devops (primary): Infrastructure management
- architect (secondary): Infrastructure design
- cloud-integrator (secondary): Cloud provisioning
Troubleshooting
| Issue | Solution |
|---|---|
| Init failed | Check provider credentials |
| State locked | Check for other operations |
| Plan failed | Review error output carefully |
Module Development
Creating Reusable Modules
Structure modules following HashiCorp conventions:
modules/
vpc/
main.tf # Resource definitions
variables.tf # Input variables
outputs.tf # Output values
versions.tf # Required provider versions
README.md # Module documentationModule Best Practices
| Practice | Description |
|---|---|
| Single responsibility | Each module manages one logical resource group |
| Typed variables | Use type constraints on all variables |
| Validation blocks | Add validation {} for input constraints |
| Sensitive outputs | Mark secrets with sensitive = true |
| Version constraints | Pin module source versions |
Module Source Patterns
# Local module
module "vpc" {
source = "./modules/vpc"
}
# Terraform Registry
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "~> 5.0"
}
# Git source (pinned tag)
module "vpc" {
source = "git::https://github.com/org/modules.git//vpc?ref=v1.2.0"
}Provider Development Patterns
Custom Provider Skeleton
package provider
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func Provider() *schema.Provider {
return &schema.Provider{
Schema: map[string]*schema.Schema{
"api_key": {
Type: schema.TypeString,
Required: true,
Sensitive: true,
DefaultFunc: schema.EnvDefaultFunc("API_KEY", nil),
},
},
ResourcesMap: map[string]*schema.Resource{
"myservice_resource": resourceMyServiceResource(),
},
}
}Testing Modules
# Validate module syntax
cd modules/vpc && terraform validate
# Run module tests (Terraform 1.6+)
terraform test
# Plan with module
terraform plan -var-file=examples/basic.tfvarsIron Laws
1. ALWAYS run terraform plan and review the output before executing terraform apply 2. NEVER hardcode credentials or secrets in .tf files — use secret managers (AWS Secrets Manager, Azure Key Vault, HashiCorp Vault) 3. ALWAYS use remote state with encryption and state locking to prevent concurrent modifications 4. NEVER edit state files directly — use terraform state commands exclusively 5. ALWAYS pin provider and module versions for fully reproducible infrastructure deployments
Anti-Patterns
| Anti-Pattern | Why It Fails | Correct Approach |
|---|---|---|
| Hardcoded credentials in .tf files | Secret exposure in VCS, compliance failure | Use variables with secret manager backend |
| No state locking | Concurrent applies corrupt state | Enable backend locking (S3+DynamoDB, Azure Blob, GCS) |
terraform apply without plan review | Unexpected resource deletion or recreation | Always plan first, review diff, then apply |
| Unversioned providers and modules | Non-reproducible builds and breaking changes | Pin versions: version = "~> 4.0" |
| Untagged resources | Untrackable costs and compliance failure | Tag all resources with env, owner, cost-center |
Memory Protocol (MANDATORY)
Before starting: Read .claude/context/memory/learnings.md
After completing:
- New pattern ->
.claude/context/memory/learnings.md - Issue found ->
.claude/context/memory/issues.md - Decision made ->
.claude/context/memory/decisions.md
ASSUME INTERRUPTION: If it's not in memory, it didn't happen.
Invoke the terraform-infra skill and follow it exactly as presented to you
#!/usr/bin/env node
/**
* terraform-infra - Post-Execute Hook
* Runs after the skill executes for cleanup, logging, or follow-up actions.
*/
const fs = require('fs');
const path = require('path');
// Parse hook input
const result = JSON.parse(process.argv[2] || '{}');
console.log('📝 [TERRAFORM-INFRA] Post-execute processing...');
/**
* Process execution result
*/
function processResult(_result) {
// TODO: Add your post-processing logic here
return { success: true };
}
// Run post-processing
const outcome = processResult(result);
if (outcome.success) {
console.log('✅ [TERRAFORM-INFRA] Post-processing complete');
process.exit(0);
} else {
console.error('⚠️ [TERRAFORM-INFRA] Post-processing had issues');
process.exit(0);
}
#!/usr/bin/env node
/**
* terraform-infra - Pre-Execute Hook
* Runs before the skill executes to validate input or prepare context.
*/
const fs = require('fs');
const path = require('path');
// Parse hook input
const input = JSON.parse(process.argv[2] || '{}');
console.log('🔍 [TERRAFORM-INFRA] Pre-execute validation...');
/**
* Validate input before execution
*/
function validateInput(_input) {
const errors = [];
// TODO: Add your validation logic here
return errors;
}
// Run validation
const errors = validateInput(input);
if (errors.length > 0) {
console.error('❌ Validation failed:');
errors.forEach(e => console.error(' - ' + e));
process.exit(1);
}
console.log('✅ [TERRAFORM-INFRA] Validation passed');
process.exit(0);
terraform-infra Research Requirements
Generated: 2026-02-28
Skill Description
Terraform infrastructure operations with safety controls
Research Areas
- Current best practices for terraform-infra
- Industry standards and tooling
- Integration patterns
Source References
- To be populated by skill-updater research phase
terraform-infra Rules
Purpose
Terraform infrastructure operations with safety controls
Best Practices
- Always run plan before apply
- Review plan output carefully
- Never force push to production
Integration Points
See SKILL.md for complete documentation.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "terraform-infra Input Schema",
"description": "Input validation schema for terraform-infra skill",
"type": "object",
"required": [],
"properties": {},
"additionalProperties": true
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "terraform-infra Output Schema",
"description": "Output validation schema for terraform-infra skill",
"type": "object",
"required": ["success"],
"properties": {
"success": {
"type": "boolean",
"description": "Whether the skill executed successfully"
},
"result": {
"type": "object",
"description": "The skill execution result",
"additionalProperties": true
},
"error": {
"type": "string",
"description": "Error message if execution failed"
}
},
"additionalProperties": true
}
#!/usr/bin/env node
/**
* Terraform Infra - Main Script
* Terraform infrastructure operations with safety controls
*
* Usage:
* node main.cjs [options]
*
* Options:
* --help Show this help message
*/
const fs = require('fs');
const path = require('path');
// Find project root
function findProjectRoot() {
let dir = __dirname;
while (dir !== path.parse(dir).root) {
if (fs.existsSync(path.join(dir, '.claude'))) {
return dir;
}
dir = path.dirname(dir);
}
return process.cwd();
}
const PROJECT_ROOT = findProjectRoot();
// Parse command line arguments
const args = process.argv.slice(2);
const options = {};
for (let i = 0; i < args.length; i++) {
if (args[i].startsWith('--')) {
const key = args[i].slice(2);
const value = args[i + 1] && !args[i + 1].startsWith('--') ? args[++i] : true;
options[key] = value;
}
}
/**
* Main execution
*/
function main() {
if (options.help) {
console.log(`
Terraform Infra - Main Script
Usage:
node main.cjs [options]
Options:
--help Show this help message
`);
process.exit(0);
}
const { spawn } = require('child_process');
const child = spawn(
'terraform',
args.filter(a => a !== '--help'),
{
stdio: 'inherit',
cwd: PROJECT_ROOT,
shell: false,
windowsHide: true,
}
);
child.on('close', (code, signal) => {
if (code === 127)
console.error(
'Terraform not found. Install: see this skill\'s SKILL.md, section "Installation".'
);
if (code !== null && code !== undefined) process.exit(code);
if (signal) process.exit(1);
process.exit(0);
});
}
main();
terraform-infra Implementation Template
Goal
- Define target outcome and acceptance criteria.
TDD
1. Red 2. Green 3. Refactor
Verification
- lint
- format
- targeted tests