Terraform Associate Sample Questions

Terraform Associate Sample Questions & Answers

The write-plan-create workflow ties with state locking and backend authentication, plus variables and secret injection, for the heaviest weighting, built on why IaC matters, provider basics, import and state inspection, module sourcing, and HCP Terraform.

Launch the full Terraform Associate simulator →

Showing 10 of 20 free samples.

  1. Question 1

    You run a local-exec provisioner in a null resource called null_resource.run_script and realize that you need to rerun the script.

    Which of the following commands would you use first?

    Show answer & explanation

    Correct answer: A

    A

  2. Question 2

    When should you use the force-unlock command?

    Show answer & explanation

    Correct answer: C

    Explanation:
    Manually unlock the state for the defined configuration. -- Reference: https://www.terraform.io/docs/cli/commands/force-unlock.html

  3. Question 3

    The terraform.tfstate file always matches your currently built infrastructure.

    Show answer & explanation
  4. Question 4

    Which of the following is not true of Terraform providers?

    Show answer & explanation

    Correct answer: D

    Reference: https://iayendrapatil.eom/terraform-cheat-sheet/#Terraform Read and write configuration

  5. Question 5

    Why would you use the terraform taint command?

    Show answer & explanation

    Correct answer: B

    Explanation:
    The terraform taint command manually marks a Terraform-managed resource as tainted, forcing it to be destroyed and recreated on the next apply. -- Reference: https://www.terraform.io/docs/cli/commands/taint.html

  6. Question 6

    If you manually destroy infrastructure, what is the best practice reflecting this change in Terraform?

    Show answer & explanation

    Correct answer: B

    B

  7. Question 7Select 2

    Which two steps are required to provision new infrastructure in the Terraform workflow? (Choose two.)

    Show answer & explanation
  8. Question 8

    Where does the Terraform local backend store its state?

    Show answer & explanation

    Correct answer: C

    Explanation:
    The local backend stores state on the local filesystem, locks that state using system APIs, and performs operations locally. -- Reference: https://www.terraform.io/docs/language/settings/backends/local.html

  9. Question 9

    Only the user that generated a plan may apply it.

    Show answer & explanation

    Correct answer: A

    Explanation:
    The optional -out argument can be used to save the generated plan to a file for later execution with terraform apply, which can be useful when running Terraform in automation. -- Reference: https://learn.hashicorp.com/tutorials/terraform/automate-terraform

  10. Question 10

    In Terraform 0.13 and above, outside of the required_providers block, Terraform configurations always refer to providers by their local names.

    Show answer & explanation

    Correct answer: A

    Explanation:
    Outside of the required_providers block, Terraform configurations always refer to providers by their local names. -- Reference: https://www.terraform.io/docs/language/providers/requirements.html

Ready for the real thing?

The full Terraform Associate simulator has every exam-style question, timed mode, and instant scoring.