The “terraform plan” command is an optional one to execute but it plays a vital role in helping and enabling smooth execution. Here are some of the benefits of using the “terraform plan” command:
- Preview changes: The “plan” command allows you to preview any changes that Terraform will make to your infrastructure before actually applying those changes.
- Avoid mistakes: By reviewing the plan, you can catch any mistakes or misconfigurations before they are applied to your infrastructure.
- Confidence in changes: The “plan” command can give you more confidence when making changes to your infrastructure because you can see what will happen before it happens.
- Collaboration: The “plan” command can be used to share proposed changes with other team members or stakeholders for review and approval.
- Cost estimation: The “plan” command can also estimate the cost of the changes to your infrastructure, which can be useful for budgeting and cost management.
- Version control: The “plan” command is useful when working with version control systems, as it allows you to review changes before committing them to your repository.
- Repeatable process: By using the “plan” command, you can ensure that your infrastructure changes are repeatable and consistent across environments.
What “terraform plan” cannot do? Here are some of the considerations to be taken care of:
- Terraform plan cannot modify the state of infrastructure resources. It can only show you what changes would be made if you were to apply the plan.
- Terraform plan cannot provision new resources. It can only plan changes to existing resources.
- While Terraform can detect variables that do not exist in the configuration, it does not provide error checking for variables that are defined but not used.
- Terraform plan cannot detect changes to remote resources that are not described in the configuration files.
- Terraform plan cannot provide real-time monitoring of infrastructure changes. It can only show you the state of infrastructure as it exists at the time the plan is run.