Terraform
Avoid common Terraform mistakes — state corruption, count vs for_each, lifecycle traps, and dependency ordering.
Why use this skill?
Master your infrastructure with the OpenClaw Terraform agent. Avoid state corruption, manage lifecycles, and optimize your HCL configurations.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/ivangdavila/terraformWhat This Skill Does
The Terraform skill for OpenClaw acts as an expert-level architectural advisor for infrastructure-as-code. It focuses on the stability and reliability of your Terraform configurations by identifying structural anti-patterns, diagnosing state-related issues, and providing best-practice configurations for complex environments. It effectively translates cloud architecture needs into robust HCL while warning of common pitfalls like state drift, resource recreation loops, and improper lifecycle management.
Installation
To integrate this skill into your environment, run the following command in your terminal:
clawhub install openclaw/skills/skills/ivangdavila/terraform
Ensure you have the latest version of the OpenClaw agent installed before executing the command.
Use Cases
- State Management Remediation: Troubleshooting corrupted states, moving resources without destroying infrastructure, or migrating local states to remote backends like S3 or Terraform Cloud.
- Refactoring Configuration: Converting resource definitions from
counttofor_eachfor more stable deployment lifecycles. - Zero-Downtime Migration: Implementing lifecycle rules like
create_before_destroyandprevent_destroyto safeguard critical production resources. - Dependency Resolution: Diagnosing circular dependencies or incorrect
depends_onusage during complex multi-module deployments. - Code Validation: Enforcing strict variable typing,
nullableconstraints, and validation blocks to prevent runtime errors duringterraform apply.
Example Prompts
- "I am refactoring a set of AWS EC2 instances that currently use
count. How can I switch tofor_eachwithout forcing the recreation of all my existing instances?" - "My terraform apply keeps failing with a dependency error. How can I use the
depends_onmeta-argument correctly to ensure my IAM role is fully created before my S3 bucket policies are applied?" - "I accidentally deleted my local terraform.tfstate file. Can you guide me through the process of using
terraform importor the newimportblock to recover the state of my existing infrastructure?"
Tips & Limitations
- Lifecycle Awareness: Always remember that
terraform destroyis a permanent operation. Use the-targetflag with extreme caution, as it can lead to state inconsistency. - Workspaces: Avoid using Terraform Workspaces to manage different environments (prod/dev/staging). They are meant for versioning variations; use separate state files or dedicated backend directories for true environment isolation.
- Provisioners: Treat
local-execorremote-execas a last resort. Always prefer cloud-native configuration methods likeuser_dataorcloud-initto ensure idempotent deployments. - State Sensitivity: Keep in mind that Terraform state files often store secrets in plain text. Always ensure your backend supports encryption at rest and strictly limit access to the state bucket.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-ivangdavila-terraform": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: code-execution
Related Skills
Animations
Create performant web animations with proper accessibility and timing.
Arduino
Develop Arduino projects avoiding common wiring, power, and code pitfalls.
Bulgarian
Write Bulgarian that sounds human. Not formal, not robotic, not AI-generated.
Arabic
Write Arabic that sounds human. Not formal, not robotic, not AI-generated.
Assistant
Manage tasks, communications, and scheduling with proactive and organized support.