HashiCorp certification · Exam Terraform-Associate-003

Terraform-Associate-003 Mock Exam Page 3

HashiCorp Certified: Terraform Associate (003) (HCTA0-003)

Free Terraform-Associate-003 mock exam questions 21–30, each with the answer and an explanation.

20 questions · 33 minutes · free, no sign-up

Free Terraform-Associate-003 questions

21–30 of 58 free
Question 21 Choose 1
terraform validate reports syntax check errors for which of the following?
Show answerHide answer

Correct answer: D None of the above

Explanation

Explanation: The terraform validate command is used to check for syntax errors and internal consistency within Terraform configurations, such as whether all required arguments are specified. It does not check for indentation styles, missing variable values (as variables might not be defined at validation time), or state file consistency with the current infrastructure. Therefore, none of the provided options are correct in the context of what terraform validate reports.References = Terraform's official documentation details the purpose and function of the terraform validate command, specifying that it focuses on syntax and consistency checks within Terraform configurations themselves, not on external factors like the state file or infrastructure state. Direct references from the HashiCorp Terraform Associate (003) study materials to this specific detail were not found in the provided files.
Question 22 Choose 1
What does Terraform use the .terraform.lock.hc1 file for?
Show answerHide answer

Correct answer: B Tracking specific provider dependencies

Explanation

Explanation: The .terraform.lock.hcl file is a new feature in Terraform 0.14 that records the exact versions of each provider used in your configuration. This helps ensure consistent and reproducible behavior across different machines and runs.
Question 23 Choose 1
How is terraform import run?
Show answerHide answer

Correct answer: D By an explicit call

Explanation

Explanation: The terraform import command is not part of any other Terraform workflow. It must be explicitly invoked by the user with the appropriate arguments, such as the resource address and the ID of the existing infrastructure to import. References = [Importing Infrastructure]
Question 24 Choose 1
How can terraform plan aid in the development process?
Show answerHide answer

Correct answer: B Validates your expectations against the execution plan without permanently modifying state

Explanation

Explanation: The terraform plan command is used to create an execution plan. It allows you to see what actions Terraform will take to reach the desired state defined in your configuration files. It evaluates the current state and configuration, showing a detailed outline of the resources that will be created, updated, or destroyed. This is a critical step in the development process as it helps you verify that the changes you are about to apply will perform as expected, without actually modifying any state or infrastructure.
Question 25 Choose 1
Which of these commands makes your code more human readable?
Show answerHide answer

Correct answer: D Terraform fmt

Explanation

Explanation: The command that makes your code more human readable is terraform fmt. This command is used to rewrite Terraform configuration files to a canonical format and style, following the Terraform language style conventions and other minor adjustments for readability. The command is optional, opinionated, and has no customization options, but it is recommended to ensure consistency of style across different Terraform codebases. Consistency can help your team understand the code more quickly and easily, making the use of terraform fmt very important. You can run this command on your configuration files before committing them to source control or as part of your CI/CD pipeline. References = : Command: fmt : Using Terraform fmt Command to Format Your Terraform Code
Question 26 Choose 1
Which of the following is not a valid Terraform collection type?
Show answerHide answer

Correct answer: A Tree

Explanation

Explanation: This is not a valid Terraform collection type, as Terraform only supports three collection types: list, map, and set. A tree is a data structure that consists of nodes with parent-child relationships, which is not supported by Terraform.
Question 27 Choose 3
Which of these are benefits of using Sentinel with HCP Terraform/Terraform Cloud? (Pick the 3 correct responses)
Show answerHide answer

Correct answer: A, C, D You can enforce a list of approved AWS AMIs.You can check out and check in cloud access keys.Policy-as-code can enforce security best practices.

Explanation

Explanation: Sentinel is a policy-as-code framework that integrates with Terraform Cloud to enforce security, compliance, and governance rules. You can enforce rules such as approved AMIs and ensure security best practices. Policies are written in the Sentinel language, not HCL.
Question 28 Choose 1
Which command should you run to check if all code in a Terraform configuration that references multiple modules is properly formatted without making changes?
Show answerHide answer

Correct answer: C terraform fmt -check -recursive

Explanation

Explanation: This command will check if all code in a Terraform configuration that references multiple modules is properly formatted without making changes, and will return a non-zero exit code if any files need formatting. The other commands will either make changes, list the files that need formatting, or not check the modules.
Question 29 Choose 1
A module block is shown in the Exhibit space of this page. When you use a module block to reference a module from the Terraform Registry such as the one in the example, how do you specify version 1.0.0 of the module?
Show answerHide answer

Correct answer: C Add a version = "1.0.0" attribute to the module block.

Explanation

Explanation: Module Versioning: To specify a version in a module block for modules in the Terraform Registry, you add the version attribute, e.g., version = "1.0.0".
Terraform Registry Support: The public registry supports versioning by enabling semantic constraints, allowing users to define specific versions compatible with their infrastructure requirements.
Refer to the module versioning documentation in Terraform’s official registry guide.
Question 30 Choose 1
As a developer, you want to ensure your plugins are up to date with the latest versions. Which Terraform command should you use?
Show answerHide answer

Correct answer: C terraform init -upgrade

Explanation

Explanation: This command will upgrade the plugins to the latest acceptable version within the version constraints specified in the configuration. The other commands do not have an - upgrade option.
Full mock exam

Sit the Terraform-Associate-003 exam before exam day

Full-length mocks with the same number of questions and the same time limit as the real Terraform-Associate-003 exam. Every attempt draws a new set of questions from the full bank, so you can keep going until you pass comfortably.

Get full Terraform-Associate-003 mock exam
  • 65questions per mock
  • 105 mintime limit
  • 194questions in the bank
  • Newmock on every attempt