Terraform

Identify and fix Terraform state management and configuration pitfalls.

1|Updated Feb 26, 2026
One-click install
npx skills add https://github.com/zhanbei1/OpenOcta --skill terraform-zhanbei1
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Terraform
Source: https://github.com/zhanbei1/OpenOcta/tree/main/src/skills/terraform
Command: npx skills add https://github.com/zhanbei1/OpenOcta --skill terraform-zhanbei1

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Terraform configurations are error-prone, risking state corruption, misordered provisioning, and drift between desired and actual infrastructure.

Core Features & Use Cases

  • Remote state management with proper backends to prevent local state corruption.
  • Clear guidance on using count vs for_each and lifecycle rules to avoid unintended recreations.
  • Dependency ordering tips to ensure reproducible applies across teams and environments.

Quick Start

Run a safe Terraform workflow by configuring a remote backend, then run init, plan, and apply in sequence.

Frequently Asked Questions about Terraform

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent Terraform state corruption when working across team environments?

Use remote state management with proper backends to prevent local Terraform state corruption across team environments. Remote backends provide state locking and centralized storage to avoid drift and configuration conflicts.

When should I use count vs for_each in Terraform configuration?

Use Terraform count for simple boolean conditionals or list indexing, and for_each for maps or sets to maintain stable resource identity. Correct usage avoids unintended recreations and preserves state stability.

What is the best way to manage Terraform lifecycle rules to avoid unintended recreations?

Manage Terraform lifecycle rules by explicitly defining create_before_destroy and prevent_destroy attributes. This prevents unintended resource recreations and ensures stable provisioning during infrastructure updates.

How do I ensure reproducible Terraform applies with correct dependency ordering?

Ensure reproducible Terraform applies by explicitly defining dependency ordering through resource references or depends_on. This prevents misordered provisioning and resolves drift between desired and actual infrastructure.

Why does my Terraform plan show unexpected resource replacements?

Unexpected Terraform replacements often occur due to incorrect count vs for_each usage or missing lifecycle attributes. Fixing state management and configuration pitfalls stabilizes infrastructure and prevents unintended recreations.