Spring Sale 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: save70

Free and Premium HashiCorp Terraform-Associate-004 Dumps Questions Answers

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

Question 1

You ate making changes to existing Terraform code to add some new infrastructure. When is the best time to run terraform validate?

Options:

A.

After you run terraform apply so you can validate your infrastructure

B.

Before you run terraform apply so you can validate your provider credentials

C.

Before you run terraform plan so you can validate your code syntax

D.

After you run terraform plan so you can validate that your state file is consistent with your infrastructure

Buy Now
Question 2

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)

Options:

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 3

What command can you run to generateDOT (Graphviz)formatted data to visualize Terraform dependencies?

Options:

A.

terraform refresh

B.

terraform graph

C.

terraform output

D.

terraform show

Question 4

What is modified when executing Terraform inrefresh-only mode?

Options:

A.

Your Terraform configuration.

B.

Your Terraform plan.

C.

Your state file.

D.

Your cloud infrastructure.

Question 5

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

Options:

A.

True

B.

False

Question 6

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

Options:

A.

Automated infrastructure deployment visualization

B.

Automatic backups

C.

A web-based user interface (Ul)

D.

Remote state storage

Question 7

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

Options:

A.

With two spaces.

B.

With four spaces.

C.

With three spaces.

D.

With a tab.

Question 8

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

Options:

A.

With a tab

B.

With two spaces

C.

With four spaces

D.

With three spaces

Question 9

Which task does terraform init not perform?

Options:

A.

Validates all required variables are present

B.

Sources any modules and copies the configuration locally

C.

Connects to the backend

D.

Sources all providers used in the configuration and downloads them

Question 10

What does the default " local " Terraform backend store?

Options:

A.

tfplan files

B.

State file

C.

Provider plugins

D.

Terraform binary

Question 11

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

Options:

A.

True

B.

False

Question 12

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

Question 13

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

Question 14

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

Options:

A.

Required input variables

B.

Optional inputs variables and default values

C.

Outputs

D.

All of the above

E.

None of the above

Question 15

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

Options:

A.

True

B.

False

Question 16

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

Options:

A.

True

B.

False

Question 17

Terraform configuration can only call modules from the public registry.

Options:

A.

True

B.

False

Question 18

Before you can use a remote backend, you must first execute terra-form init.

Options:

A.

True

B.

False

Question 19

Terraform providers are part of the Terraform core binary.

Options:

A.

True

B.

False

Question 20

You are working on some new application features and you want to spin up a copy of your production deployment to perform some quick tests. In order to avoid having to configure a new state backend, what open source Terraform feature would allow you create multiple states but still be associated with your current code?

Options:

A.

Terraform data sources

B.

Terraform local values

C.

Terraform modules

D.

Terraform workspaces

E.

None of the above

Question 21

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?

Options:

A.

file( " id_rsa.pub " )

B.

templaTefil( " id_rsa.pub " )

C.

filebase64( " id_rsa.pub " )

D.

fileset < " id_rsa.pub " )

Question 22

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

Options:

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 23

When should you use the force-unlock command?

Options:

A.

You have a high priority change

B.

Automatic unlocking failed

C.

apply failed due to a state lock

D.

You see a status message that you cannot acquire the lock

Question 24

Terraform providers are always installed from the Internet.

Options:

A.

True

B.

False

Question 25

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

Question 26

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

Options:

A.

version

B.

lifecycle

C.

count

D.

source

Question 27

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.

Question 28

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 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 29

Which backend does the Terraform CLI use by default?

Options:

A.

Depends on the cloud provider configured

B.

HTTP

C.

Remote

D.

Terraform Cloud

E.

Local

Question 30

When you initialize Terraform, where does it cache modules from the public Terraform Registry?

Options:

A.

In the /tmp directory.

B.

In the .terraform sub-directory.

C.

In memory.

D.

They are not cached.

Question 31

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?

Options:

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 32

Which of the following can you do with terraform plan? (Pick 2 correct responses)

Options:

A.

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

B.

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

C.

Save a generated execution plan to apply later.

D.

Execute a plan in a different workspace.

Question 33

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.

Question 34

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.

Question 35

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

Question 36

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

Options:

A.

True

B.

False

Question 37

Where does HashiCorp recommend you store API tokens and other secrets within your team’s Terraform workspaces?

Pick the three correct responses below.

Options:

A.

In a plaintext document on a shared drive.

B.

In HashiCorp Vault.

C.

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

D.

In an environment variable and referenced with TF_VAR_variablename.

E.

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

Question 38

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

Options:

A.

Optional

B.

Impossible

C.

Mandatory

D.

Discouraged

Question 39

Which command add existing resources into Terraform state?

Options:

A.

Terraform init

B.

Terraform plan

C.

Terraform refresh

D.

Terraform import

E.

All of these

Question 40

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

Options:

A.

Set

B.

Map

C.

Tuple

D.

list

Question 41

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

Question 42

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?

A)

B)

C)

D)

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 43

You have just developed a new Terraform configuration for two virtual machines with a cloud provider. You would like to create the infrastructure for the first time.

Which Terraform command should you runfirst?

Options:

A.

terraform apply

B.

terraform init

C.

terraform plan

D.

terraform show

Question 44

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

Question 45

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)

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.

Question 46

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.

Question 47

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

Options:

A.

True

B.

False

Question 48

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.

Options:

A.

True

B.

False

Question 49

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

Options:

A.

terraform show

B.

terraform plan

C.

terraform validate

D.

terraform get

Question 50

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.

Options:

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 51

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 " {

default = " "

}

B.

variable " billing_dept " {

optional = true

}

C.

variable " billing_dept " {

type = optional(string)

}

D.

variable " billing_dept " {

type = default

}

Question 52

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

Options:

A.

True

B.

False

Question 53

What is an advantage of immutable infrastructure?

Options:

A.

In-place infrastructure upgrades

B.

Quicker infrastructure upgrades

C.

Automatic infrastructure upgrades

D.

Less complex infrastructure upgrades

Question 54

The -refresh-only parameter will update your state file when used with terraform plan.

Options:

A.

True

B.

False

Question 55

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?

Options:

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 56

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

Options:

A.

Set verbose for each provider in your Terraform configuration

B.

Set the environment variable TF_LOG_TRACE

C.

Set the environment variable TF_LOG_PATH

D.

Set the environment variable TF_log_TRACE

Question 57

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

Options:

A.

True

B.

False

Question 58

You need to destroy all of the resources in your Terraform workspace, except for aws_instance.ubuntu[1], which you want to keep. How can you tell Terraform to stop managing that specific resource without destroying it?

Options:

A.

Remove the resource block from your configuration.

B.

Change the value of the count argument on the resource.

C.

Run terraform state rm aws_instance.ubuntu[1].

D.

Use a moved block.

Question 59

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

Options:

A.

True

B.

False

Question 60

Terraform variable names are saved in the state file.

Options:

A.

True

B.

False

Question 61

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.

Question 62

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

Question 63

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

Options:

A.

Terraform state list

B.

Terraform destroy

C.

Terraform validate

D.

Terraform validate

E.

Terraform for

F.

Terraform apply

Question 64

A Terraform provider is NOT responsible for:

Options:

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 65

Exhibit:

resource " aws_instance " " example " {

ami = " ami-0a123456789abcdef "

instance_type = " t3.micro "

}

You are updating a child module with the resource block shown in the exhibit. The public_ip attribute of the resource needs to be accessible to the parent module. How do you meet this requirement?

Options:

A.

Create an output in the child module.

B.

Add a data source to the parent module.

C.

Add an import block to the parent module.

D.

Create a local value in the child module.

Question 66

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

Options:

A.

State locking

B.

Version control

C.

Provider constraints

D.

Remote backends

Question 67

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.

Question 68

Terraform configuration can only import modules from the public registry.

Options:

A.

True

B.

False

Question 69

The public Terraform Module Registry is free to use.

Options:

A.

True

B.

False

Question 70

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.

Question 71

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

Options:

A.

data

B.

local

C.

resource

D.

provider

Question 72

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 "

}

Options:

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 73

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

Question 74

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

Options:

A.

True

B.

False

Question 75

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

Options:

A.

True

B.

False

Question 76

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

Options:

A.

The resource block

B.

The data source block

C.

The terraform block

D.

The provider block

Question 77

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

Options:

A.

test

B.

google

C.

compute_instance

D.

main

Question 78

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

Question 79

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

Options:

A.

True

B.

False

Question 80

If you don’t use the local Terraform backend, where else can Terraform save resource state?

Options:

A.

In a remote location configured in the terraform block, such as HCP Terraform or a cloud storage system.

B.

In a remote location configured in the -terraformrc file, such as HCP Terraform or a cloud storage system.

C.

In memory.

D.

In an environment variable.

Question 81

What does terraform destroy do?

Options:

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 82

Terraform configuration (including any module references) can contain only one Terraform provider type.

Options:

A.

True

B.

False

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.

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

Question 84

Which of these ate secure options for storing secrets for connecting to a Terraform remote backend? Choose two correct answers.

Options:

A.

A variable file

B.

Defined in Environment variables

C.

Inside the backend block within the Terraform configuration

D.

Defined in a connection configuration outside of Terraform

Question 85

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

Options:

A.

Dynamic

B.

For_each

C.

Nesting

D.

repeated.

Question 86

You are using a networking module in your Terraform configuration with the name label my-network. In your main configuration you have the following code:

When you run terraform validate, you get the following error:

What must you do to successfully retrieve this value from your networking module?

Options:

A.

Change the reference value to my-network,outputs,vmet_id

B.

Define the attribute vmet_id as a variable in the networking modeule

C.

Define the attribute vnet_id as an output in the networking module

D.

Change the reference value module.my,network,outputs,vnet_id

Question 87

The terraform output command shows outputs from child modules.

Options:

A.

True

B.

False

Question 88

Terraformrequiresthe Go runtime as a prerequisite for installation.

Options:

A.

True

B.

False

Question 89

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

Options:

A.

version ~ > 3.1

B.

version > = 3.1

C.

version = " > = 3.1 "

Question 90

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

Options:

A.

Provider

B.

Resource ID

C.

Resource address

D.

Path

Question 91

You can access state stored with the local backend by using terraform_remote_state data source.

Options:

A.

True

B.

False

Question 92

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

Options:

A.

apply

B.

destroy

C.

Both of these are correct.

D.

Neither of these are correct.

Question 93

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

Options:

A.

True

B.

False

Question 94

Exhibit:

resource " kubernetes_namespace " " example " {

name = " test "

}

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

Options:

A.

kubernetes_namespace.example,name

B.

kubernetes_namespace.test.name

C.

data.kubernetes_namespace.name

D.

resource.kubernetes_namespace.example.name

Question 95

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