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

The public Terraform Module Registry is free to use.

A.

True

B.

False

Question # 7

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 # 8

You ' re building a CI/CD (continuous integration/continuous delivery) pipeline and need to inject sensitive variables into your Terraform run. How can you do this safely?

A.

Copy the sensitive variables into your Terraform code

B.

Store the sensitive variables in a secure_varS.tf file

C.

Store the sensitive variables as plain text in a source code repository

D.

Pass variables to Terraform with a -var flag

Question # 9

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

A.

True

B.

False

Question # 10

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.

Question # 11

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

Question # 12

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 # 13

Which of these is true about Terraform ' s plugin-based architecture?

A.

Terraform can only source providers from the internet

B.

Every provider in a configuration has its own state file for its resources

C.

You can create a provider for your API if none exists

D.

All providers are part of the Terraform core binary

Question # 14

Which of the following does terraform apply change after you approve the execution plan? (Choose two.)

A.

Cloud infrastructure

B.

The .terraform directory

C.

The execution plan

D.

State file

E.

Terraform code

Question # 15

A Terraform local value can reference other Terraform local values.

A.

True

B.

False

Question # 16

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

A.

True

B.

False

Question # 17

Which of the following is not a way to trigger terraform destroy?

A.

Using the destroy command with auto-approve.

B.

Passing --destroy at the end of a plan request.

C.

Running terraform destroy from the correct directory and then typing yes when prompted in the CLI.

Question # 18

What is the provider for this resource?

A.

Vpc

B.

Test

C.

Main

D.

aws

Question # 19

How can terraform plan aid in the development process?

A.

Initializes your working directory containing your Terraform configuration files

B.

Validates your expectations against the execution plan without permanently modifying state

C.

Formats your Terraform configuration files

D.

Reconciles Terraform ' s state against deployed resources and permanently modifies state using the current status of deployed resources

Question # 20

When should you write Terraform configuration files for existing infrastructure that you want to start managing with Terraform?

A.

You can import infrastructure without corresponding Terraform code

B.

Terraform will generate the corresponding configuration files for you

C.

Before you run terraform Import

D.

After you run terraform import

Question # 21

You are creating a reusable Terraform configuration and want to include an optional billing_dept tag so your Finance team can track team-specific spending on resources. Which of the following billing_dept variable declarations will achieve this?

A.

variable " billing_dept " {

default = " "

}

B.

variable " billing_dept " {

optional = true

}

C.

variable " billing_dept " {

type = optional(string)

}

D.

variable " billing_dept " {

type = default

}

Question # 22

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

A.

Prevents manual modifications to your resources

B.

Lets you version, reuse, and share infrastructure configuration

C.

Secures your credentials

D.

Provisions the same resources at a lower cost

E.

Reduces risk of operator error

Question # 23

You need to deploy resources into two different regions in the same Terraform configuration using the block shown in the exhibit below.

Terraform-Associate-004 question answer What do you need to add to the provider configuration to deploy the resource to the us-west-2 AWS region?

A

Terraform-Associate-004 question answer

B.

Terraform-Associate-004 question answer

C.

Terraform-Associate-004 question answer

D.

Terraform-Associate-004 question answer

Question # 24

A developer on your team is going to leaf down an existing deployment managed by Terraform and deploy a new one. However, there is a server resource named aws instant.ubuntu[l] they would like to keep. What command should they use to tell Terraform to stop managing that specific resource?

A.

Terraform plan rm:aws_instance.ubuntu[1]

B.

Terraform state rm:aws_instance.ubuntu[1]

C.

Terraform apply rm:aws_instance.ubuntu[1]

D.

Terraform destory rm:aws_instance.ubuntu[1]

Question # 25

How does Terraform manage most dependencies between resources?

A.

Terraform will automatically manage most resource dependencies

B.

Using the depends_on parameter

C.

By defining dependencies as modules and including them in a particular order

D.

The order that resources appear in Terraform configuration indicates dependencies

Question # 26

Terraform configuration can only import modules from the public registry.

A.

True

B.

False

Question # 27

You’ve just finished refactoring part of your Terraform workspace’s configuration to use a module to manage some of your resources. When you plan your changes, you notice that Terraform will destroy and recreate the affected resources. Doing so could cause unintended downtime in the application your workspace manages. What supported approach should you take to complete the refactor without destroying and recreating your resources?

A.

Add moved blocks to your configuration to let Terraform know the new resource addresses for the affected resources.

B.

Run the terraform console command to edit your workspace ' s state and update the resource names.

C.

Manually edit your terraform.tfstate file and update the resource names.

D.

Open your cloud provider ' s console and rename the affected resources.

Question # 28

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?

A.

Data.vsphere_datacenter.DC.id

B.

Vsphere_datacenter.dc.id

C.

Data,dc,id

D.

Data.vsphere_datacenter,dc

Question # 29

You just upgraded the version of a provider in an existing Terraform project. What do you need to do to install the new provider?

A.

Run terraform refresh.

B.

Run terraform init -upgrade.

C.

Run terraform apply -upgrade.

D.

Upgrade your version of Terraform.

Question # 30

Select the command that doesn’t cause Terraform to refresh its state.

A.

Terraform destroy

B.

Terraform apply

C.

Terraform plan

D.

Terraform state list

Question # 31

The_________determines how Terraform creates, updates, or delete resources.

A.

Terraform configuration

B.

Terraform provisioner

C.

Terraform provider

D.

Terraform core

Question # 32

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 # 33

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

A.

True

B.

False

Question # 34

Your security team scanned some Terraform workspaces and found secrets stored in plaintext in state files. How can you protect that data?

A.

Edit your state file to scrub out the sensitive data

B.

Always store your secrets in a secrets.tfvars file

C.

Delete the state file every time you run Terraform

D.

Store the state in an encrypted backend

Question # 35

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 # 36

As a member of an operations team that uses infrastructure as code (lac) practices, you are tasked with making a change to an infrastructure stack running in a public cloud. Which pattern would follow laC best practices for making a change?

A.

Make the change via the public cloud API endpoint

B.

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

C.

Use the public cloud console to make the change after a database record has been approved

D.

Make the change programmatically via the public cloud CLI

E.

Submit a pull request and wait for an approved merge of the proposed changes

Question # 37

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

A.

Provider

B.

Resource ID

C.

Resource address

D.

Path

Question # 38

Only the user that generated a plan may apply it.

A.

True

B.

False

Question # 39

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 # 40

Terraform providers are always installed from the Internet.

A.

True

B.

False

Question # 41

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

A.

Dynamic

B.

For_each

C.

Nesting

D.

repeated.

Question # 42

If a DevOps team adopts AWS CloudFormation as their standardized method for provisioning public cloud resoruces, which of the following scenarios poses a challenge for this team?

A.

The team is asked to manage a new application stack built on AWS-native services

B.

The organization decides to expand into Azure wishes to deploy new infrastructure

C.

The team is asked to build a reusable code based that can deploy resources into any AWS region

D.

The DevOps team is tasked with automating a manual, web console-based provisioning.

Question # 43

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

A.

Set

B.

Map

C.

Tuple

D.

list

Question # 44

Which of the following is true about terraform apply?(Pick 2 correct responses)

A.

You must pass the output of a terraform plan command to it.

B.

By default, it does not refresh your state file to reflect the current infrastructure configuration.

C.

Depending on provider specification, Terraform may need to destroy and recreate your infrastructure resources.

D.

You cannot target specific resources for the operation.

E.

It only operates on infrastructure defined in the current working directory or workspace.

Question # 45

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

A.

True

B.

False

Question # 46

What are some benefits of using Sentinel with Terraform Cloud/Terraform Cloud? Choose three correct answers.

A.

You can restrict specific resource configurations, such as disallowing the use of CIDR=0.0.0.0/0.

B.

You can check out and check in cloud access keys

C.

Sentinel Policies can be written in HashiCorp Configuration Language (HCL)

D.

Policy-as-code can enforce security best practices

E.

You can enforce a list of approved AWS AMIs

Question # 47

Which of the following should you add in the required_providers block to define a provider version constraint?

A.

version ~ > 3.1

B.

version > = 3.1

C.

version = " > = 3.1 "

Question # 48

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 # 49

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 # 50

What is the purpose of the .terraform directory in a Terraform workspace?

A.

The directory is where Terraform creates and maintains the state file to track the underlying resources it creates and manages.

B.

The directory is used to convert and store Terraform configuration files into API calls to communicate with the targeted platform.

C.

The directory contains the provider credentials and the .tfvars files to prevent them from being committed to version control by accident.

D.

The directory contains plugins and modules that Terraform downloads during initialization, along with other important information.

Question # 51

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

A.

True

B.

False

Question # 52

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 # 53

How would you reference the volume IDs associated with the ebs_block_device blocks in this configuration?

Terraform-Associate-004 question answer

A.

aws_instance.example.ebs_block_device[sda2,sda3).volume_id

B.

aws_lnstance.example.ebs_block_device.[*].volume_id

C.

aws_lnstance.example.ebs_block_device.volume_ids

D.

aws_instance.example-ebs_block_device.*.volume_id

Question # 54

You have a simple Terraform configuration containing one virtual machine (VM) in a cloud provider. You run terraform apply and the VM is created successfully.

What will happen if you delete the VM using the cloud provider console, then run terraform apply again without changing any Terraform code?

A.

Terraform will recreate the VM.

B.

Terraform will report an error.

C.

Terraform will remove the VM from the state file.

D.

Terraform will not make any changes.

Question # 55

HashiCorp Configuration Language (HCL) supports user-denned functions.

A.

True

B.

False

Question # 56

Which parameters does the import block require? (Pick the 2 correct responses below.)

A.

The resource ID

B.

Provider

C.

The target resource address

D.

Backend

Question # 57

Which command lets you experiment with terraform expressions?

A.

Terraform console

B.

Terraform validate

C.

Terraform env

D.

Terraform test

Question # 58

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.

Question # 59

Which of the following is not a benefit of adopting infrastructure as code?

A.

Versioning

B.

A Graphical User Interface

C.

Reusability of code

D.

Automation

Question # 60

When you use a remote backend that needs authentication, HashiCorp recommends that you:

A.

Write the authentication credentials in the Terraform configuration files

B.

Keep the Terraform configuration files in a secret store

C.

Push your Terraform configuration to an encrypted git repository

D.

Use partial configuration to load the authentication credentials outside of the Terraform code

Question # 61

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}

Question # 62

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 # 63

What does Terraform use the .terraform.lock.hc1 file for?

A.

There is no such file

B.

Tracking specific provider dependencies

C.

Preventing Terraform runs from occurring

D.

Storing references to workspaces which are locked

Question # 64

You are updating a child module with the resource block shown in the exhibit below. The public_ip attribute of the resource needs to be accessible to the parent module.

Exhibit:

resource " aws_instance " " example " {

ami = " ami-0a123456789abcdef "

instance_type = " t3.micro "

}

How do you meet this requirement?

A.

Create a local value in the child module.

B.

Create an output in the child module.

C.

Add a data source to the parent module.

D.

Add an import block to the parent module.

Question # 65

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.

Question # 66

Variables declared within a module are accessible outside of the module.

A.

True

B.

False

Question # 67

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

}

Question # 68

When using a remote backend or terraform Cloud integration, where does Terraform save resource sate?

A.

In an environment variable

B.

On the disk

C.

In the remote backend or Terraform Cloud

D.

In memory

Question # 69

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 # 70

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 # 71

_______backends support state locking.

A.

All

B.

No

C.

Some

D.

Only local

Question # 72

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

Question # 73

Which provider authentication method prevents credentials from being stored in the state file?

A.

Using environment variables

B.

Specifying the login credentials in the provider block

C.

Setting credentials as Terraform variables

D.

None of the above

Question # 74

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 # 75

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

Question # 76

You ' re writing a Terraform configuration that needs to read input from a local file called id_rsa.pub. Which built-in Terraform function can you use to import the file ' s contents as a string?

A.

fileset( " id_rsa.pub " )

B.

file( " id_rsa.pub " )

C.

filebase64( " id_rsa.pub " )

D.

templatefile( " id_rsa.pub " )

Question # 77

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

Question # 78

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 # 79

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

A.

True

B.

False

Question # 80

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

Question # 81

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 the 3 correct responses)

A.

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

B.

In HashiCorp Vault.

C.

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

D.

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

E.

In a plaintext document on a shared drive.

Question # 82

Which of the following isnotan advantage of using Infrastructure as Code (IaC) operations?

A.

Self-service infrastructure deployment.

B.

Modify a count parameter to scale resources.

C.

API-driven workflows.

D.

Troubleshoot via a Linux diff command.

E.

Public cloud console configuration workflows.

Question # 83

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 # 84

A terraform apply can not _________ infrastructure.

A.

change

B.

destroy

C.

provision

D.

import

Question # 85

Which of the following arguments are required when declaring a Terraform output?

A.

value

B.

description

C.

default

D.

sensitive

Question # 86

How does Terraform determine dependencies between resources?

A.

Terraform requires resource dependencies to be defined as modules and sourced in order

B.

Terraform automatically builds a resource graph based on resources provisioners, special meta-parameters, and the stale file (if present}

C.

Terraform requires resources in a configuration to be listed m the order they will be created to determine dependencies

D.

Terraform requires all dependencies between resources to be specified using the depends_on parameter

Question # 87

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

Question # 88

You ' re writing a Terraform configuration that needs to read input from a local file called id_rsa.pub . Which built-in Terraform function can you use to import the file ' s contents as a string?

A.

file( " id_rsa.pub " )

B.

templaTefil( " id_rsa.pub " )

C.

filebase64( " id_rsa.pub " )

D.

fileset < " id_rsa.pub " )

Question # 89

Which of the following is not an action performed by terraform init?

A.

Initialize a configured backend.

B.

Create template configuration files.

C.

Load required provider plugins.

D.

Retrieve the source code for all referenced modules.

Question # 90

Which type of block fetches or computes information for use elsewhere in a Terraform configuration?

A.

data

B.

local

C.

resource

D.

provider

Question # 91

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 # 92

Which of the following is not a valid Terraform variable type?

A.

list

B.

array

C.

nap

D.

string

Question # 93

You can develop a custom provider to manage its resources using Terraform.

A.

True

B.

False

Question # 94

Which of the following methods, used to provision resources into a public cloud, demonstrates the concept of infrastructure as code?

A.

curl commands manually run from a terminal

B.

A sequence of REST requests you pass to a public cloud API endpoint Most Voted

C.

A script that contains a series of public cloud CLI commands

D.

A series of commands you enter into a public cloud console

Question # 95

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

A.

True

B.

False

Question # 96

You modified your Terraform configuration to fix a typo in the resource ID by renaming it from photoes to photos. What configuration will you add to update the resource ID in state without destroying the existing resource?

Original configuration:

resource " aws_s3_bucket " " photoes " {

bucket_prefix = " images "

}

Updated configuration:

resource " aws_s3_bucket " " photos " {

bucket_prefix = " images "

}

A.

moved {from = aws_s3_bucket.photoesto = aws_s3_bucket.photos}

B.

moved {bucket.photoes = aws_s3_bucket.photos}

C.

moved {aws_s3_bucket.photoes = aws_s3_bucket.photos}

D.

None. Terraform will automatically update the resource ID.

Question # 97

You used Terraform to create an ephemeral development environment in the cloud 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 the resources that will be deleted? (Pick the 2 correct responses)

A.

Runterraform destroy. This will output all the resources that will be deleted before prompting for approval.

B.

Runterraform show -destroy.

C.

Runterraform state rm *.

Question # 98

What is one disadvantage of using dynamic blocks in Terraform?

A.

Dynamic blocks can construct repeatable nested blocks

B.

Terraform will run more slowly

C.

They cannot be used to loop through a list of values

D.

They make configuration harder to read and understand

Question # 99

What’s the proper syntax for the plan command?

A.

terraform apply -var-file=tfplan

B.

terraform plan -target=tfplan

C.

terraform plan -generate-config-out=tfplan

D.

terraform plan -out=tfplan

Question # 100

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

Question # 101

What is the Terraform style convention for indenting a nesting level compared to the one above it?

A.

With a tab

B.

With two spaces

C.

With four spaces

D.

With three spaces

Question # 102

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

Question # 103

Which two steps are required to provision new infrastructure in the Terraform workflow? (Pick the 2 correct responses below.)

A.

Import

B.

Apply

C.

Validate

D.

Plan

E.

Init

Question # 104

Which of these commands makes your code more human readable?

A.

Terraform validate

B.

Terraform output

C.

Terraform show

D.

Terraform file

Question # 105

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 codebase that can deploy resources into any AWS region.

B.

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

C.

Deploying new infrastructure into Microsoft Azure.

D.

Automating a manual, web console-based provisioning process.

Question # 106

Terraform stores the value of an output in its state file, even if the sensitive argument is set to true.

A.

True

B.

False

Question # 107

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.

Question # 108

You are updating a child module with the resource block shown in the exhibit below. The public_ip attribute of the resource needs to be accessible to the parent module.

Exhibit:

resource " aws_instance " " example " {

ami = " ami-0a123456789abcdef "

instance_type = " t3.micro "

}

How do you meet this requirement?

A.

Create a local value in the child module.

B.

Create an output in the child module.

C.

Add a data source to the parent module.

D.

Add an import block to the parent module.

Question # 109

Which backend does the Terraform CLI use by default?

A.

Depends on the cloud provider configured

B.

HTTP

C.

Remote

D.

Terraform Cloud

E.

Local

Question # 110

What type of information can be found on the Terraform Registry when using published modules?

A.

Required input variables.

B.

Outputs.

C.

Optional input variables and default values.

D.

All of the above.

Question # 111

How is terraform import run?

A.

As a part of terraform init

B.

As a part of terraform plan

C.

As a part of terraform refresh

D.

By an explicit call

E.

All of the above

Question # 112

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

A.

True

B.

False

Question # 113

The public Terraform Module Registry is free to use.

A.

True

B.

False

Question # 114

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 # 115

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

Question # 116

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.

Question # 117

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.

Question # 118

You modified your Terraform configuration to fix a typo in the resource ID by renaming it from photoes to photos. What configuration will you add to update the resource ID in state without destroying the existing resource?

Original configuration:

resource " aws_s3_bucket " " photoes " {

bucket_prefix = " images "

}

Updated configuration:

resource " aws_s3_bucket " " photos " {

bucket_prefix = " images "

}

A.

moved {from = aws_s3_bucket.photoesto = aws_s3_bucket.photos}

B.

moved {bucket.photoes = aws_s3_bucket.photos}

C.

moved {aws_s3_bucket.photoes = aws_s3_bucket.photos}

D.

None. Terraform will automatically update the resource ID.

Question # 119

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 # 120

You have a simple Terraform configuration containing one virtual machine (VM) in a cloud provider. You run terraform apply and the VM is created successfully.

What will happen if you delete the VM using the cloud provider console, then run terraform apply again without changing any Terraform code?

A.

Terraform will recreate the VM.

B.

Terraform will report an error.

C.

Terraform will remove the VM from the state file.

D.

Terraform will not make any changes.

Question # 121

A child module can always access variables declared in its parent module.

A.

True

B.

False

Question # 122

Your Terraform configuration declares a variable. You want to enforce that its value meets your specific requirements, and you want to block the Terraform operation if it does not. What should you add to your configuration?

A.

Add a top-level check block.

B.

Add a validation block to the variable block.

C.

Add a top-level validation block.

D.

Add a check block to the variable block.

Question # 123

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 # 124

Terraform can only manage resource dependencies if you set them explicitly with the depends_on argument.

A.

True

B.

False

Question # 125

Changing the Terraform backend from the default " local " backend to a different one after performing your first terrafom apply is:

A.

Optional

B.

Impossible

C.

Mandatory

D.

Discouraged

Question # 126

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 # 127

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

Question # 128

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

A.

resource.kubernetes_namespace.example.name

B.

kubernetes_namespace.example.name

C.

data.kubernetes.namespace.name

D.

kubernetes_namespace.test.name

Question # 129

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 # 130

Which of the following methods, used to provision resources into a public cloud, demonstrates the concept of infrastructure as code?

A.

curl commands manually run from a terminal

B.

A sequence of REST requests you pass to a public cloud API endpoint Most Voted

C.

A script that contains a series of public cloud CLI commands

D.

A series of commands you enter into a public cloud console

Question # 131

A Terraform output that sets the " sensitive " argument to true will not store that value in the state file.

A.

True

B.

False

Question # 132

terraform validate confirms thesyntaxof Terraform files.

A.

True

B.

False

Question # 133

The terraform output command shows outputs from child modules.

A.

True

B.

False

Question # 134

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 # 135

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 # 136

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 # 137

A Terraform provider is NOT responsible for:

A.

Exposing resources and data sources based on an APUI

B.

Managing actions to take based on resources differences

C.

Understanding API interactions with some service

D.

Provisioning infrastructure in multiple

Question # 138

Exhibit:

resource " azurerm_linux_web_app " " app " {

name = " example-app "

resource_group_name = azurerm_resource_group.rg.name

location = azurerm_resource_group.rg.location

service_plan_id = azurerm_service_plan.plan.id

identity {

type = " UserAssigned "

identity_ids = [azurerm_user_assigned_identity.app.id]

}

}

resource " azurerm_role_assignment " " kv_access " {

scope = azurerm_key_vault.kv.id

role_definition_name = " Key Vault Secrets User "

principal_id = azurerm_user_assigned_identity.app.principal_id

}

Two resource blocks are shown: azurerm_linux_web_app and azurerm_role_assignment. When provisioned, the web app will use the role assignment during creation, so the role assignment must be created first. How do you ensure the azurerm_role_assignment resource is created first?

A.

Add a depends_on argument to the azurerm_linux_web_app.

B.

Add a create_before_destroy argument to the azurerm_role_assignment.

C.

Change the order of the azurerm_linux_web_app and azurerm_role_assignment blocks.

D.

Add a count argument to both resources.

Question # 139

Which of the following does HCP Terraform perform during a health assessment for a workspace?

A.

Terraform test execution

B.

Check block validation

C.

Infrastructure cost estimation

D.

Resource drift detection

E.

Sentinel policy checks

Question # 140

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 # 141

A Terraform backend determines how Terraform loads state and stores updates when you execute which command?

A.

apply

B.

destroy

C.

Both of these are correct.

D.

Neither of these are correct.

Question # 142

When you include a module block in your configuration that references a module from the Terraform Registry, the " version " attribute is required.

A.

True

B.

False

Question # 143

You can install community and partner plugins using terraform init.

A.

True

B.

False

Question # 144

terraform init retrieves and caches the configuration for all remote modules.

A.

True

B.

False

Question # 145

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.

Question # 146

Terraform variable names are saved in the state file.

A.

True

B.

False

Question # 147

If one of your modules uses a local value, you can expose that value to callers of the module by defining a Terraform output in the module’s configuration.

A.

True

B.

False

Question # 148

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

A.

terraform destroy, then terraform apply

B.

terraform init

C.

terraform push

D.

terraform apply

Question # 149

Which command lets you experiment with terraform expressions?

A.

Terraform console

B.

Terraform validate

C.

Terraform env

D.

Terraform test

Question # 150

You have to initialize a Terraform backend before it can be configured.

A.

True

B.

False

Question # 151

All standard backend types support state locking, and remote operations like plan, apply, and destroy.

A.

True

B.

False

Question # 152

A provider configuration block is required in every Terraform configuration.

Example:

Terraform-Associate-004 question answer

A.

True

B.

False

Question # 153

What is the workflow for deploying new infrastructure with Terraform?

A.

Write Terraform configuration, run terraform init to initialize the working directory orworkspace, and run terraform apply

B.

Write Terraform configuration, run terraform show to view proposed changes, and terraform apply to create new infrastructure

C.

Write Terraform configuration, run terraform apply to create infrastructure, use terraform validate to confirm Terraform deployed resources correctly

D.

Write Terraform configuration, run terraform plan to initialize the working directory or workspace, and terraform apply to create the infrastructure

Question # 154

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

A.

True

B.

False

Question # 155

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)

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 # 156

Which argument can you use toprevent unexpected updatesto a module ' s configuration when calling Terraform Registry modules?

A.

source

B.

count

C.

version

D.

lifecycle

Question # 157

You can develop a custom provider to manage its resources using Terraform.

A.

True

B.

False

Question # 158

Multiple team members are collaborating on infrastructure using Terraform and want to format the* Terraform code following standard Terraform-style convention.

How should they ensure the code satisfies conventions?

A.

Terraform automatically formats configuration on terraform apply

B.

Run terraform validate prior to executing terraform plan or terraform apply

C.

Use terraform fmt

D.

Replace all tabs with spaces

Question # 159

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 # 160

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 # 161

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 # 162

Only the user that generated a plan may apply it.

A.

True

B.

False

Question # 163

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

A.

Prevents manual modifications to your resources

B.

Lets you version, reuse, and share infrastructure configuration

C.

Secures your credentials

D.

Provisions the same resources at a lower cost

E.

Reduces risk of operator error

Question # 164

Which of the following does terraform apply change after you approve the execution plan? (Choose two.)

A.

Cloud infrastructure

B.

The .terraform directory

C.

The execution plan

D.

State file

E.

Terraform code

Question # 165

Only the user that generated a terraform plan may apply it.

A.

True

B.

False

Question # 166

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 # 167

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.

Question # 168

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 # 169

terraform validate reports syntax check errors for which of the following?

A.

Code contains tabs for indentation instead of spaces

B.

There is a missing value for a variable

C.

The state file does not match the current infrastructure

D.

None of the above

Question # 170

Which type of information does the Terraform Registry provide about the modules it hosts?

A.

Required input variables

B.

Outputs

C.

Optional input variables and default values

D.

All of these are provided

Question # 171

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 # 172

Which is a benefit of the Terraform state file?

A.

A state file can schedule recurring infrastructure tasks.

B.

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

C.

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

D.

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

Question # 173

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 # 174

You used Terraform to create an ephemeral development environment in the cloud 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 the resources that will be deleted? (Pick the 2 correct responses)

A.

Runterraform destroy. This will output all the resources that will be deleted before prompting for approval.

B.

Runterraform show -destroy.

C.

Runterraform state rm *.

Question # 175

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 # 176

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

A.

Provider

B.

Resource ID

C.

Resource address

D.

Path

Question # 177

Why is it 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 deployed resources.

D.

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

Question # 178

Which command generates DOT (Document Template) formatted data to visualize Terraform dependencies?

A.

terraform graph

B.

terraform show

C.

terraform refresh

D.

terraform output

Question # 179

Which command doesnotcause Terraform to refresh its state?

A.

terraform state list

B.

terraform plan

C.

terraform apply

D.

terraform destroy

Question # 180

_______backends support state locking.

A.

All

B.

No

C.

Some

D.

Only local

Question # 181

Which task does terraform init not perform?

A.

Discovers all providers used in the configuration and downloads them.

B.

Validates that values are set for all required input variables.

C.

Connects to the configured backend.

D.

Discovers any remote modules and downloads them.

Question # 182

Your team is collaborating on infrastructure using Terraform and wants to format code to follow Terraform language style conventions. How can you update your code to meet these requirements?

A.

Run terraform fmt to update your Terraform configurations.

B.

Replace all tabs with spaces within your Terraform configuration files.

C.

Run terraform validate prior to executing terraform plan or terraform apply.

D.

Terraform automatically formats configuration on terraform apply.

Question # 183

What’s the proper syntax for the plan command?

A.

terraform apply -var-file=tfplan

B.

terraform plan -target=tfplan

C.

terraform plan -generate-config-out=tfplan

D.

terraform plan -out=tfplan

Question # 184

A developer launched a VM outside of the Terraform workflow and ended up with two servers with the same name. They are unsure which VM is managed with Terraform, but they do have a list of all active VM IDs. Which method could you use to determine which instance Terraform manages?

A.

Modify the Terraform configuration to add an import block for both of the virtual machines.

B.

Run a terraform apply -refresh to identify the virtual machine IDs that are already managed by Terraform.

C.

Run terraform state rm on both VMs, then terraform apply to recreate the correct one.

D.

Run terraform state list to find the names of all VMs, then run terraform state show for each of them to find which VM ID Terraform manages.

Question # 185

Which of the following should you add in the required_providers block to define a provider version constraint?

A.

version

B.

version = " 3.1 "

C.

version: 3.1

D.

version - 3.1

Question # 186

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 # 187

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 # 188

terraform plan updates your state file.

A.

True

B.

False

Question # 189

Terraform installs its providers during which phase?

A.

Plan

B.

Init

C.

Refresh

D.

All of the above

Question # 190

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

A.

True

B.

False

Question # 191

Which of the following command would be use to access all of the attributes and details of a resource managed by Terraform?

A.

Terraform state show ‘ provider_type_name

B.

Terraform state list

C.

Terraform get provider_type_name

D.

Terraform state list provider_type_name

Question # 192

What are some benefits of using Sentinel with Terraform Cloud/Terraform Cloud? Choose three correct answers.

A.

You can restrict specific resource configurations, such as disallowing the use of CIDR=0.0.0.0/0.

B.

You can check out and check in cloud access keys

C.

Sentinel Policies can be written in HashiCorp Configuration Language (HCL)

D.

Policy-as-code can enforce security best practices

E.

You can enforce a list of approved AWS AMIs

Question # 193

HashiCorp Configuration Language (HCL) supports user-denned functions.

A.

True

B.

False

Question # 194

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 # 195

You provisioned virtual machines (VMs) on Google Cloud Platform using the gcloud command-line tool.

What must be done to manage these VMs using Terraform instead? Pick the two correct responses.

A.

Pick the two correct responses below.

B.

Run terraform state pull.

C.

Add an import block to the configuration.

D.

Add a resource block for the existing VM.

E.

Run terraform apply -refresh-only.

Question # 196

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

A.

True

B.

False

Question # 197

Running terraform fmt without any flags in a directory with Terraform configuration files check the formatting of those files without changing their contents.

A.

True

B.

False

Question # 198

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

Question # 199

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 # 200

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 # 201

Running terraform fmt without any flags in a directory with Terraform configuration files will check the formatting of those files, but will never change their contents.

A.

True

B.

False

Question # 202

Terraform providers are always installed from the Internet.

A.

True

B.

False

Question # 203

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 # 204

How can you configure a Terraform workspace to store its state remotely?

A.

Add a cloud block inside the terraform block.

B.

Add a backend block inside the terraform block.

C.

Set the TERAFORM_CLOUD environment variable.

D.

Set the TERRAFORM_BACKEND environment variable.

Question # 205

Exhibit:

variable " sizes " {

type = list(string)

description = " Valid server sizes "

default = [ " small " , " medium " , " large " ]

}

A variable declaration is shown in the exhibit. Which is the correct way to get the value of medium from this variable?

A.

var.sizes[0]

B.

var.sizes[1]

C.

var.sizes[2]

D.

var.sizes[3]

Question # 206

Define the purpose of state in Terraform.

A.

State maps real world resources to your configuration and keeps track of metadata

B.

State lets you enforce resource configurations that relate to compliance policies

C.

State stores variables and lets you quickly reuse existing code

D.

State codifies the dependencies of related resources

Question # 207

You ate creating a Terraform configuration which needs to make use of multiple providers, one for AWS and one for Datadog. Which of the following provider blocks would allow you to do this?

Terraform-Associate-004 question answer

A.

Option A

B.

Option B

C.

Option C

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: Jun 13, 2026
  • Questions and Answers: 359
  • 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