| name | terraform |
| description | Infrastructure as Code with Terraform |
| metadata | {"openclaw":{"always":false,"emoji":"🏗️"}} |
Terraform
Infrastructure as Code management.
Basic Workflow
terraform init
terraform plan
terraform plan -out=plan.tfplan
terraform apply
terraform apply plan.tfplan
terraform apply -auto-approve
terraform destroy
terraform destroy -target=aws_instance.web
State
terraform state list
terraform state show <resource>
terraform state mv <old> <new>
terraform state rm <resource>
terraform state pull > state.json
terraform state push state.json
Output & Variables
terraform output
terraform output -json
terraform output <name>
terraform validate
terraform fmt
terraform fmt -recursive
Workspaces
terraform workspace list
terraform workspace new <name>
terraform workspace select <name>
terraform workspace delete <name>
Import
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