๐Ÿ”— Video: Day 3: S3 Bucket Lab

โฑ๏ธ Prerequisite: Day 1 (IaC Concepts) + Day 2 (Providers & init) โœ…

๐Ÿ“ Repo: github.com/Push/terraform-aws-labs โ†’ /day03/

๐ŸŽฏ Goal: Go from .tf file โ†’ live AWS S3 bucket โ†’ update tags โ†’ destroy โ€” all with Terraform commands.


๐Ÿง  Why Start with S3?


๐Ÿ“„ Step-by-Step: main.tf for S3 Bucket

โœ๏ธ day03/main.tf

terraform {
  required_version = ">= 1.5.0"
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 6.7.0"
    }
  }
}

provider "aws" {
  region = "us-east-1"
}

# ๐Ÿชฃ S3 Bucket Resource
resource "aws_s3_bucket" "first_bucket" {  # โ† Logical name (for Terraform internals)
  bucket = "tech-tutorials-push-2025"        # โ† Must be GLOBALLY unique!
  tags = {
    Name        = "my-bucket"
    Environment = "dev"
  }
}

๐Ÿ” Key Notes:

Field Why It Matters
bucket Must be globally unique across all AWS accounts/regions โ€” use your name + year
tags Optional, but best practice for cost allocation & filtering
first_bucket Internal reference (e.g., aws_s3_bucket.first_bucket.id) โ€” name it meaningfully!

๐Ÿ’ก Pro Tip: Use random provider for unique names in real projects โ€” coming soon!


๐Ÿงช Lab: Full Terraform Lifecycle