terraform-plan:tldr:2a9a2
The terraform plan
command in the Terraform infrastructure provisioning tool is used to create an execution plan. It analyzes the current infrastructure state, compares it to the desired state described in the Terraform configuration files, and identifies any changes that need to be made to reach the desired state.
When you run terraform plan
, Terraform examines the configuration files in the current directory (by default) and any referenced modules. It then creates a plan detailing the actions it would take to achieve the desired state. This includes creating new resources, updating existing resources, or destroying resources that are no longer required.
The plan output provides a summary of the changes that Terraform will make, such as adding or modifying resources, as well as any changes that require confirmation. It displays the execution order and any dependencies between resources.
Running terraform plan
allows you to preview the changes before actually applying them to your infrastructure. It helps you assess the impact and verify that Terraform actions align with your intentions. For example, it can help identify potential resource conflicts or errors in your configuration.
It is good practice to review the plan carefully before applying it to ensure that it matches your expectations. Running terraform plan
doesn't make any actual changes to your infrastructure, but it helps you understand the impact and scope of the changes Terraform is about to make.