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 / 5
Total 318 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:

data " vsphere_datacenter " " dc " {}

resource " vsphere_folder " " parent " {

path = " Production "

type = " vm "

datacenter_id = _________

}

You want to pass the id of the vsphere_datacenter data source to the datacenter_id argument of the vsphere_folder resource. Which reference would you use?

A.

data.vsphere_datacenter.de.id

B.

vsphere_datacenter.dc.id

C.

data.vsphere_datacenter.dc

D.

data.de.id

In a Terraform Cloud workpace linked to a version control repository speculative plan rum start automatically commit changes to version control.

A.

True

B.

False

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

A.

Terraform state list

B.

Terraform destroy

C.

Terraform validate

D.

Terraform validate

E.

Terraform for

F.

Terraform apply

Your root module contains a variable namednum_servers. Which is the correct way to pass its value to a child module with an input namedservers?

A.

servers = num_servers

B.

servers = var(num_servers)

C.

servers = var.num_servers

D.

servers = ${var.num_servers}

You have a simple Terraform configuration containing one VM (virtual machine) in a cloud provider. You run terraform apply and the VM is created successfully. What will happen if you run terraform apply again immediately afterwards without changing any Terraform code?

A.

Terraform will terminate and recreate the VM.

B.

Terraform will create another duplicate VM.

C.

Terraform will apply the VM to the state file.

D.

Terraform will take no action.

Terraform requires using a different provider for each cloud provider where you want to deploy resources.

A.

True

B.

False

You just scaled your VM infrastructure and realize you set the count variable to the wrong value. You correct the value and save your change. What must you do next to make your infrastructure match your configuration?

A.

Reinitialize because your configuration has changed.

B.

Inspect all Terraform outputs to make sure they are correct.

C.

Inspect your Terraform state because you want to change it.

D.

Run terraform apply and confirm the planned changes.

Exhibit:

provider " aws " { region = " us-east-1 " }

provider " aws " { region = " us-west-2 " }

You need to deploy resources into two different AWS regions in the same Terraform configuration using the provider blocks shown in the exhibit. What do you need to add to the provider configuration to deploy a resource to the us-west-2 AWS region?

A.

Add an alias to the us-west-2 provider (for example, alias = " west " ) and set provider = aws.west on resources that should use us-west-2.

B.

Rename the provider block to provider " aws " " west " { region = " us-west-2 " }.

C.

Create a new provider named provider " aws_west " { region = " us-west-2 " }.

D.

Nothing. Terraform will automatically decide which provider to use for each resource.

Which of these ate features of Terraform Cloud? Choose two correct answers.

A.

Automated infrastructure deployment visualization

B.

Automatic backups

C.

A web-based user interface (Ul)

D.

Remote state storage

Which command(s) adds existing resources in a public cloud into Terraform state?

A.

terraform init

B.

terraform plan

C.

terraform refresh

D.

terraform import

E.

All of these

All modules published on the official Terraform Module Registry have been verified by HasihCorp.

A.

True

B.

False

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 local values

C.

Terraform modules

D.

Terraform workspaces

E.

None of the above

Which of the following is not a key principle of infrastructure as code?

A.

Self-describing infrastructure

B.

Idempotence

C.

Versioned infrastructure

D.

Golden images

Exhibit:

Root module configuration:

output " vnet_id " {

value = module.my_network.vnet_id

}

Error:

Error: Reference to undeclared output value

on main.tf line 12, in output " vnet_id " :

12: value = module.my_network.vnet_id

You are using a networking module in your Terraform configuration with the name my_network. Your root module includes the configuration shown. When you run terraform validate, you get the error shown. Which option would successfully retrieve this value from your networking module?

A.

Change the referenced value to module.my_network.outputs.vnet_id.

B.

Define the attribute vnet_id as a variable in the networking module.

C.

Change the referenced value to my_network.outputs.vnet_id.

D.

Define the attribute vnet_id as an output in the networking module.

Which method for sharing Terraform modules fulfills the following criteria:

Keeps the module configurations confidential within your organization.

Supports Terraform ' s semantic version constraints.

Provides a browsable directory of your modules.

A.

A Git repository containing your modules.

B.

Public Terraform module registry.

C.

A subfolder within your workspace.

D.

HCP Terraform/Terraform Cloud private registry.

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

A.

test

B.

google

C.

compute_instance

D.

main

How does the use of Infrastructure as Code (IaC) enhance the reliability of your infrastructure?

Pick the two correct responses below.

A.

Proposed changes can be reviewed before being applied.

B.

Infrastructure is automatically scaled to meet demand.

C.

Incorrect configurations cannot be deployed.

D.

Updates are deployed with zero downtime.

E.

Configuration drift is reduced with declarative definitions.

What is terraform plan -refresh-only intended to detect?

A.

Terraform configuration code changes

B.

Corrupt state files

C.

State file drift

D.

Empty state files

Where in your Terraform configuration do you specify a state backend?

A.

The resource block

B.

The data source block

C.

The terraform block

D.

The provider block

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