Explain the basic Terraform workflow.

Beginner

Answer

The Terraform workflow consists of four main steps:

  1. Write: Create configuration files (.tf) defining your infrastructure
  2. Initialize: Run terraform init to download providers and modules
  3. Plan: Run terraform plan to preview changes before applying
  4. Apply: Run terraform apply to create/modify/destroy infrastructure
terraform init
terraform plan
terraform apply
terraform destroy  # when cleanup is needed