DEV Community

Citadel Cloud Management
Citadel Cloud Management

Posted on • Originally published at citadelcloudmanagement.com

Terraform for Beginners: Your First Infrastructure as Code Project

When I first joined Patterson UTI as a cloud architect, the infrastructure team was managing hundreds of EC2 instances through a mix of hand-clicked AWS Console actions and homegrown Bash scripts. Rebuilding the same stack in a disaster recovery scenario took two engineers three days. After we moved to Terraform, that rebuild became a fifteen-minute terraform apply.

That is the promise of Infrastructure as Code -- not a theoretical improvement, but a concrete operational shift that changes how your team recovers, scales, and audits.

What Terraform Is (And What It Is Not)

Terraform is an open-source Infrastructure as Code tool built by HashiCorp. You describe the infrastructure you want in HCL files, and Terraform figures out what to create, modify, or destroy to reach that desired state. It is declarative -- you describe the end state, not the steps to get there.

Your First HCL File: The AWS Provider

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
  }
}

provider "aws" {
  region = "us-east-1"
}
Enter fullscreen mode Exit fullscreen mode

Creating an S3 Bucket

resource "aws_s3_bucket" "my_bucket" {
  bucket = "my-terraform-demo-bucket-2026"
  tags = {
    Environment = "dev"
    ManagedBy   = "terraform"
  }
}
Enter fullscreen mode Exit fullscreen mode

Run these three commands:

terraform init    # Download the AWS provider
terraform plan    # Preview what Terraform will create
terraform apply   # Create the resources
Enter fullscreen mode Exit fullscreen mode

Read the full guide covering modules, workspaces, production patterns, and a complete EC2 + VPC project ->


Originally published at Citadel Cloud Management. 17 free cloud courses available -- no credit card required.

Top comments (0)