Terraform Workflow

Terraform Workflow

There are 3 basic stages to the TF workflow:

  1. Write - Author infrastructure as code.
  2. Plan - Preview changes before applying.
  3. Apply - Provision reproducible infrastructure.

terraform workflow

Write

-Write your terraform code ( HCL-Hashicorp Configuration Language) using your favorite text editor.

  • You can save those in a version control system like git

Plan

  • The terraform plan command creates an execution plan, which lets you preview the changes that Terraform plans to make to your infrastructure. - By default, when Terraform creates a plan it:

    • Reads the current state of any already-existing remote objects to make sure that the Terraform state is up-to-date.
    • Compares the current configuration to the prior state and noting any differences.
    • Proposes a set of change actions that should, if applied, make the remote objects match the configuration.

Apply

Create all of those resources that were planned in the plan phase.