terraform validate reports syntax check errors for which of the following?
Show answerHide answer
Correct answer: DNone 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 22Choose 1
What does Terraform use the .terraform.lock.hc1 file for?
Show answerHide answer
Correct answer: BTracking 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 23Choose 1
How is terraform import run?
Show answerHide answer
Correct answer: DBy 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 24Choose 1
How can terraform plan aid in the development process?
Show answerHide answer
Correct answer: BValidates 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 25Choose 1
Which of these commands makes your code more human readable?
Show answerHide answer
Correct answer: DTerraform 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 26Choose 1
Which of the following is not a valid Terraform collection type?
Show answerHide answer
Correct answer: ATree
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 27Choose 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, DYou 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 28Choose 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: Cterraform 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 29Choose 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: CAdd 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 30Choose 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: Cterraform 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.