A is correct answer : Validates your expectations against the execution plan without permanently modifying state
"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."
"The plan command alone will not actually carry out the proposed changes, and so you can use this command to check whether the proposed changes match what you expected before you apply the changes or share your changes with your team for broader review.
If Terraform detects that no changes are needed to resource instances or to root module output values, terraform plan will report that no actions need to be taken."
https://www.terraform.io/cli/commands/plan
D. When you execute a Terraform Plan, a refresh is produced and the state is modified.
Easy example: you have created a Virtual Machine using Terraform and then you manually deleted using for example the AWS console. In the state, it will appear that Virtual Machine exists, but after running Terraform plan, it will detect no longer exists, and it will update the state.
You can try it yourself. It is a very simple test.
PD: the only way to avoid this refresh, is using the flag -refresh=false in terraform plan, but since it does not say anything about it, this is not a option
A. Validates your expectations against the execution plan without permanently modifying state
Terraform's plan command is used to create an execution plan that outlines the steps that Terraform will take to reach your desired infrastructure state. It allows you to preview and validate the changes that will be made to your infrastructure before actually making those changes. This can be helpful in the development process because it allows you to see exactly what will be changed and ensure that it aligns with your expectations before you apply those changes.
It's D.
`terraform plan` reads the current state of any already-existing remote objects to MAKE SURE that the Terraform state is up-to-date.
`-refresh-only` - creates a plan whose goal is ONLY to update the Terraform state and any root module output values to match changes made to remote objects outside of Terraform.
`-refresh=false` - disables the DEFAULT behavior of synchronizing the Terraform state with remote objects before checking for configuration changes.
Reference: https://developer.hashicorp.com/terraform/cli/commands/plan
D. Reconciles Terraform's state against deployed resources and permanently modifies state using the current status of deployed resources
Terraform plan does not, by any means, modify the state file permanently. You could run tf plan a hundred times and it will show you the same differences.
The correct answer, and the only logical answer possible, is A.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Eltooth
Highly Voted 2 years, 4 months agoMolly1994
Most Recent 5 months, 2 weeks agorga91
1 year, 1 month agoNi33
1 year, 6 months agoInformationOverload
1 year, 10 months agochimons
1 year, 11 months agolxgywil
1 year, 11 months agoraf314
1 year, 6 months agoMadMarc
1 year, 8 months agoeduvar4
2 years, 1 month agotf_user
2 years, 2 months agoAhmad_Terraform
2 years, 4 months agoCHRIS12722222
2 years, 5 months agoZam88
2 years, 5 months ago