Lesson 2 of 4 ยท Introduction to Terraform

Your first Terraform workflow

A normal Terraform workflow is deliberately cautious. You initialise a project, check whether the configuration is valid, preview its changes, and only then apply them. The preview is your chance to catch surprises before your cloud account changes.

Example

terraform init      # Download the provider
terraform validate  # Check configuration structure
terraform plan      # Preview changes
terraform apply     # Confirm and create changes

Step by step

  1. Create an empty folder and add a file called main.tf.
  2. Run terraform init once after adding or changing providers.
  3. Run validate and plan whenever you make a change.
  4. Use apply only after reviewing the plan.

Common mistakes to avoid

  • Running apply without reading the plan.
  • Committing .terraform or sensitive state files to source control.