104 β€” Terraform Workflow Basics

Beginner

Master the complete Terraform workflow including making changes, destroying resources, and understanding the plan output.

Learning Objectives

1
Modify existing resources and see the diff
2
Understand plan output symbols
3
Destroy resources safely
4
Work with terraform show and state commands
Step 1

Set up a baseline configuration

Create a simple configuration that we'll modify throughout this lesson.

Commands to Run

mkdir -p ~/terraform-practice/lesson-104
cd ~/terraform-practice/lesson-104
cat > main.tf << 'EOF'
terraform {
  required_providers {
    local = {
      source  = "hashicorp/local"
      version = "~> 2.4"
    }
  }
}

resource "local_file" "example" {
  filename = "${path.module}/example.txt"
  content  = "Version 1: Original content"
}

resource "local_file" "backup" {
  filename = "${path.module}/backup.txt"
  content  = "Backup file content"
}
EOF

What This Does

We're creating two simple files that we can modify and destroy to see how Terraform handles changes.

Expected Outcome

A main.tf file with two local_file resources.

Pro Tips

  • 1
    Starting simple makes it easier to understand Terraform's behavior
Was this step helpful?

All Steps (0 / 8 completed)