Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 167


You have modified your local Terraform configuration and ran terraform plan to review the changes. Simultaneously, your teammate manually modified the infrastructure component you are working on. Since you already ran terraform plan locally, the execution plan for terraform apply will be the same.

Show Answer
Correct Answer: B

The execution plan created by terraform plan reflects the state of the infrastructure at the time the plan was generated. If the infrastructure is modified manually by a teammate after you ran terraform plan, the actual state will differ from the state recorded in the plan. When terraform apply is executed, it will create a new execution plan based on the current state of the infrastructure, which may result in a different plan compared to the one initially reviewed. Therefore, it is not accurate to assume that the execution plan will remain the same.

Discussion

10 comments
Sign in to comment
depal_dhirOption: B
Sep 7, 2022

Your plan has been changed. So its best to run the plan again to make sure the desired state is achieved.

BereOption: B
Jan 23, 2024

The execution plan created by terraform plan is based on the state at the time terraform plan was run. If the actual infrastructure has been manually modified by your teammate after you ran terraform plan, then the infrastructure will have diverged from what Terraform believes it to be. When you subsequently run terraform apply, Terraform will create a new execution plan based on the current state of the infrastructure, not on the plan you previously viewed. This means the execution plan during apply could be different if the infrastructure has been changed outside of Terraform after the initial plan command was executed. It's always a good practice to run terraform plan again just before terraform apply, especially in environments where manual changes to the infrastructure might occur.

keiffo2Option: B
Sep 6, 2022

you have run a plan - you colleague has changed the infrastructure, your plan will be wrong now - so false

Bobby1977
Oct 8, 2022

There is no Clarity in the question. If the change applied is same by both the guys then the answer is TRUE else FALSE.

NunyabiznesOption: B
Apr 1, 2023

To ensure that the execution plan you reviewed with terraform plan is the exact one used by terraform apply, you can save the plan to a file and pass that file to terraform apply. For example: terraform plan -out=my_plan.tfplan terraform apply my_plan.tfplan

RugarooOption: B
Dec 12, 2022

Question is unclear however, if you read it carefully it mentions the 'execution plan' which is the plan terraform runs first during an 'apply' before making the actual changes (verified in my lab). If the infrastructure has changed between the first 'plan' and the 'apply' the 'apply' plan will detect the changes made which are not stored in state file and thus there would be a difference. (Answer is B)

secdaddyOption: B
Dec 7, 2022

Terraform plan gives a plan Colleague changes infra manually We run apply and the execution plan may change based on what still needs to be done to bring the infrastructure in line with the terraform configuration. I'll guess false

senthil5000Option: B
Dec 27, 2022

Running terraform plan is optional. Even if we run terraform apply directly without running terraform plan before, it will check for infrastructure before applying.

chael88Option: B
Jan 27, 2023

When you run Apply, it will check if the infrastructure has changed. In this case, the other person made that change.

090200fOption: B
Jul 22, 2024

before apply its better to run terraform plan