From Oracle DBA to Cloud DevOps/DBRE β Day-by-Day Terraform Notes
Author: Naresh Sajwani | Goal: HashiCorp Terraform Associate (003) Certification
Environment: RHEL VM (VirtualBox) + AWS Free Tier
A real-world, mistake-documented Terraform learning diary.
Covers installation, first EC2 deployment, all beginner blunders,
and how to fix them. Built by an Oracle DBA for other newbies.
This is NOT a polished tutorial written by an expert. This is a raw learning diary written by someone who broke things, got confused, fixed them, and wrote it all down.
If you're an Oracle DBA (or any IT professional) trying to learn Terraform from zero, you'll find every mistake I made here β so you don't have to make them yourself.
- RHEL/CentOS VM (or any Linux)
- AWS Free Tier account
- AWS Access Key & Secret Key
aws_vpc . my_vpc . id
β β β
Type Name Attribute
(What?) (Which?) (What detail?)
Oracle Analogy:
resource "aws_vpc" "my_vpc"=INSERT INTO vpc_table (name, cidr) VALUES ('my_vpc', '10.0.0.0/16')aws_vpc.my_vpc.id=SELECT id FROM vpc_table WHERE name = 'my_vpc'
Terraform does the "SELECT" automatically.
resource "aws_subnet" "my_subnet" {
vpc_id = aws_vpc.my_vpc.id # Terraform sees this and creates VPC FIRST
}Terraform is smart. It sees the reference and knows the order.
| File | Purpose |
|---|---|
terraform.tfstate |
Terraform's notebook β remembers everything it created |
terraform.tfstate.backup |
Backup before last change |
terraform.tfstate.1234567890.backup |
Backup before state rm or import |
Golden Rule: Never delete terraform.tfstate. The .backup files are safe to clean up.
| Command | What It Does | When to Use |
|---|---|---|
terraform init |
Download plugins | First time only per project |
terraform fmt |
Auto-format code | Before every commit |
terraform validate |
Check syntax | Before plan |
terraform plan |
Dry run / preview | Before every apply |
terraform apply |
Create/Update resources | When plan looks good |
terraform apply -auto-approve |
Apply without confirmation | Scripts/CI only |
terraform plan -out=file.tfplan |
Save plan to file | For locked/safe applies |
terraform apply file.tfplan |
Apply saved plan | Ignores code changes |
terraform destroy |
Delete everything | When done practicing |
terraform show |
Show current state | To see what Terraform knows |
terraform state list |
List managed resources | Check what's tracked |
terraform state rm <resource> |
Remove from state (not AWS) | When Terraform should forget |
terraform import <resource> <id> |
Bring existing resource under management | For resources created manually |
terraform refresh |
Sync state with AWS reality | After manual console changes |
- HashiCorp Terraform Docs
- Terraform Registry (AWS Modules)
- HashiCorp Learn (Free Tutorials)
- AWS Free Tier Limits
- Terraform Associate Exam Objectives
This is a personal learning repo, but if you spot errors or have suggestions, feel free to open an issue or PR!