iac-skill

Infrastructure as Code with Terraform, Ansible, and CloudFormation.

⭐2stars🔀0forks📁View on GitHub🕐Updated Dec 31, 2025

When & Why to Use This Skill

This Claude skill provides a comprehensive automation framework for Infrastructure as Code (IaC), empowering DevOps engineers to manage cloud environments using industry-leading tools like Terraform, Ansible, and CloudFormation. It streamlines the entire infrastructure lifecycle—from initial provisioning and configuration management to state maintenance and drift detection—ensuring high scalability, consistency, and reduced manual overhead in multi-cloud deployments.

Use Cases

  • Multi-Cloud Provisioning: Automate the deployment of complex cloud resources across AWS, Azure, and GCP using standardized Terraform HCL syntax and modules.
  • Automated Configuration Management: Use Ansible playbooks and roles to orchestrate server setups, manage inventories, and ensure consistent application environments.
  • Infrastructure Lifecycle Operations: Safely execute critical tasks such as 'plan', 'apply', and 'destroy' with built-in validation to prevent deployment errors and resource conflicts.
  • State Management and Drift Detection: Maintain infrastructure integrity by managing state files, handling locks, and importing existing resources to synchronize code with actual cloud environments.
  • Disaster Recovery and Scaling: Rapidly replicate environments or recover from corrupted states using automated recovery procedures and versioned infrastructure templates.
nameiac-skill
descriptionInfrastructure as Code with Terraform, Ansible, and CloudFormation.
sasmp_version"1.3.0"
bonded_agent04-infrastructure-as-code
bond_typePRIMARY_BOND
- nameoperation
typestring
requiredtrue
enum["plan", "apply", "destroy", "validate", "import"]
default"terraform"
strategyexponential_backoff
initial_delay_ms1000
max_retries3
loggingstructured
metricsenabled

Infrastructure as Code Skill

Overview

Master IaC with Terraform, Ansible, and CloudFormation for automated infrastructure.

Parameters

Name Type Required Default Description
tool string No terraform IaC tool
operation string Yes - Operation type

Core Topics

MANDATORY

  • Terraform HCL syntax and providers
  • State management and locking
  • Modules and workspaces
  • Ansible playbooks and roles
  • Inventory management

OPTIONAL

  • CloudFormation templates
  • Pulumi and CDK
  • Testing IaC (terratest)
  • Secret management

ADVANCED

  • Custom providers
  • Complex module design
  • Multi-cloud strategies
  • Drift detection

Quick Reference

# Terraform
terraform init
terraform plan -out=plan.tfplan
terraform apply plan.tfplan
terraform destroy
terraform fmt -recursive
terraform validate
terraform state list
terraform import aws_instance.web i-123

# State Management
terraform state mv old new
terraform state rm resource
terraform force-unlock LOCK_ID

# Ansible
ansible-playbook -i inventory playbook.yml
ansible-playbook playbook.yml --check --diff
ansible-playbook playbook.yml --tags nginx
ansible all -m ping -i inventory
ansible-vault encrypt secrets.yml

Troubleshooting

Common Failures

Symptom Root Cause Solution
State lock Concurrent ops Wait or force-unlock
Resource exists Drift Import or delete
Provider auth Credentials Check AWS_PROFILE
Cycle error Dependencies Restructure

Debug Checklist

  1. Validate: terraform validate
  2. Check state: terraform state list
  3. Debug: TF_LOG=DEBUG terraform plan
  4. Verify credentials

Recovery Procedures

Corrupted State

  1. Restore from S3 versioning
  2. Or import: terraform import for each resource

Resources