Summer Special Sale - 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: spcl70

Practice Free Terraform-Associate-004 HashiCorp Certified: Terraform Associate (004) (HCTA0-004) Exam Questions Answers With Explanation

We at Crack4sure are committed to giving students who are preparing for the HashiCorp Terraform-Associate-004 Exam the most current and reliable questions . To help people study, we've made some of our HashiCorp Certified: Terraform Associate (004) (HCTA0-004) exam materials available for free to everyone. You can take the Free Terraform-Associate-004 Practice Test as many times as you want. The answers to the practice questions are given, and each answer is explained.

Question # 6

When using multiple configurations of the same Terraform provider, what meta-argument must you include in any non-default provider configurations?

A.

depends_on

B.

alias

C.

name

D.

id

Question # 7

You’ve enabled DEBUG-level logging for Terraform, and you’d like to send the log data to a file. Which action should you take?

A.

Set the TF_LOG_PATH environment variable.

B.

Update the Terraform CLI configuration file.

C.

Add a path argument to the terraform block.

D.

Run the terraform output command.

Question # 8

You have never used Terraform before and would like to test it out using a shared team account for a cloud provider. The shared team account already contains 15 virtual machines (VM). You develop a Terraform configuration containing one VM. perform terraform apply, and see that your VM was created successfully. What should you do to delete the newly-created VM with Terraform?

A.

The Terraform state file contains all 16 VMs in the team account. Execute terraform destroy and select the newly-created VM.

B.

Delete the Terraform state file and execute terraform apply.

C.

The Terraform state file only contains the one new VM. Execute terraform destroy.

D.

Delete the VM using the cloud provider console and terraform apply to apply the changes to the Terraform state file.

Question # 9

What does this code do?

terraform { required_providers { aws = " > = 3.0 " }}

A.

Requires any version of the AWS provider > = 3.0 and < 4.0

B.

Requires any version of the AWS provider > = 3.0

C.

Requires any version of the AWS provider > = 3.0 major release. like 4.1

D.

Requires any version of the AWS provider > 3.0

Question # 10

You want to define multiple data disks as nested blocks inside the resource block for a virtual machine. What Terraform feature would help you define the blocks using the values in a variable?

A.

Local values

B.

Count arguments

C.

Collection functions

D.

Dynamic blocks

Question # 11

A module can always refer to all variables declared in its parent module.

A.

True

B.

False

Question # 12

You can define multiple backend blocks in your Terraform configuration to store your state in multiple locations.

A.

True

B.

False

Question # 13

Your team often uses API calls to create and manage cloud infrastructure. In what ways does Terraform differ from conventional infrastructure management approaches?

A.

Terraform describes infrastructure with version-controlled, repeatable configurations that specify the desired state.

B.

Terraform is merely a wrapper for cloud provider APIs, so there is little to no difference in calling the API directly.

C.

Terraform replaces cloud provider APIs with its own protocols, enabling automated deployments.

D.

Terraform enforces infrastructure through imperative scripts to ensure tasks are completed in the proper order.

Question # 14

How do you specify a module’s version when publishing it to the public terraform Module Registry?

A.

Configuration it in the module ' s Terraform code

B.

Mention it on the module ' s configuration page on the Terraform Module Registry

C.

The Terraform Module Registry does not support versioning modules

D.

Tag a release in the associated repo

Question # 15

What is a key benefit of the Terraform state file?

A.

A state file can schedule recurring infrastructure tasks

B.

A state file is a source of truth for resources provisioned with Terraform

C.

A state file is a source of truth for resources provisioned with a public cloud console

D.

A state file is the desired state expressed by the Terraform code files

Question # 16

What is modified when executing Terraform inrefresh-only mode?

A.

Your Terraform configuration.

B.

Your Terraform plan.

C.

Your state file.

D.

Your cloud infrastructure.

Question # 17

terraform apply will fail if you have not run terraform plan first to update the plan output.

A.

True

B.

False

Question # 18

You can configure multiple cloud blocks in your Terraform configuration to connect your workspace to both HCP Terraform and your Terraform Enterprise instance.

A.

True

B.

False

Question # 19

When you run terraform apply, the Terraform CLI will print output values from both the root module and any child modules.

A.

True

B.

False

Question # 20

Which of the following ate advantages of using infrastructure as code (laC) instead of provisioning with a graphical user interface (GUI)? Choose two correct answers.

A.

Lets you version, reuse, and share infrastructure configuration

B.

Provisions the same resources at a lower cost

C.

Secures your credentials

D.

Reduces risk of operator error

E.

Prevents manual modifications to your resources

Question # 21

What value does the Terraform Cloud private registry provide over the public Terraform Module Registry?

A.

The ability to share modules publicly with any user of Terraform

B.

The ability to restrict modules to members of Terraform Cloud or Enterprise organizations

C.

The ability to tag modules by version or release

D.

The ability to share modules with public Terraform users and members of Terraform Cloud Organizations

Question # 22

Which method for sharing Terraform configurations fulfills the following criteria:

1. Keeps the configurations confidential within your organization

2. Support Terraform’s semantic version constrains

3. Provides a browsable directory

A.

Subfolder within a workspace

B.

Generic git repository

C.

Terraform Cloud private registry

D.

Public Terraform module registry

Question # 23

You have developed a new cloud-based service that uses proprietary APIs and want to use Terraform to create, manage, and delete users from the service. How can Terraform interact with the service?

A.

Terraform can manage users for any service that is hosted on a public cloud provider.

B.

Develop and publish a custom provider to interact with the service using its proprietary APIs.

Question # 24

What information does the public Terraform Module Registry automatically expose about published modules?

A.

Required input variables

B.

Optional inputs variables and default values

C.

Outputs

D.

All of the above

E.

None of the above

Question # 25

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.

Delete the state before running Terraform

C.

Configure state locking for your state backend

D.

Run Terraform with parallelism set to 1

Question # 26

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.

Run the terraform fmt command during the code linting phase of your CI/CD process Most Voted

B.

Designate one person in each team to review and format everyone ' s code

C.

Manually apply two spaces indentation and align equal sign " = " characters in every Terraform file (*.tf)

D.

Write a shell script to transform Terraform files using tools such as AWK, Python, and sed

Question # 27

The HCP Terraform private registry keeps the module configurations confidential within your organization.

A.

True

B.

False

Question # 28

Which are examples of infrastructure as code? Choose two correct answers.

A.

Cloned virtual machine images

B.

Versioned configuration files

C.

Change management database records

D.

Doctor files

Question # 29

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

Question # 30

When should you run terraform init?

A.

Every time you run terraform apply

B.

Before you start coding a new Terraform project

C.

After you run terraform plan for the time in a new terraform project and before you run terraform apply

D.

After you start coding a new terraform project and before you run terraform plan for the first time.

Question # 31

What Terraform command always causes a state file to be updated with changes that might have been made outside of Terraform?

A.

Terraform plan –refresh-only

B.

Terraform show –json

C.

Terraform apply –lock-false

D.

Terraform plan target-state

Question # 32

You add a new provider to your configuration and immediately run terraform apply in the CD using the local backend. Why does the apply fail?

A.

The Terraform CD needs you to log into Terraform Cloud first

B.

Terraform requires you to manually run terraform plan first

C.

Terraform needs to install the necessary plugins first

D.

Terraform needs you to format your code according to best practices first

Question # 33

Which two steps are required to provision new infrastructure in the Terraform workflow? Choose two correct answers.

A.

Plan

B.

Import

C.

Alidate

D.

Init

E.

apply

Question # 34

Which of the following locations can Terraform use as aprivate sourcefor modules?(Pick 2 correct responses)

A.

Public repository on GitHub.

B.

Public Terraform Registry.

C.

Internally hosted VCS (Version Control System) platform.

D.

Private repository on GitHub.

Question # 35

A Terraform local value can reference other Terraform local values.

A.

True

B.

False

Question # 36

Which statements are true? Choose two correct answers.

A.

When a resource has a count meta-argument, Terraform evaluates the precondition for each instance.

B.

A precondition cannot reference attributes of another resource that are only known after apply.

C.

A precondition in a resource block must pass for Terraform to create the resource.

D.

If a resource’s postcondition block fails, Terraform still creates the resources that depend on it.

Question # 37

Exhibit:

module " network " {

source = " terraform-google-modules/network/google "

version = " ~ > 11.0 "

}

What version of the source module does Terraform allow with the module block shown in the exhibit?

A.

Any version of the module > 11.0.

B.

Any version of the module > = 11.0.

C.

Any version of the module > = 11.0 and < 12.0.

D.

Any version of the module > = 11.0.0 and < 11.1.0.

Question # 38

Which Terraform collection type should you use to store key/value pairs?

A.

Set

B.

Map

C.

Tuple

D.

list

Question # 39

How does the Terraform cloud integration differ from other state backends such as S3, Consul,etc?

A.

It can execute Terraform runs on dedicated infrastructure in Terraform Cloud

B.

It doesn ' t show the output of a terraform apply locally

C.

It is only arable lo paying customers

D.

All of the above

Question # 40

By default, if you do not define a backend for your configuration, where does Terraform store information about the resources that it manages?

A.

A subdirectory of your home directory named .terraform.d

B.

A file in your configuration ' s directory named terraform.tfstate

C.

A file in your configuration ' s directory named .terraform.lock.hcl

D.

A subdirectory of your configuration named .terraform

Question # 41

A data source is shown in the exhibit below.

How do you reference the id attribute of this data source?

Terraform-Associate-004 question answer

}

}

A.

data.aws_ami.web.id

B.

aws_ami.web.id

C.

web.id

D.

data.web.id

Question # 42

The terraform output command shows outputs from child modules.

A.

True

B.

False

Question # 43

When using multiple configuration of the same Terraform provider, what meta-argument must you include in any non-default provider configurations?

A.

Alias

B.

Id

C.

Depends_on

D.

name

Question # 44

You want to use API tokens and other secrets within your team ' s Terraform workspaces. Where does HashiCorp recommend you store these sensitive values?

(Pick 3 correct responses)

A.

In a plaintext document on a shared drive.

B.

In a terraform.tfvars file, checked into version control.

C.

In a terraform.tfvars file, securely managed and shared with your team.

D.

In an HCP Terraform/Terraform Cloud variable, with the sensitive option checked.

E.

In HashiCorp Vault.

Question # 45

Your Terraform configuration manages a resource that requires maximum uptime. You need to update the resource, and when you run terraform plan, Terraform indicates that the update requires the resource to be destroyed and recreated.

Which lifecycle rule can you add to the resource to reduce downtime while still applying the update?

A.

prevent_destroy = true

B.

ignore_changes = all

C.

create_before_destroy = true

D.

destroy = false

Question # 46

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 "

Question # 47

You need to determine from which paths Terraform is loading the providers referenced in your *.tf files.

How can you enable additional logging to see this information?

A.

Set the environment variable TF_VAR_log=TRACE.

B.

Set the environment variable TF_LOG_PATH.

C.

Set the environment variable TF_LOG=TRACE.

D.

Set verbose logging for each provider in your Terraform configuration.

Question # 48

You want to bring an existing database under Terraform management. What information is required to create a new import block for the database?

Pick the two correct responses below.

A.

The destination resource address of the block that will manage the database.

B.

The path to the .tf file that contains the database resource block.

C.

The ID associated with the current database on the cloud provider.

D.

The database platform and version that the existing resource is running.

E.

The connection string that Terraform will use to connect and manage the database.

Question # 49

Which command should you run to check if all code in a Terraform configuration that references multiple modules is properly formatted without making changes?

A.

terraform fmt -write-false

B.

terraform fmt -list -recursive

C.

terraform fmt -check -recursive

D.

terraform fmt -check

Question # 50

You use a cloud provider account that is shared with other team members. You previously used Terraform to create a load balancer that listens on port 80. After application changes, you updated the Terraform code to change the port to 443.

You run terraform plan and see that the execution plan shows the port changing from 80 to 443 like you intended and step away to grab some coffee.

In the meantime, another team member manually changes the load balancer port to 443 through the cloud provider console before you get back to your desk.

What will happen when you run terraform apply upon returning to your desk?

A.

Terraform will recreate the load balancer.

B.

Terraform will fail with an error because the state file is no longer accurate.

C.

Terraform will change the load balancer port to 80, and then change it back to 443.

D.

Terraform will not make any changes to the load balancer and will update the state file to reflect the manual change.

Question # 51

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

A.

True

B.

False

Question # 52

What type of block is used to construct a collection of nested configuration blocks?

A.

Dynamic

B.

For_each

C.

Nesting

D.

repeated.

Question # 53

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

Question # 54

You want to bring an existing database under Terraform management. What information is required to create a new import block for the database?

Pick the 2 correct responses below:

A.

The destination resource address of the block that will manage the database.

B.

The path to the .tf file that contains the database resource block.

C.

The ID associated with the current database on the cloud provider.

D.

The database platform and version that the existing resource is running.

E.

The connection string that Terraform will use to connect and manage the database.

Question # 55

Which of the following should you put into the required_providers block?

A.

version > = 3.1

B.

version = “ > = 3.1”

C.

version ~ > 3.1

Question # 56

Terraform variable names are saved in the state file.

A.

True

B.

False

Question # 57

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

A.

Provider

B.

Resource ID

C.

Resource address

D.

Path

Question # 58

You have set the TF_LOG_PATH environment variable for Terraform, and you would like to ensure the logs contain all debug-level messages and verbose process logs.

Which action should you take?

A.

Set the TF_LOG environment variable to TRACE.

B.

Add a log argument to the terraform block.

C.

Update the Terraform CLI configuration file.

D.

Run the terraform output command.

Question # 59

Which is the best way to specify a tag of v1.0.0 when referencing a module stored in Git (for example.

Git::https://example.com/vpc.git)?

A.

Append pref=v1.0.0 argument to the source path

B.

Add version = “1.0.0” parameter to module block

C.

Nothing modules stored on GitHub always default to version 1.0.0

Question # 60

The Terraform binary version and provider versions must match each other in a single configuration.

A.

True

B.

False

Question # 61

Which features do HCP Terraform workspaces provide that are not available in Terraform Community Edition? (Pick the 3 correct responses below.)

A.

State versions and run history.

B.

Automatic detection of common security issues.

C.

Store Terraform and environment variables in variable sets.

D.

Remote execution of Terraform operations.

E.

Store your configuration in a Version Control System (VCS).

F.

Support for multiple cloud providers.

Question # 62

When a check block’s assertion fails, Terraform blocks the current operation from executing.

A.

True

B.

False

Question # 63

Which of the following can you do with terraform plan?

Pick the two correct responses below.

A.

Save a generated execution plan to apply later.

B.

View the execution plan and check whether the changes match your expectations.

C.

Schedule Terraform to run at a planned time in the future.

D.

Execute a plan in a different workspace.

Question # 64

Which task does terraform init not perform?

A.

Validates all required variables are present

B.

Sources any modules and copies the configuration locally

C.

Connects to the backend

D.

Sources all providers used in the configuration and downloads them

Question # 65

You add a new resource to an existing Terraform configuration, but do not update the version constraint in the configuration. The existing and new resources use the same provider. The working contains a .terraform.lock, hc1 file.

How will Terraform choose which version of the provider to use?

A.

Terraform will use the version recorded in your lock file

B.

Terraform will use the latest version of the provider for the new resource and the version recorded in the lock file to manage existing resources

C.

Terraform will check your state file to determine the provider version to use

D.

Terraform will use the latest version of the provider available at the time you provision your new resource

Question # 66

Module variable assignments are inherited from the parent module and you do not need to explicitly set them.

A.

True

B.

False

Question # 67

You want to define a single input variable to capture configuration values for a server. The values must represent memory as a number, and the server name as a string.

Which variable type could you use for this input?

A.

List

B.

Object

C.

Map

D.

Terraform does not support complex input variables of different types

Question # 68

While attempting to deploy resources into your cloud provider using Terraform, you begin to see some odd behavior and experience slow responses. In order to troubleshoot you decide to turn on Terraform debugging. Which environment variables must be configured to make Terraform ' s logging more verbose?

A.

TF_LOG_PAIH

B.

TF_LOG

C.

TF_VAR_log_path

D.

TF_VAR_log_level

Question # 69

Which command lets you experiment with terraform expressions?

A.

Terraform console

B.

Terraform validate

C.

Terraform env

D.

Terraform test

Question # 70

When should you use the terraform force-unlock command?

A.

When terraform apply has failed due to a state lock.

B.

When you have a high-priority change.

C.

When automatic unlocking has failed.

D.

When you see a status message stating that Terraform cannot acquire the lock.

Question # 71

You want to know from which paths Terraform is loading providers referenced in your Terraform configuration (* files). You need to enable additional logging messages to find this out. Which of the following would achieve this?

A.

Set verbose for each provider in your Terraform configuration

B.

Set the environment variable TF_LOG_TRACE

C.

Set the environment variable TF_LOG_PATH

D.

Set the environment variable TF_log_TRACE

Question # 72

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

A.

Automatic scaling of resources based on application load.

B.

Role-based access control of cloud resources.

C.

Cost optimization of infrastructure deployment.

D.

Reviewing the proposed changes for potential security issues.

Question # 73

Infrastructure as Code (laC) can be stored in a version control system along with application code.

A.

True

B.

False

Question # 74

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

Question # 75

What is the primary purpose of IaC (Infrastructure as Code)?

A.

To provision infrastructure cheaply.

B.

To programmatically create and configure resources.

C.

To define a vendor-agnostic API.

D.

To define a pipeline to test and deliver software.

Question # 76

Your team uses HCP Terraform to manage infrastructure. You need to make a change to an infrastructure stack running in a public cloud. Which pattern follows Infrastructure as Code best practices for making the change?

A.

Clone the repository containing your infrastructure code, and then run the code.

B.

Use the public cloud console to make the change.

C.

Make the change through the public cloud API endpoint.

D.

Run the public cloud CLI tool to make the change.

E.

Submit a pull request and wait for an approved merge of the change.

Question # 77

It is best practice to store secret data in the same version control repository as your Terraform configuration.

A.

True

B.

False

Question # 78

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

Question # 79

Why would you use the -replace flag for terraform apply?

A.

You want to force Terraform to destroy a resource on the next apply.

B.

You want Terraform to ignore a resource on the next apply.

C.

You want to force Terraform to destroy and recreate a resource on the next apply.

D.

You want Terraform to destroy all the infrastructure in your workspace.

Question # 80

Before you can use a new backend or HCP Terraform/Terraform Cloud integration, you must first execute terraform init.

A.

True

B.

False

Question # 81

You have a Terraform configuration that defines a single virtual machine with no references to it, You have run terraform apply to create the resource, and then removed the resource definition from your Terraform configuration file.

What will happen you run terraform apply in the working directory again?

A.

Terraform will remove the virtual machine from the state file, but the resource will still exist

B.

Nothing

C.

Terraform will error

D.

Terraform will destroy the virtual machine

Question # 82

Exhibit:

data " aws_ami " " web " {

most_recent = true

owners = [ " self " ]

tags = {

Name = " web-server "

}

}

A data source is shown in the exhibit. How do you reference the id attribute of this data source?

A.

aws_ami.web.id

B.

web.id

C.

data.aws_ami.web.id

D.

data.web.id

Question # 83

INcheck block ' s assertion fails, Terraform blocks the current operation from executing.

A.

True

B.

False

Question # 84

When you use a backend that requires authentication, it is best practice to:

A.

Run all of your Terraform commands on a shared server or container.

B.

Configure the authentication credentials in your Terraform configuration files, and store them in a private version control system.

C.

Use environment variables to configure authentication credentials outside of your Terraform configuration.

D.

None of the above.

Question # 85

Which argument can you set on a module block to prevent Terraform from updating the module’s configuration during an init or get operation?

A.

version

B.

lifecycle

C.

count

D.

source

Question # 86

Exhibit:

resource " kubernetes_namespace " " example " {

name = " test "

}

A resource block is shown in the exhibit. How would you reference the name attribute of this resource in HCL?

A.

kubernetes_namespace.example,name

B.

kubernetes_namespace.test.name

C.

data.kubernetes_namespace.name

D.

resource.kubernetes_namespace.example.name

Question # 87

What is the provider for the resource shown in the Exhibit?

resource " aws_vpc " " main " {

name = " test "

}

A.

VPC

B.

test

C.

main

D.

aws

Question # 88

Your team adopts AWS CloudFormation as the standardized method for provisioning public cloud resources. Which scenario presents a challenge for your team?

A.

Building a reusable code base that can deploy resources into any AWS region.

B.

Managing a new application stack built on AWS-native services.

C.

Automating a manual, web console-based provisioning process.

D.

Deploying new infrastructure into Microsoft Azure.

Question # 89

You have deployed a new webapp with a public IP address on a cloud provider. However, you did not create any outputs for your code. What is the best method to quickly find the IP address of the resource you deployed?

A.

In a new folder, use the terraform_remote_state data source to load in the state file, then write an output for each resource that you find the state file

B.

Run terraform state list to find the name of the resource, then terraform state show to find the attributes including public IP address

C.

Run terraform output ip_address to view the result

D.

Run terraform destroy then terraform apply and look for the IP address in stdout

Question # 90

What feature stops multiple users from operating on the Terraform state at the same time?

A.

State locking

B.

Version control

C.

Provider constraints

D.

Remote backends

Question # 91

Which is a recommended way to share Terraform state across teams?

A.

Use a remote state backend.

B.

No additional configuration is recommended.

C.

Store the terraform.tfstate file in version control.

D.

Store the terraform.tfstate file in HashiCorp Vault.

Question # 92

You have a saved execution plan containing desired changes for infrastructure managed by Terraform. After running the command terraform apply my.tfplan, you receive the error shown in the exhibit below.

Exhibit:

Error: Saved plan is stale

The given plan file can no longer be applied because the state was changed by another operation after the plan was created.

How can you apply the desired changes? (Choose TWO correct answers)

A.

Update the current plan file using the terraform state push command.

B.

Refresh the current state data using the -refresh-only flag.

C.

Force the apply command by adding the flag -lock=false.

D.

Generate a new execution plan file with terraform plan, and apply the new plan.

E.

Run terraform apply without the saved execution plan.

Question # 93

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

Question # 94

You much initialize your working directory before running terraform validate.

A.

True

B.

False

Question # 95

What does Terraform not reference when running a terraform apply -refresh-only ?

A.

State file

B.

Credentials

C.

Cloud provider

D.

Terraform resource definitions in configuration files

Question # 96

Terraform encrypts sensitive values stored in your state file.

A.

True

B.

False

Question # 97

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

Question # 98

Using the terraform state rm command against a resource will destroy it.

A.

True

B.

False

Question # 99

Which command add existing resources into Terraform state?

A.

Terraform init

B.

Terraform plan

C.

Terraform refresh

D.

Terraform import

E.

All of these

Question # 100

You want to create a string that combines a generated random_id and a variable and reuse that string several times in your configuration. What is the simplest correct way to implement this without repeating the random_id and variable?

A.

Use a module.

B.

Add an output value.

C.

Add a local value.

D.

Use a data source.

Question # 101

Part of a configuration is shown in the exhibit below.

You want to pass the id of the vsphere_datacenter data source to the datacenter_id argument of the vsphere_folder resource.

Terraform-Associate-004 question answer Which reference would you use?

A.

data.vsphere_datacenter.dc.id

B.

data.vsphere_datacenter.dc

C.

data.dc.id

D.

vsphere_datacenter.dc.id

Question # 102

Exhibit.

You need to deploy resources into two different regions in the same Terraform configuration. To do this, you declare multiple provider configurations as shown in the Exhibit space on this page.

What meta-argument do you need to configure in a resource block to deploy the resource to the us-west-2 AWS region?

A.

provider = aws.west

B.

alias = aws.west

C.

provider = west

D.

alias = west

Question # 103

Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged into stdout.

A.

True

B.

False

Question # 104

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

Question # 105

You have used Terraform lo create an ephemeral development environment in the (loud and are now ready to destroy all the Infrastructure described by your Terraform configuration To be safe, you would like to first see all the infrastructure that Terraform will delete.

Which command should you use to show all of the resources that mil be deleted? Choose two correct answers.

A.

Run terraform state rm ‘

B.

Run terraform show :destroy

C.

Run terraform destroy and it will first output all the resource that will be deleted before prompting for approval

D.

Run terraform plan .destory

Question # 106

Which situation will return 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.

Question # 107

Why is it considered important to treat your Terraform state file as sensitive?

A.

It can contain information such as resource passwords and keys.

B.

It stores all environment variables from the machine that created it.

C.

It can be manually edited to change the deployed resources.

D.

It contains personal information about the last user to update it.

Question # 108

Module version is required to reference a module on the Terraform Module Registry.

A.

True

B.

False

Question # 109

Terraform installs its providers during which phase?

A.

Plan

B.

Init

C.

Refresh

D.

All of the above

Terraform-Associate-004 PDF

$33

$109.99

3 Months Free Update

  • Printable Format
  • Value of Money
  • 100% Pass Assurance
  • Verified Answers
  • Researched by Industry Experts
  • Based on Real Exams Scenarios
  • 100% Real Questions

Terraform-Associate-004 PDF + Testing Engine

$52.8

$175.99

3 Months Free Update

  • Exam Name: HashiCorp Certified: Terraform Associate (004) (HCTA0-004)
  • Last Update: Jul 29, 2026
  • Questions and Answers: 366
  • Free Real Questions Demo
  • Recommended by Industry Experts
  • Best Economical Package
  • Immediate Access

Terraform-Associate-004 Engine

$39.6

$131.99

3 Months Free Update

  • Best Testing Engine
  • One Click installation
  • Recommended by Teachers
  • Easy to use
  • 3 Modes of Learning
  • State of Art Technology
  • 100% Real Questions included