HashiCorp Certified: Terraform Associate (003) — Question 13

You use a Cloud provider account that is shared with other team members. You previously used Terraform to create a load balancer that listens 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 run terraform apply upon returning to your desk?

Answer options

Correct answer: A

Explanation

The correct answer is A because Terraform detects that the load balancer's current state matches the desired state in the configuration after the manual change, thus it will not apply any modifications. Option B is incorrect because Terraform successfully updates the state file to reflect the manual change. Option C is wrong as Terraform will not revert to port 80 since it recognizes the port is already set to 443. Option D is incorrect as Terraform will not recreate the load balancer if the desired state matches the existing state.