HashiCorp Certified: Terraform Associate (004) Terraform-Associate-004 HCTA0-004 Exam Questions

Page: 1 / 14
Total 385 questions
Question 1

Which parameters does terraform import require? Choose two correct answers.



Answer : B, C

These are the parameters thatterraform importrequires, as they allow Terraform to identify the existing resource that you want to import into your state file, and match it with the corresponding configuration block in your files.


Question 2

Once you configure a new Terraform backend with a terraform code block, which command(s) should you use to migrate the state file?



Answer : A

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


Question 3

How could you reference an attribute from the vsphere_datacenter data source for use with the datacenter_id argument within the vsphere_folder resource in the following configuration?



Answer : A

The correct way to reference an attribute from the vsphere_datacenter data source for use with the datacenter_id argument within the vsphere_folder resource in the following configuration isdata.vsphere_datacenter.dc.id. This follows the syntax for accessing data source attributes, which isdata.TYPE.NAME.ATTRIBUTE. In this case, the data source type isvsphere_datacenter, the data source name isdc, and the attribute we want to access isid. The other options are incorrect becausethey either use the wrong syntax, the wrong punctuation, or the wrong case.Reference= [Data Source: vsphere_datacenter], [Data Source: vsphere_folder], [Expressions: Data Source Reference]


Question 4

How can you trigger a run in a Terraform Cloud workspace that is connected to a Version Control System (VCS) repository?



Answer : B

This will trigger a run in the Terraform Cloud workspace, which will perform a plan and apply operation on the infrastructure defined by the Terraform configuration files in the VCS repository.


Question 5

One remote backend configuration always maps to a single remote workspace.



Answer : A

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.Reference= [Backend Type: remote]3


Question 6

Which of these workflows is only enabled by the use of Infrastructure as Code?



Answer : D

Rationale for Correct Answe r: IaC enables reviewable, version-controlled change proposals (for

example, Terraform plans in pull requests). This makes it possible to systematically review proposed infrastructure changes---including automated security/policy checks---before they are applied. That review-and-approve workflow is a direct outcome of defining infrastructure as code and generating an execution plan.

Analysis of Incorrect Options (Distractors):

A: Auto scaling is enabled by cloud services (e.g., ASGs, autoscalers) and can be configured with or without IaC.

B: RBAC is a capability of cloud/IAM platforms and can be managed without IaC (though IaC can codify it).

C: Cost optimization is a practice/process; IaC can help standardize and enforce cost controls, but it's not ''only enabled'' by IaC.

Key Concept: IaC enables version control, change review, and pre-deployment validation (plan + policy/security review).


Question 7

Where does the Terraform local backend store its state?



Answer : C

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.


Page:    1 / 14   
Total 385 questions