# Terraform

> Infrastructure as Code with Terraform Use when this capability is needed.

- Skill: `tomevault-io/terraform-25` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/terraform-25`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/terraform-25/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/terraform-25

---

# Terraform

Infrastructure as Code management.

## Basic Workflow

```bash
# Initialize (download providers)
terraform init

# Plan (preview changes)
terraform plan
terraform plan -out=plan.tfplan   # save plan

# Apply
terraform apply
terraform apply plan.tfplan       # apply saved plan
terraform apply -auto-approve     # no confirmation

# Destroy
terraform destroy
terraform destroy -target=aws_instance.web   # specific resource
```

## State

```bash
# List resources in state
terraform state list

# Resource details
terraform state show <resource>

# Move resource (refactoring)
terraform state mv <old> <new>

# Remove from state (without destroying)
terraform state rm <resource>

# Pull/Push remote state
terraform state pull > state.json
terraform state push state.json
```

## Output & Variables

```bash
# View outputs
terraform output
terraform output -json
terraform output <name>

# Validate configuration
terraform validate

# Format code
terraform fmt
terraform fmt -recursive
```

## Workspaces

```bash
terraform workspace list
terraform workspace new <name>
terraform workspace select <name>
terraform workspace delete <name>
```

## Import

```bash
# Import existing resource into state
terraform import <resource_type>.<name> <id>
```

## Tips

- Always run `terraform plan` before `apply`
- Use `-target` to apply specific resources
- Use `terraform fmt` to keep code standardized
- State is sensitive — never commit to public repos
- Use remote backend (S3, GCS) for team work

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/jholhewres) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-13 -->

