M. Kodirov

STAGE 06 / LESSON 05

Terraform and infrastructure as code

Infrastructure as code describes infrastructure in files that can be reviewed and versioned.

THE IDEA

Understand it.

Terraform compares configuration with its recorded state and provider information to produce a plan. A plan helps a team review intended changes before applying them; it is not a substitute for understanding those changes.

State can contain sensitive values. Store and access it appropriately, coordinate concurrent changes, and review destructive operations carefully. Use a safe non-production account for practice.

SEE IT IN CONTEXT

Review before applying

terraform init
terraform plan
# Review the plan and obtain appropriate approval
# before any apply to real infrastructure.

init prepares the working directory; plan previews proposed changes. Neither line means a production change is automatically approved.

LEARN FROM REAL WEBSITES

See it in the real world.

These simplified structures come from public sources. Company systems change, and the sources may describe only one project or an earlier design.

Shopify

Shopify engineering, 2022

Manage infrastructure as code

Shopify described using Terraform to manage infrastructure across teams.

  1. Infrastructure configuration
  2. Terraform
  3. Managed infrastructure

What to learn: Versioned configuration helps teams review infrastructure changes and reproduce them consistently.

Read the source: Shopify Terraform at scale

Cloudflare

Cloudflare engineering, 2025

Automate configuration

Cloudflare describes using Terraform and automation to manage configuration at enterprise scale.

  1. Configuration as code
  2. Terraform provider
  3. Cloudflare configuration

What to learn: A provider connects declarative configuration to a platform's resources; review a plan before applying changes.

Read the source: Cloudflare infrastructure as code

TRY IT YOURSELF

Practice.

Why should a team review a Terraform plan before applying it?

Show one possible answer

A configuration change may create, replace or destroy resources. The plan makes the proposed effect reviewable before execution.

GO DEEPER

Official references.