Pre-Summer Sale Special - Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: xmaspas7

Easiest Solution 2 Pass Your Certification Exams

Terraform-Associate-004 HashiCorp Certified: Terraform Associate (004) (HCTA0-004) Free Practice Exam Questions (2026 Updated)

Prepare effectively for your HashiCorp Terraform-Associate-004 HashiCorp Certified: Terraform Associate (004) (HCTA0-004) certification with our extensive collection of free, high-quality practice questions. Each question is designed to mirror the actual exam format and objectives, complete with comprehensive answers and detailed explanations. Our materials are regularly updated for 2026, ensuring you have the most current resources to build confidence and succeed on your first attempt.

Page: 4 / 6
Total 359 questions

You corrected a typo in a resource name, changing it from aws_s3_bucket.photoes to aws_s3_bucket.photos. You want to update the Terraform state so that the existing resource is recognized under the new name, without destroying and recreating it. Which configuration should you use?

A.

Remove the old resource from your configuration and re-import it.

B.

Run terraform apply -refresh-only.

C.

Do nothing — Terraform will automatically update the state.

D.

Add a moved block to your configuration.

Exhibit:

module " web_stack " {

source = " ./modules/web_stack "

}

Your configuration defines the module block shown in the exhibit. The web_stack module accepts an input variable named servers. Which of the following changes to the module block sets the servers variable to the value of 3?

A.

module " web_stack " {source = " ./modules/web_stack " var.servers = 3}

B.

module " web_stack " {source = " ./modules/web_stack " inputs = { servers = 3 }}

C.

module " web_stack " {source = " ./modules/web_stack " servers = 3}

D.

module " web_stack " {source = " ./modules/web_stack " inputs.servers = 3}

You modified your Terraform configuration and run Terraform plan to review the changes. Simultaneously, your teammate manually modified the infrastructure component you are working on. Since you already ran terraform plan locally, the execution plan for terraform apply will be the same.

A.

True

B.

False

A resource block is shown in the Exhibit space of this page. What is the Terraform resource name of that resource block?

A.

azurerm

B.

azurerm_resource_group

C.

ev

D.

test

Where in your Terraform configuration do you specify remote state storage settings?

A.

The resource block

B.

The provider block

C.

The data block

D.

The terraform block

You manage two workspaces in your HCP Terraform organization. The first workspace manages your network configuration. The second workspace manages your compute resources and retrieves values from the networking workspace.

What HCP Terraform feature lets you run an apply operation on the compute workspace every time you update the networking workspace?

A.

Run triggers

B.

Policy

C.

Run tasks

D.

Projects

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.

Declare the output in both the root and child module

D.

None of the above

_______backends support state locking.

A.

All

B.

No

C.

Some

D.

Only local

Which of the following statements about Terraform modules is not true?

A.

Modules can call other modules

B.

A module is a container for one or more resources

C.

Modules must be publicly accessible

D.

You can call the same module multiple times

Which option cannot be used to keep secrets out of Terraform configuration files?

A.

A Terraform provider

B.

Environment variables

C.

A -var flag

D.

secure string

Which statement describes a goal of Infrastructure as Code (IaC)?

A.

A pipeline process to test and deliver software.

B.

Write once, run anywhere.

C.

The programmatic configuration of resources.

D.

Defining a vendor-agnostic API.

What does terraform destroy do?

A.

Destroys all infrastructure in the Terraform state file.

B.

Destroys all Terraform code files in the current directory, leaving the state file intact.

C.

Destroys all infrastructure in the configured Terraform provider.

D.

Destroys the Terraform state file, leaving the infrastructure intact.

You cannot install third party plugins using terraform init.

A.

True

B.

False

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

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Terraform variables and outputs that set the description argument will store that description in the state file.

A.

True

B.

False

You’ve updated your Terraform configuration, and you need to preview the proposed changes to your infrastructure. Which command should you run?

A.

terraform show

B.

terraform plan

C.

terraform validate

D.

terraform get

Where can Terraform not load a provider from?

A.

Plugins directory

B.

Provider plugin chance

C.

Official HashCrop Distribution on releases.hashcrop.com

D.

Source code

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 push

D.

terraform refresh

Which syntax check returns an error when you run terraform validate?

A.

The state file does not match the current infrastructure.

B.

The code contains tabs for indentation instead of spaces.

C.

There is a missing variable block.

D.

None of these will return an error.

The exhibit below shows part of a Terraform configuration you have been asked to update. The name of the Azure Virtual Network should be set to the name of the resource group followed by a dash and the word vnet.

Exhibit:

data " azurerm_resource_group " " example " {

name = var.resource_group_name

}

resource " azurerm_virtual_network " " example " {

name = ______________________

}

Which expression fulfills this requirement?

A.

" ${data.azurerm_resource_group.example.name}-vnet "

B.

concat(data.azurerm_resource_group.example.name, " - " , " vnet " )

C.

join( " - " , var.resource_group_name, " vnet " )

D.

" ${azurerm_resource_group.example.name}-vnet "

Page: 4 / 6
Total 359 questions
Copyright © 2014-2026 Solution2Pass. All Rights Reserved