Terraform Best Practices
Installation
SKILL.md
Terraform Best Practices
This skill provides guidance for writing reliable, secure Terraform configurations in RedC deployment scenarios. The recommendations here come from real-world experience with multi-cloud red team infrastructure — where a misconfigured state file or leaked credential can compromise an entire operation.
State Management
Use remote state because local state files are a single point of failure. If the file gets deleted, corrupted, or conflicts with another operator's changes, you lose track of what's deployed — which in red team scenarios means orphaned infrastructure you're still paying for.
- Store state in cloud-native backends (S3+DynamoDB for AWS, OSS for Alibaba, COS for Tencent)
- Enable state locking to prevent two operators from applying simultaneously
- Keep
.tfstateout of version control — it often contains sensitive outputs like IP addresses and credentials - Separate state per environment (dev/staging/prod) so a bad apply in dev doesn't corrupt prod state