ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified developer tools Safety 4/5

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.

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/ivangdavila/terraform
Or

What 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 count to for_each for more stable deployment lifecycles.
  • Zero-Downtime Migration: Implementing lifecycle rules like create_before_destroy and prevent_destroy to safeguard critical production resources.
  • Dependency Resolution: Diagnosing circular dependencies or incorrect depends_on usage during complex multi-module deployments.
  • Code Validation: Enforcing strict variable typing, nullable constraints, and validation blocks to prevent runtime errors during terraform apply.

Example Prompts

  1. "I am refactoring a set of AWS EC2 instances that currently use count. How can I switch to for_each without forcing the recreation of all my existing instances?"
  2. "My terraform apply keeps failing with a dependency error. How can I use the depends_on meta-argument correctly to ensure my IAM role is fully created before my S3 bucket policies are applied?"
  3. "I accidentally deleted my local terraform.tfstate file. Can you guide me through the process of using terraform import or the new import block to recover the state of my existing infrastructure?"

Tips & Limitations

  • Lifecycle Awareness: Always remember that terraform destroy is a permanent operation. Use the -target flag 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-exec or remote-exec as a last resort. Always prefer cloud-native configuration methods like user_data or cloud-init to 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

Stars2102
Views1
Updated2026-03-06
View Author Profile
AI Skill Finder

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 skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-ivangdavila-terraform": {
      "enabled": true,
      "auto_update": true
    }
  }
}

Tags(AI)

#terraform#devops#cloud-engineering#infrastructure-as-code#iac
Safety Score: 4/5

Flags: code-execution