terraform

Installation
SKILL.md

Terraform

Common Gotchas

count vs for_each

# count: Index-based, problematic for changes
resource "aws_instance" "web" {
  count = 3  # Removing item 0 shifts all indexes, recreating 1 and 2
}

# for_each: Key-based, stable references
resource "aws_instance" "web" {
  for_each = toset(["a", "b", "c"])  # Removing "a" only affects "a"
}

Use for_each unless you specifically need numeric indexing.

Dependency Cycles

Related skills
Installs
3
First Seen
Feb 5, 2026