Summer Sale 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: exams65

ExamsBrite Dumps

HashiCorp Certified: Terraform Associate (004) (HCTA0-004) Question and Answers

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

Last Update Jul 26, 2026
Total Questions : 366

We are offering FREE Terraform-Associate-004 HashiCorp exam questions. All you do is to just go and sign up. Give your details, prepare Terraform-Associate-004 free exam questions and then go for complete pool of HashiCorp Certified: Terraform Associate (004) (HCTA0-004) test questions that will help you more.

Terraform-Associate-004 pdf

Terraform-Associate-004 PDF

$36.75  $104.99
Terraform-Associate-004 Engine

Terraform-Associate-004 Testing Engine

$43.75  $124.99
Terraform-Associate-004 PDF + Engine

Terraform-Associate-004 PDF + Testing Engine

$57.75  $164.99
Questions 1

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

Options:

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.

Discussion 0
Questions 2

Terraform configuration can only call modules from the public registry.

Options:

A.  

True

B.  

False

Discussion 0
Questions 3

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

Options:

A.  

True

B.  

False

Discussion 0
Questions 4

When should you use the terraform force-unlock command?

Options:

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.

Discussion 0
Questions 5

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

Options:

A.  

True

B.  

False

Discussion 0
Questions 6

Which of these are features of HCP Terraform/Terraform Cloud? Pick the 2 correct responses below.

Options:

A.  

Automated infrastructure deployment visualization.

B.  

A web-based user interface (UI).

C.  

Automatic backups of configuration and state.

D.  

Remote state storage.

Discussion 0
Questions 7

Your configuration contains a module block that references a module from the Terraform Registry and sets the version argument to 1.0. You just published a new version of the module and updated your configuration to point to version 1.1.

Which command must be run to install the new version?

Options:

A.  

terraform init

B.  

terraform modules

C.  

terraform plan

D.  

terraform apply

Discussion 0
Questions 8

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

Options:

A.  

data

B.  

local

C.  

resource

D.  

provider

Discussion 0
Questions 9

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?

Options:

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}

Discussion 0
Questions 10

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?

Options:

A.  

TF_LOG_PAIH

B.  

TF_LOG

C.  

TF_VAR_log_path

D.  

TF_VAR_log_level

Discussion 0
Questions 11

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

Options:

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

Discussion 0
Questions 12

Which Terraform command checks that your configuration syntax is correct?

Options:

A.  

terraform validate

B.  

terraform init

C.  

terraform show

D.  

terraform fmt

Discussion 0
Questions 13

You created infrastructure outside the Terraform workflow that you now want to manage using Terraform. Which command brings the infrastructure into Terraform state?

Options:

A.  

terraform get

B.  

terraform refresh

C.  

terraform import

D.  

terraform init

Discussion 0
Questions 14

Your team adopts AWS CloudFormation as the standardized method for provisioning public cloud resources.

Which scenario presents a challenge for your team?

Options:

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.

Discussion 0
Questions 15

You have provisioned some virtual machines (VMs) on Google Cloud Platform (GCP) using the gcloud command line tool. However, you are standardizing with Terraform and want to manage these VMs using Terraform instead. What are the two things you must do to achieve this? Choose two correct answers.

Options:

A.  

Run the terraform Import-gcp command

B.  

Write Terraform configuration for the existing VMs

C.  

Use the terraform import command for the existing VMs

D.  

Provision new VMs using Terraform with the same VM names

Discussion 0
Questions 16

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

Options:

A.  

resource.kubernetes_namespace.example.name

B.  

kubernetes_namespace.example.name

C.  

data.kubernetes.namespace.name

D.  

kubernetes_namespace.test.name

Discussion 0
Questions 17

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

Options:

A.  

terraform graph

B.  

terraform show

C.  

terraform refresh

D.  

terraform output

Discussion 0
Questions 18

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

Options:

A.  

The resource ID

B.  

Provider

C.  

The target resource address

D.  

Backend

Discussion 0
Questions 19

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

Options:

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.

Discussion 0
Questions 20

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

Options:

A.  

Plan

B.  

Import

C.  

Alidate

D.  

Init

E.  

apply

Discussion 0
Questions 21

You are writing a child Terraform module that provisions an AWS instance. You want to reference the IP address returned by the child module in the root configuration. You name the instance resource " main ' .

Which of these is the correct way to define the output value?

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 22

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?

Options:

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.

Discussion 0
Questions 23

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?

Options:

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.

Discussion 0
Questions 24

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?

Options:

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.

Discussion 0
Questions 25

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

Options:

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.

Discussion 0
Questions 26

What does this code do?

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

Options:

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

Discussion 0
Questions 27

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.

Options:

A.  

True

B.  

False

Discussion 0
Questions 28

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

Options:

A.  

Run all Terraform commands on a shared server or container.

B.  

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

C.  

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

D.  

None of the above.

Discussion 0
Questions 29

How does Terraform determine dependencies between resources?

Options:

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

Discussion 0
Questions 30

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?

Options:

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

Discussion 0
Questions 31

What kind of configuration block will create an infrastructure object with settings specified within the block?

Options:

A.  

provider

B.  

state

C.  

data

D.  

resource

Discussion 0
Questions 32

You ' ve used Terraform to deploy a virtual machine and a database. You want to replace this virtual machine instance with an identical one without affecting the database. What is the best way to achieve this using Terraform?

Options:

A.  

Use the terraform state rm command to remove the VM from state file

B.  

Use the terraform taint command targeting the VMs then run terraform plan and terraform apply

C.  

Use the terraform apply command targeting the VM resources only

D.  

Delete the Terraform VM resources from your Terraform code then run terraform plan and terraform apply

Discussion 0
Questions 33

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

Options:

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.

Discussion 0
Questions 34

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

Options:

A.  

value

B.  

description

C.  

default

D.  

sensitive

Discussion 0
Questions 35

The_________determines how Terraform creates, updates, or delete resources.

Options:

A.  

Terraform configuration

B.  

Terraform provisioner

C.  

Terraform provider

D.  

Terraform core

Discussion 0
Questions 36

Which of the following module source paths does not specify a remote module?

Options:

A.  

Source = “module/consul’’

B.  

Source = ‘’githhub.comicrop/example’’

C.  

Source =’’git@github.com:hasicrop/example.git’’

D.  

Source = ‘’hasicrop/consul/aws’’

Discussion 0
Questions 37

What is the purpose of state locking in a remote backend?

Options:

A.  

Encrypts the state in the remote backend.

B.  

Requires every instance of Terraform to use the same provider version.

C.  

Creates a backup of the state file in a secure location.

D.  

Ensures only one instance of Terraform can modify the state at a time.

Discussion 0
Questions 38

terraform validate confirms thesyntaxof Terraform files.

Options:

A.  

True

B.  

False

Discussion 0
Questions 39

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

Options:

A.  

Provider

B.  

Resource ID

C.  

Resource address

D.  

Path

Discussion 0
Questions 40

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.

Which reference would you use?

Options:

A.  

data.vsphere_datacenter.dc.id

B.  

data.vsphere_datacenter.dc

C.  

data.dc.id

D.  

vsphere_datacenter.dc.id

Discussion 0
Questions 41

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

Options:

A.  

Import

B.  

Apply

C.  

Validate

D.  

Plan

E.  

Init

Discussion 0
Questions 42

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.

Options:

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

Discussion 0
Questions 43

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?

Options:

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.

Discussion 0
Questions 44

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

Options:

A.  

True

B.  

False

Discussion 0
Questions 45

A provider configuration block is required in every Terraform configuration.

Example:

Options:

A.  

True

B.  

False

Discussion 0
Questions 46

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

Options:

A.  

Terraform will terminate and recreate the VM.

B.  

Terraform will create another duplicate VM.

C.  

Terraform will apply the VM to the state file.

D.  

Terraform will take no action.

Discussion 0
Questions 47

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

Options:

A.  

True

B.  

False

Discussion 0
Questions 48

What is the purpose of the terraform.lock.hcl file in Terraform?

Options:

A.  

There is no such file.

B.  

Storing references to workspaces, which are locked.

C.  

Preventing Terraform runs from occurring.

D.  

Tracking specific provider dependencies.

Discussion 0
Questions 49

What functionality do providers offer in Terraform? (Pick the 3 correct responses below.)

Options:

A.  

Group a collection of Terraform configuration files that map to a single state file.

B.  

Provision resources for on-premises infrastructure services.

C.  

Provision resources for public cloud infrastructure services.

D.  

Interact with cloud provider APIs.

E.  

Enforce security and compliance policies.

Discussion 0
Questions 50

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

resource " aws_vpc " " main " {

name = " test "

}

Options:

A.  

VPC

B.  

test

C.  

main

D.  

aws

Discussion 0
Questions 51

Which configuration consistency errors does terraform validate report?

Options:

A.  

Terraform module isn ' t the latest version

B.  

Differences between local and remote state

C.  

Declaring a resource identifier more than once

D.  

A mix of spaces and tabs in configuration files

Discussion 0
Questions 52

Which of these commands makes your code more human readable?

Options:

A.  

Terraform validate

B.  

Terraform output

C.  

Terraform show

D.  

Terraform file

Discussion 0
Questions 53

If a module declares a variable without a default value, you must pass the value of the variable within the module block when you call the module in your configuration.

Options:

A.  

True

B.  

False

Discussion 0
Questions 54

terraform validate confirms that your infrastructure matches the Terraform state file.

Options:

A.  

True

B.  

False

Discussion 0
Questions 55

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

Options:

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

Discussion 0
Questions 56

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

Options:

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.

Discussion 0
Questions 57

What is a Terraform provider not responsible for?

Options:

A.  

Provisioning infrastructure in multiple cloud providers.

B.  

Managing actions to take based on resource differences.

C.  

Managing resources and data sources based on an API.

D.  

Understanding API interactions with a hosted service.

Discussion 0
Questions 58

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?

Options:

A.  

Data.vsphere_datacenter.DC.id

B.  

Vsphere_datacenter.dc.id

C.  

Data,dc,id

D.  

Data.vsphere_datacenter,dc

Discussion 0
Questions 59

Which Terraform collection type stores values as key/value pairs?

Options:

A.  

map

B.  

set

C.  

list

D.  

tuple

Discussion 0
Questions 60

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

Options:

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.

Discussion 0
Questions 61

Exhibit:

Root module configuration:

output " vnet_id " {

value = module.my_network.vnet_id

}

Error:

Error: Reference to undeclared output value

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

12: value = module.my_network.vnet_id

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

Options:

A.  

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

B.  

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

C.  

Change the referenced value to my_network.outputs.vnet_id.

D.  

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

Discussion 0
Questions 62

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

Options:

A.  

azurerm

B.  

azurerm_resource_group

C.  

ev

D.  

test

Discussion 0
Questions 63

Which task does terraform init not perform?

Options:

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.

Discussion 0
Questions 64

You can execute terraform fmt to standardize all Terraform configurations within the current working directory to Terraform’s canonical format and style.

Options:

A.  

True

B.  

False

Discussion 0
Questions 65

A data source is shown in the exhibit below.

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

}

}

Options:

A.  

data.aws_ami.web.id

B.  

aws_ami.web.id

C.  

web.id

D.  

data.web.id

Discussion 0
Questions 66

What functionality do providers offer in Terraform?(Pick 3 correct responses)

Options:

A.  

Interact with cloud provider APIs.

B.  

Provision resources for on-premises infrastructure services.

C.  

Group a collection of Terraform configuration files that map to a single state file.

D.  

Provision resources for public cloud infrastructure services.

E.  

Enforce security and compliance policies.

Discussion 0
Questions 67

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

Options:

A.  

version

B.  

version = " 3.1 "

C.  

version: 3.1

D.  

version - 3.1

Discussion 0
Questions 68

Which situation will return an error when you run terraform validate?

Options:

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.

Discussion 0
Questions 69

Only the user that generated a plan may apply it.

Options:

A.  

True

B.  

False

Discussion 0
Questions 70

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

Options:

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.

Discussion 0
Questions 71

In a HCP Terraform/Terraform Cloud workspace linked to a version control repository, speculative plan runs start automatically when you merge or commit changes to version control.

Options:

A.  

True

B.  

False

Discussion 0
Questions 72

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?

Options:

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

Discussion 0
Questions 73

terraform validate uses provider APIs to verify your infrastructure settings.

Options:

A.  

True

B.  

False

Discussion 0
Questions 74

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?

Options:

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

Discussion 0
Questions 75

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?

Options:

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.

Discussion 0
Questions 76

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?

Options:

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

Discussion 0
Questions 77

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

Options:

A.  

You want Terraform to ignore a resource on the next apply

B.  

You want Terraform to destroy all the infrastructure in your workspace

C.  

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

D.  

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

Discussion 0
Questions 78

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

Options:

A.  

Terraform configuration code changes

B.  

Corrupt state files

C.  

State file drift

D.  

Empty state files

Discussion 0
Questions 79

What does terraform import do?

Options:

A.  

Imports existing resources into the state file

B.  

Imports all infrastructure from a given cloud provider

C.  

Imports a new Terraform module

D.  

Imports clean copies of tainted resources

E.  

None of the above

Discussion 0
Questions 80

Which command doesnotcause Terraform to refresh its state?

Options:

A.  

terraform state list

B.  

terraform plan

C.  

terraform apply

D.  

terraform destroy

Discussion 0
Questions 81

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?

Options:

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.

Discussion 0
Questions 82

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

Options:

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

Discussion 0
Questions 83

You cannot install third party plugins using terraform init.

Options:

A.  

True

B.  

False

Discussion 0
Questions 84

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?

Options:

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

Discussion 0
Questions 85

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?

Options:

A.  

variable " billing_dept " { type = default}

B.  

variable " billing_dept " { default =}

C.  

variable " billing_dept " { type = optional(string)}

D.  

variable " billing_dept " { optional = true}

Discussion 0
Questions 86

Which of the following is not a valid string function in Terraform?

Options:

A.  

chomp

B.  

join

C.  

slice

D.  

split

Discussion 0
Questions 87

Which of these statements about HCP Terraform/Terraform Cloud workspaces is false?

Options:

A.  

They can securely store cloud credentials.

B.  

They have role-based access controls.

C.  

Plans and applies can be triggered via version control system integrations.

D.  

You must use the CLI to switch between workspaces.

Discussion 0
Questions 88

Which of the following is not true of Terraform providers?

Options:

A.  

An individual person can write a Terraform Provider

B.  

A community of users can maintain a provider

C.  

HashiCorp maintains some providers

D.  

Cloud providers and infrastructure vendors can write, maintain, or collaborate on Terraform

E.  

providers

F.  

None of the above

Discussion 0
Questions 89

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)

Options:

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.

Discussion 0
Questions 90

You can reference a resource created with for_each using a Splat ( *) expression.

Options:

A.  

True

B.  

False

Discussion 0
Questions 91

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.

Options:

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.

Discussion 0
Questions 92

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?

Options:

A.  

aws_ami.web.id

B.  

web.id

C.  

data.aws_ami.web.id

D.  

data.web.id

Discussion 0
Questions 93

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

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 94

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

Options:

A.  

Run terraform refresh.

B.  

Run terraform init -upgrade.

C.  

Run terraform apply -upgrade.

D.  

Upgrade your version of Terraform.

Discussion 0
Questions 95

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

Options:

A.  

Alias

B.  

Id

C.  

Depends_on

D.  

name

Discussion 0
Questions 96

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

Options:

A.  

True

B.  

False

Discussion 0
Questions 97

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?

Options:

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.

Discussion 0
Questions 98

You much initialize your working directory before running terraform validate.

Options:

A.  

True

B.  

False

Discussion 0
Questions 99

You have created a main.tf Terraform configuration consisting of an application server, a database and a load balanced. You ran terraform apply and Terraform created all of the resources successfully.

Now you realize that you do not actually need the load balancer, so you run terraform destroy without any flags. What will happen?

Options:

A.  

Terraform will prompt you to pick which resource you want to destroy

B.  

Terraform will destroy the application server because it is listed first in the code

C.  

Terraform will prompt you to confirm that you want to destroy all the infrastructure

D.  

Terraform will destroy the main, tf file

E.  

Terraform will immediately destroy all the infrastructure

Discussion 0
Questions 100

Which is not a benefit of adopting IaC (Infrastructure as Code)?

Options:

A.  

Reusability of code

B.  

Automation

C.  

A GUI (Graphical User Interface)

D.  

Versioning

Discussion 0
Questions 101

After creating a new Terraform configuration, your configuration passes terraform validate but returns an “Access Denied” error from the cloud provider when running terraform plan.

Why did terraform validate not catch this issue?

Options:

A.  

Variables are only applied and validated during terraform plan, so terraform validate assumed defaults and returned a success message.

B.  

The working directory was not initialized, so the cloud provider plugin was unavailable when running the terraform validate command.

C.  

terraform validate only checks whether a configuration is syntactically correct and internally consistent, and it does not communicate with providers.

D.  

The remote backend was not configured, so terraform validate could not load the state and detect the missing credentials.

Discussion 0
Questions 102

Why does this backend configuration not follow best practices?

Options:

A.  

An alias meta-argument should be included in backend blocks whenever possible

B.  

You should use the local enhanced storage backend whenever possible

C.  

You should not store credentials in Terraform configuration

D.  

The backend configuration should contain multiple credentials so that more than one user can execute terraform plan and terraform apply

Discussion 0
Questions 103

A resource block is shown in the Exhibit space of this page. What is the provider for this resource?

Options:

A.  

test

B.  

vpc

C.  

aws

D.  

main

Discussion 0
Questions 104

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?

Options:

A.  

List

B.  

Object

C.  

Map

D.  

Terraform does not support complex input variables of different types

Discussion 0
Questions 105

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

Options:

A.  

Public repository on GitHub.

B.  

Public Terraform Registry.

C.  

Internally hosted VCS (Version Control System) platform.

D.  

Private repository on GitHub.

Discussion 0
Questions 106

What is one disadvantage of using dynamic blocks in Terraform?

Options:

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

Discussion 0
Questions 107

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

Options:

A.  

Cloud infrastructure

B.  

The .terraform directory

C.  

The execution plan

D.  

State file

E.  

Terraform code

Discussion 0
Questions 108

terraform plan updates your state file.

Options:

A.  

True

B.  

False

Discussion 0
Questions 109

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

Options:

A.  

True

B.  

False

Discussion 0