terraform-state-managerlisted
Install: claude install-skill Backura/fastagent-plugins
# Terraform State Manager
This skill provides safe workflows for Terraform state operations and troubleshooting.
## When to Use
Use this skill when:
- Importing existing infrastructure into Terraform
- Moving resources to different addresses (renaming)
- Removing resources from state without destroying them
- Migrating state between backends (local to S3, etc.)
- Recovering from state corruption or conflicts
- Splitting or merging state files
## Critical Safety Rules
**ALWAYS follow these rules when working with state:**
1. **Backup first**: Create state backup before any operation
2. **Plan after**: Run `terraform plan` after state changes to verify
3. **One at a time**: Make incremental changes, not bulk operations
4. **Test in non-prod**: Practice state operations in dev/test first
5. **Version control**: Commit code changes with state operations
## Common Operations
### 1. Import Existing Resources
**Workflow:**
```bash
# Step 1: Write the resource configuration in .tf file
# Step 2: Import the resource
terraform import <resource_address> <resource_id>
# Step 3: Verify with plan (should show no changes)
terraform plan
```
**Example - Import AWS S3 Bucket:**
```hcl
# 1. Add to main.tf
resource "aws_s3_bucket" "existing" {
bucket = "my-existing-bucket"
}
# 2. Import
terraform import aws_s3_bucket.existing my-existing-bucket
# 3. Verify
terraform plan # Should show: No changes
```
**Tips:**
- Find resource ID format in provider docs
- Import one resource a