What does the terraform plan command do?



This content originally appeared on DEV Community and was authored by Said Olano

The terraform plan command is used to preview the changes that Terraform will make to your infrastructure before actually applying them. It’s a review tool that lets you see what actions Terraform will perform, without making any real changes.

What exactly does terraform plan do?
Reads the .tf configuration files.

Compares the current state (stored in the terraform.tfstate file or in a remote backend) with the desired configuration.

Displays a detailed plan of the actions Terraform would take to reach the desired state.

Actions you might see:

  • (create): Terraform will create a new resource.

  • (destroy): Terraform will delete an existing resource.

~ (update in-place): Terraform will update an existing resource.

What is it used for?
To verify that the changes you’re about to make are correct.

To avoid mistakes before applying changes to production.

To allow team members to review changes before execution.

Image description


This content originally appeared on DEV Community and was authored by Said Olano