Terraform Tutorials
This page collects workflow notes and practical examples for Terraform.
Typical Project Layout
Basic Workflow
Simple Example
resource "aws_security_group" "web" {
name = "web"
description = "Web access"
ingress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
}
Useful Patterns
- Use
terraform fmtbefore review. - Keep environment-specific values in
*.tfvars. - Split shared logic into modules when repetition appears.
- Use
terraform destroyonly when you intentionally want to remove the managed resources.
Practical Notes
- Prefer predictable resource names.
- Keep your backend configuration and state access documented.
- Review plans before applying in shared environments.