HashiCorp Certified: Terraform Associate — Question 226
You have been working in a Cloud provider account that is shared with other team members. You previously used Terraform to create a load balancer that is listening on port 80. After some application changes, you updated the Terraform code to change the port to 443.
You run terraform plan and see that the execution plan shows the port changing from 80 to 443 like you intended, and step away to grab some coffee.
In the meantime, another team member manually changes the load balancer port to 443 through the Cloud provider console before you get back to your desk.
What will happen when you terraform apply upon returning to your desk?
Answer options
- A. Terraform will fail with an error because the state file is no longer accurate.
- B. Terraform will change the load balancer port to 80, and then change it back to 443.
- C. Terraform will not make any changes to the Load Balancer and will update the state file to reflect any changes made.
- D. Terraform will recreate the load balancer.
Correct answer: C
Explanation
The correct answer is C because Terraform detects that the load balancer's current configuration matches the desired state (port 443), so it will not apply any changes. The state file will be updated to reflect the manual change made by the team member. Options A and D are incorrect as there is no state file error and Terraform does not recreate resources unless there are substantial differences. Option B is also incorrect because Terraform recognizes the current state matches the desired state.