[Jun 07, 2026] Get New Terraform-Associate-003 Practice Test Questions Answers [Q94-Q116]

Share

[Jun 07, 2026] Get New Terraform-Associate-003 Practice Test Questions Answers

Terraform-Associate-003 Dumps and Exam Test Engine


HashiCorp Terraform-Associate-003 Exam Syllabus Topics:

TopicDetails
Topic 1
  • Create, maintain, and use Terraform modules: In this section of the exam, candidates are tested for creating a module, using a module in configuration, and topics such as refactoring an existing configuration into modules.
Topic 2
  • Configure and use Terraform providers: In this section, topics covered include understanding Terraform's plugin-based architecture and configuring providers. It also covers aliasing, sourcing, and versioning functions.
Topic 3
  • Collaborate on infrastructure as code using HCP Terraform: In this section, the topics covered include analyzing the HCP Terraform run workflow, the role of HCP Terraform workspaces and their configuration options, and the management of provider credentials in HCP Terraform.

 

NEW QUESTION # 94
Why does this backend configuration not follow best practices?

  • A. You should not store credentials in Terraform configuration
  • B. An alias meta-argument should be included in backend blocks whenever possible
  • C. The backend configuration should contain multiple credentials so that more than one user can execute terraform plan and terraform apply
  • D. You should use the local enhanced storage backend whenever possible

Answer: A

Explanation:
This is a bad practice, as it exposes your credentials to anyone who can access your configuration files or state files. You should use environment variables, credential files, or other mechanisms to provide credentials to Terraform.


NEW QUESTION # 95
What is the name of the default file where Terraform stores the state?
Type your answer in the field provided. The text field is not case-sensitive and all variations of the correct answer are accepted.

Answer:

Explanation:
Terraformtfstate
Explanation:
The name of the default file where Terraform stores the state is terraform.tfstate. This file contains a JSON representation of the current state of the infrastructure managed by Terraform. Terraform uses this file to track the metadata and attributes of the resources, and to plan and apply changes. By default, Terraform stores the state file locally in the same directory as the configuration files, but it can also be configured to store the state remotely in a backend. Reference = [Terraform State], [State File Format]


NEW QUESTION # 96
You decide to move a Terraform state file to Amazon S3 from another location. You write the code below into a file called backend.tf.

Which command will migrate your current state file to the new S3 remote backend?

  • A. terraform state
  • B. terraform init
  • C. terraform refresh
  • D. terraform push

Answer: B

Explanation:
This command will initialize the new backend and prompt you to migrate the existing state file to the new location3. The other commands are not relevant for this task.


NEW QUESTION # 97
You have multiple team members collaborating on infrastructure as code (IaC) using Terraform, and want to apply formatting standards for readability.
How can you format Terraform HCL (HashiCorp Configuration Language) code according to standard Terraform style convention?

  • A. Write a shell script to transform Terraform files using tools such as AWK, Python, and sed
  • B. Manually apply two spaces indentation and align equal sign "=" characters in every Terraform file (*.tf)
  • C. Run the terraform fmt command during the code linting phase of your CI/CD process Most Voted
  • D. Designate one person in each team to review and format everyone's code

Answer: C

Explanation:
The terraform fmt command is used to rewrite Terraform configuration files to a canonical format and style.
This command applies a subset of the Terraform language style conventions, along with other minor adjustments for readability. Running this command on your configuration files before committing them to source control can help ensure consistency of style between different Terraform codebases, and can also make diffs easier to read. You can also use the -check and -diff options to check if the files are formatted and display the formatting changes respectively2. Running the terraform fmt command during the code linting phase of your CI/CD process can help automate this process and enforce the formatting standards for your team. References = [Command: fmt]2


NEW QUESTION # 98
How would you output returned values from a child module in the Terraform CLI output?

  • A. Declare the output in the root configuration
  • B. Declare the output in the child module
  • C. None of the above
  • D. Declare the output in both the root and child module

Answer: D

Explanation:
To output returned values from a child module in the Terraform CLI output, you need to declare the output in both the child module and the root module. The child module output will return the value to the root module, and the root module output will display the value in the CLI. References = [Terraform Outputs]


NEW QUESTION # 99
Which of these ate secure options for storing secrets for connecting to a Terraform remote backend? Choose two correct answers.

  • A. Defined in a connection configuration outside of Terraform
  • B. A variable file
  • C. Defined in Environment variables
  • D. Inside the backend block within the Terraform configuration

Answer: A,C

Explanation:
Environment variables and connection configurations outside of Terraform are secure options for storing secrets for connecting to a Terraform remote backend. Environment variables can be used to set values for input variables that contain secrets, such as backend access keys or tokens. Terraform will read environment variables that start with TF_VAR_ and match the name of an input variable. For example, if you have an input variable called backend_token, you can set its value with the environment variable TF_VAR_backend_token1. Connection configurations outside of Terraform are files or scripts that provide credentials or other information for Terraform to connect to a remote backend. For example, you can use a credentials file for the S3 backend2, or a shell script for the HTTP backend3. These files or scripts are not part of the Terraform configuration and can be stored securely in a separate location. The other options are not secure for storing secrets. A variable file is a file that contains values for input variables. Variable files are usually stored in the same directory as the Terraform configuration or in a version control system. This exposes the secrets to anyone who can access the files or the repository. You should not store secrets in variable files1. Inside the backend block within the Terraform configuration is where you specify the type and settings of the remote backend. The backend block is part of the Terraform configuration and is usually stored in a version control system. This exposes the secrets to anyone who can access the configuration or the repository. You should not store secrets in the backend block4.
References = [Terraform Input Variables]1, [Backend Type: s3]2, [Backend Type: http]3, [Backend Configuration]4


NEW QUESTION # 100
If you update the version constraint in your Terraform configuration, Terraform will update your lock file the next time you run terraform Init.

  • A. False
  • B. True

Answer: B

Explanation:
Explanation
If you update the version constraint in your Terraform configuration, Terraform will update your lock file the next time you run terraform init3. This will ensure that you use the same provider versions across different machines and runs.


NEW QUESTION # 101
You are working on some new application features and you want to spin up a copy of your production deployment to perform some quick tests. In order to avoid having to configure a new state backend, what open source Terraform feature would allow you create multiple states but still be associated with your current code?

  • A. Terraform data sources
  • B. Terraform workspaces
  • C. Terraform modules
  • D. Terraform local values
  • E. None of the above

Answer: B

Explanation:
Terraform workspaces allow you to create multiple states but still be associated with your current code. Workspaces are like "environments" (e.g. staging, production) for the same configuration. You can use workspaces to spin up a copy of your production deployment for testing purposes without having to configure a new state backend. Terraform data sources, local values, and modules are not features that allow you to create multiple states. Reference = Workspaces and How to Use Terraform Workspaces


NEW QUESTION # 102
Which Terraform collection type should you use to store key/value pairs?

  • A. Tuple
  • B. Set
  • C. Map
  • D. list

Answer: C

Explanation:
The Terraform collection type that should be used to store key/value pairs is map. A map is a collection of values that are accessed by arbitrary labels, called keys. The keys and values can be of any type, but the keys must be unique within a map. For example, var = { key1 = "value1", key2 = "value2" } is a map with two key/value pairs. Maps are useful for grouping related values together, such as configuration options or metadata. References = [Collection Types], [Map Type Constraints]


NEW QUESTION # 103
One remote backend configuration always maps to a single remote workspace.

  • A. False
  • B. True

Answer: B

Explanation:
The remote backend can work with either a single remote Terraform Cloud workspace, or with multiple similarly-named remote workspaces (like networking-dev and networking-prod). The workspaces block of the backend configuration determines which mode it uses. To use a single remote Terraform Cloud workspace, set workspaces.name to the remote workspace's full name (like networking-prod). To use multiple remote workspaces, set workspaces.prefix to a prefix used in all of the desired remote workspace names. For example, set prefix = "networking-" to use Terraform cloud workspaces with names like networking-dev and networking-prod. This is helpful when mapping multiple Terraform CLI workspaces used in a single Terraform configuration to multiple Terraform Cloud workspaces3. However, one remote backend configuration always maps to a single remote workspace, either by name or by prefix. You cannot use both name and prefix in the same backend configuration, or omit both. Doing so will result in a configuration error3.
References = [Backend Type: remote]3


NEW QUESTION # 104
Select the command that doesn't cause Terraform to refresh its state.

  • A. Terraform plan
  • B. Terraform apply
  • C. Terraform state list
  • D. Terraform destroy

Answer: C


NEW QUESTION # 105
Which of these actions will prevent two Terraform runs from changing the same state file at the same time?

  • A. Refresh the state after running Terraform
  • B. Run Terraform with parallelism set to 1
  • C. Delete the state before running Terraform
  • D. Configure state locking for your state backend

Answer: D

Explanation:
To prevent two Terraform runs from changing the same state file simultaneously, state locking is used. State locking ensures that when one Terraform operation is running, others will be blocked from making changes to the same state, thus preventing conflicts and data corruption. This is achieved by configuring the state backend to support locking, which will lock the state for all operations that could write to the state.References= This information is supported by Terraform's official documentation, which explains the importance of state locking and how it can be configured for different backends to prevent concurrent state modifications .


NEW QUESTION # 106
Which of these are benefits of using Sentinel with HCP Terraform/Terraform Cloud? (Pick the 3 correct responses)

  • A. You can check out and check in cloud access keys.
  • B. Sentinel Policies can be written in HashiCorp Configuration Language (HCL).
  • C. Policy-as-code can enforce security best practices.
  • D. You can enforce a list of approved AWS AMIs.

Answer: A,C,D

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.
References:
* Sentinel Policies


NEW QUESTION # 107
Where does the Terraform local backend store its state?

  • A. In the terraform file
  • B. In the /tmp directory
  • C. In the terraform,tfstate file
  • D. In the user's terraform,state file

Answer: C

Explanation:
Explanation
This is where the Terraform local backend stores its state, by default, unless you specify a different file name or location in your configuration. The local backend is the simplest backend type that stores the state file on your local disk.


NEW QUESTION # 108
Which are forbidden actions when the terraform state file is locked? Choose three correct answers.

  • A. Terraform for
  • B. Terraform apply
  • C. Terraform validate
  • D. Terraform validate
  • E. Terraform destroy
  • F. Terraform state list

Answer: B,C,E

Explanation:
The terraform state file is locked when a Terraform operation that could write state is in progress. This prevents concurrent state operations that could corrupt the state. The forbidden actions when the state file is locked are those that could write state, such as terraform apply, terraform destroy, terraform refresh, terraform taint, terraform untaint, terraform import, and terraform state *. The terraform validate command is also forbidden, because it requires an initialized working directory with the state file. The allowed actions when the state file is locked are those that only read state, such as terraform plan, terraform show, terraform output, and terraform console. References = [State Locking] and [Command: validate]


NEW QUESTION # 109
How is terraform import run?

  • A. As a part of terraform refresh
  • B. As a part of terraform init
  • C. All of the above
  • D. By an explicit call
  • E. As a part of terraform plan

Answer: D

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. Reference = [Importing Infrastructure]


NEW QUESTION # 110
What does Terraform not reference when running a terraform apply -refresh-only ?

  • A. Terraform resource definitions in configuration files
  • B. Cloud provider
  • C. State file
  • D. Credentials

Answer: A

Explanation:
Explanation
When running a terraform apply -refresh-only, Terraform does not reference the configuration files, but only the state file, credentials, and cloud provider. The purpose of this command is to update the state file with the current status of the real resources, without making any changes to them1.


NEW QUESTION # 111
You are using a networking module in your Terraform configuration with the name label my-network. In your main configuration you have the following code:

When you run terraform validate, you get the following error:

What must you do to successfully retrieve this value from your networking module?

  • A. Define the attribute vnet_id as an output in the networking module
  • B. Define the attribute vmet_id as a variable in the networking modeule
  • C. Change the reference value module.my,network,outputs,vnet_id
  • D. Change the reference value to my-network,outputs,vmet_id

Answer: A

Explanation:
This is what you must do to successfully retrieve this value from your networking module, as it will expose the attribute as an output value that can be referenced by other modules or resources. The error message indicates that the networking module does not have an output value named vnet_id, which causes the reference to fail.


NEW QUESTION # 112
You have a list of numbers that represents the number of free CPU cores on each virtual cluster:

What Terraform function could you use to select the largest number from the list?

  • A. hight[numcpus]
  • B. ceil (numcpus)
  • C. top(numcpus)
  • D. max(numcpus)

Answer: D

Explanation:
In Terraform, the max function can be used to select the largest number from a list of numbers. The max function takes multiple arguments and returns the highest one. For the list numcpus = [18, 3, 7, 11, 2], using max(numcpus...) will return 18, which is the largest number in the list.
Reference:
Terraform documentation on max function: Terraform Functions - max


NEW QUESTION # 113
Which configuration consistency errors does terraform validate report?

  • A. A mix of spaces and tabs in configuration files
  • B. Terraform module isn't the latest version
  • C. Declaring a resource identifier more than once
  • D. Differences between local and remote state

Answer: C

Explanation:
Terraform validate reports configuration consistency errors, such as declaring a resource identifier more than once. This means that the same resource type and name combination isused for multiple resource blocks, which is not allowed in Terraform. For example, resource "aws_instance" "example" {...} cannot be used more than once in the same configuration. Terraform validate does not report errors related to module versions, state differences, or formatting issues, as these are not relevant for checking the configuration syntax and structure. References = [Validate Configuration], [Resource Syntax]


NEW QUESTION # 114
In Terraform HCL, an object type of object({name=string, age-number}) would match this value.

  • A. Option B
  • B. Option D
  • C. Option C
  • D. Option A

Answer: A

Explanation:
From the official Terraform Type Constraints Documentation:
The object({ name = string, age = number }) type expects:
name to be aquoted string, e.g. "John"
age to be anumber, e.g. 52
Option Bsatisfies both:
{
name = "John" ##Valid string
age = 52 ##Valid number
}
Let's analyze the incorrect ones:
#Option A: "fifty two" is not a valid number.
#Option C: John is unquoted (invalid string), and "fifty two" is not a number.
#Option D: name = John is not quoted, making it an invalid string in HCL.
Terraform is strict about type and formatting. Stringsmust be quoted, and numbersmust be numeric literals.


NEW QUESTION # 115
Outside of the required_providers block, Terraform configurations always refer to providers by their local names.

  • A. True
  • B. False

Answer: B

Explanation:
Outside of the required_providers block, Terraform configurations can refer to providers by either their local names or their source addresses. The local name is a short name that can be used throughout the configuration, while the source address is a global identifier for the provider in the format registry.terraform.io/namespace/type. For example, you can use either aws or registry.terraform.io/hashicorp/aws to refer to the AWS provider.


NEW QUESTION # 116
......

2026 New ActualVCE Terraform-Associate-003 PDF Recently Updated Questions: https://buildazure.actualvce.com/HashiCorp/Terraform-Associate-003-valid-vce-dumps.html