Hashicorp Certified Terraform Associate 003 · Free Practice Question Medium

Question 20

You have deployed your production environment with Terraform, and a developer has requested that you update a load balancer configuration to improve its compatibility with their application. Once you have modified your Terraform configuration, how can you conduct a dry run to verify that no unexpected changes will be made?

  • A

    run terraform console and validate the result of any expressions

  • B

    run  terraform plan and inspect the proposed changes

  • C

    run terraform plan -auto-approve to push the changes

  • D

    run  terraform state list to view the existing resources and ensure they won't conflict with the new changes

Reveal correct answer

Correct answer: B

Explanation

The ultimate goal of a terraform plan is to compare the configuration file against the current state and propose any changes needed to apply the desired configuration.

https://developer.hashicorp.com/terraform/cli/commands/plan

A. Running terraform console allows you to interactively explore your Terraform configuration and state, but it does not provide a way to conduct a dry run or preview changes. It is more useful for debugging and exploring the Terraform environment rather than verifying changes before applying them.

B. Running terraform plan allows you to preview the changes that Terraform will make to your infrastructure without actually applying them. This is a dry run that shows you the proposed modifications so you can inspect them and ensure they align with your expectations before making any actual changes.

C. Running terraform plan -auto-approve will automatically apply the changes without giving you the opportunity to review them beforehand. This is not suitable for conducting a dry run to verify that no unexpected changes will be made, as it skips the preview step.

D. Running terraform state list will only show you the existing resources in your Terraform state. It does not provide a way to preview the changes or conduct a dry run to verify the impact of the modifications you are about to make to your infrastructure.

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need