HashiCorp terraform associate practice test

HashiCorp Certified: Terraform Associate Exam

Last exam update: Mar 07 ,2025
Page 1 out of 26. Viewing questions 1-15 out of 382

Question 1

What advantage does an operations team that uses infrastructure as code have?

  • A. The ability to delete infrastructure
  • B. The ability to reuse best practice configurations and settings
  • C. The ability to autoscale a group of servers
  • D. The ability to update existing infrastructure
Mark Question:
Answer:

B


Explanation:

User Votes:
A
50%
B 5 votes
50%
C 1 votes
50%
D 1 votes
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000
nassimaelferkhsi
3 months, 3 weeks ago

B. The ability to reuse best practice configurations and settings


Question 2

As a developer, you want to ensure your plugins are up to date with the latest versions. Which
Terraform command should you use?

  • A. terreform providers- upgrade
  • B. terreform apply -upgrade
  • C. terreform refresh -upgrade
  • D. terreformn lnit -upgrade
Mark Question:
Answer:

D


User Votes:
A
50%
B
50%
C 1 votes
50%
D 3 votes
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000
nassimaelferkhsi
3 months, 3 weeks ago


Question 3

Choose the answer that correctly completes the sentence: _______backends support state locking.

  • A. All
  • B. No
  • C. Only local
  • D. Some
Mark Question:
Answer:

D


User Votes:
A
50%
B
50%
C
50%
D 1 votes
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000
Aamir_Ahmed
3 weeks, 3 days ago

Remote backends supports state locking.


Question 4

Which of the following does terraform apply change after you approve the execution plan? Choose
two correct answers.

  • A. The execution plan
  • B. Terraform code
  • C. Cloud infrastructure
  • D. State file
  • E. The .terraform directory
Mark Question:
Answer:

C, D


User Votes:
A
50%
B
50%
C 1 votes
50%
D 1 votes
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 5

Module version is required to reference a module on the Terraform Module Registry.

  • A. True
  • B. False
Mark Question:
Answer:

B


User Votes:
A
50%
B 2 votes
50%
Discussions
vote your answer:
A
B
0 / 1000
nassimaelferkhsi
3 months, 3 weeks ago

Aamir_Ahmed
3 weeks, 3 days ago

Specifying a module version is optional when referencing a module from the Terraform Module Registry.

By default, if you do not specify a version, Terraform will download the latest available version of the module.


Question 6

What kind of configuration block will create an infrastructure object with settings specified in the
block?

  • A. state
  • B. provider
  • C. resource
  • D. data
Mark Question:
Answer:

C


User Votes:
A
50%
B
50%
C 1 votes
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 7

You've used Terraform to deploy a virtual machine and a database. You want to replace this virtual
machine instance with an identical one without affecting the database. What is the best way to
achieve this using Terraform?

  • A. Use the Terraform taint command targeting the VMs then run Terraform plan and Terraform apply
  • B. Delete the Terraform VM resources from your Terraform code then run Terraform plan and terraform apply
  • C. Use the terraform apply command targeting the VM resources only
  • D. Use the terraform state rm command to remove the VM from state file
Mark Question:
Answer:

A


User Votes:
A 1 votes
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000
Aamir_Ahmed
3 weeks, 3 days ago

B. Delete the Terraform VM resources from your Terraform code then run terraform plan and terraform apply. ❌

This would remove the VM entirely, rather than replacing it.
C. Use the terraform apply command targeting the VM resources only. ❌

Running terraform apply without marking the resource for recreation will not replace the existing VM.
D. Use the terraform state rm command to remove the VM from the state file. ❌

This removes Terraform’s knowledge of the VM but does not actually recreate it.
Terraform would treat it as unmanaged unless redefined in the code, potentially leading to orphaned resources.


Question 8

You need to specify a dependency manually. What resource meta-parameter can you use lo make
sure Terraform respects thee dependency?
Type your answer in the field provided. The text field is not case-sensitive and all variations of the
correct answer are accepted.

Mark Question:
Answer:

depends_on


User Votes:
Discussions
vote your answer:
0 / 1000

Question 9

terraform validate reports HCL syntax errors.

  • A. True
  • B. False
Mark Question:
Answer:

A


User Votes:
A 1 votes
50%
B
50%
Discussions
vote your answer:
A
B
0 / 1000

Question 10

Which of the following is not a way to trigger terraform destroy ?

  • A. Passing ---destroy at the end of apian request
  • B. Running terraform destroy from the correct directory and then typing "yes" when prompted in the CLI
  • C. Using the destroy command with auto approve
  • D. Delete the state file and run terraform apply
Mark Question:
Answer:

A


User Votes:
A
50%
B
50%
C
50%
D 1 votes
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 11

Using the terraform state rm command against a resource will destroy it.

  • A. True
  • B. False
Mark Question:
Answer:

B


User Votes:
A
50%
B 1 votes
50%
Discussions
vote your answer:
A
B
0 / 1000

Question 12

terraform destroy is the only way to remove infrastructure.
A. True
B. False

Mark Question:
Answer:

B


Discussions
0 / 1000

Question 13

A Terraform output that sets the ''sensitive'' argument to true will not store that value in the state
file.

  • A. True
  • B. False
Mark Question:
Answer:

B


User Votes:
A
50%
B 1 votes
50%
Discussions
vote your answer:
A
B
0 / 1000
Aamir_Ahmed
3 weeks, 3 days ago

Setting the sensitive = true argument for a Terraform output does not prevent the value from being stored in the state file.

Instead, it only affects how the value is displayed. Specifically, it prevents the value from being shown in the Terraform output when you run terraform output. The value will still be stored in the state file, but it will be masked when you run commands that display outputs to the console.


Question 14

Why should secrets not be hard coded into Terraform code? Choose two correct answers

  • A. All passwords should be rotated on a quarterly basis.
  • B. The Terraform code is copied to the target resources to be applied locally and could expose secrets if a target resource is compromised.
  • C. Terraform code is typically stored in version control, as well as copied to the systems from h it's run. Any of those may not have robust security mechanisms.
  • D. It makes the code less reusable.
Mark Question:
Answer:

C, D


User Votes:
A
50%
B
50%
C 1 votes
50%
D 1 votes
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 15

Terraform configuration (including any module references) can contain only one Terraform provider
type.

  • A. True
  • B. False
Mark Question:
Answer:

B


User Votes:
A
50%
B
50%
Discussions
vote your answer:
A
B
0 / 1000
To page 2