Day 01 Foundations

HCL Basics and Your First Resource

Install Terraform, understand HCL syntax, configure a provider, and provision your first cloud resource.

~1 hour Hands-on Precision AI Academy

Today's Objective

Learn the core concepts of HCL Basics and Your First Resource and apply them in practical exercises.

01

What Terraform Does

You describe the infrastructure you want in HCL files. Terraform talks to cloud APIs to create, update, or delete resources to match your description. The same config works across AWS, GCP, Azure, and 800+ other providers.

Install
Install
# Download from terraform.io/downloads
# Mac: brew install hashicorp/tap/terraform
terraform --version
main.tf — AWS example
main.tf — AWS example
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
  }
}

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

# Create an S3 bucket
resource "aws_s3_bucket" "my_bucket" {
  bucket = "my-unique-bucket-name-12345"

  tags = {
    Environment = "dev"
    Project     = "terraform-course"
  }
}
Core workflow
Core workflow
terraform init     # download providers
terraform plan     # preview changes
terraform apply    # apply changes (prompts for confirmation)
terraform destroy  # tear everything down
💡
Run terraform plan before every apply. It shows exactly what will be created, modified, or destroyed — like a dry run. Review it carefully. Surprises in plan are much better than surprises in production.

Supporting References & Reading

Go deeper with these external resources.

Terraform Docs
HCL Basics and Your First Resource Official HashiCorp Terraform documentation.
YouTube
HCL Basics and Your First Resource Terraform tutorials on YouTube
MDN
MDN Web Docs Comprehensive web technology reference

Day 1 Checkpoint

Before moving on, confirm understanding of these key concepts:

Continue To Day 2
Day 2 of the Terraform in 5 Days course