Pre-Winter Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: agile70

ExamsBrite Dumps

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

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

Last Update Oct 12, 2026
Total Questions : 385

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

$31.5  $104.99
Terraform-Associate-004 Engine

Terraform-Associate-004 Testing Engine

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

Terraform-Associate-004 PDF + Testing Engine

$49.5  $164.99
Questions 1

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?

Options:

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]

Discussion 0
Questions 2

You have a list of numbers representing the number of free CPU cores on each virtual cluster:

numcpus = [18, 3, 7, 11, 2]

Which Terraform built-in function would you use to select the largest number from the list?

Options:

A.  

top(numcpus)

B.  

max(numcpus)

C.  

high[numcpus]

D.  

ceil(numcpus)

Discussion 0
Questions 3

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

Options:

A.  

list

B.  

array

C.  

nap

D.  

string

Discussion 0
Questions 4

Terraform encrypts sensitive values stored in your state file.

Options:

A.  

True

B.  

False

Discussion 0
Questions 5

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 6

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

Options:

A.  

A subdirectory of your home directory named .terraform.d

B.  

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

C.  

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

D.  

A subdirectory of your configuration named .terraform

Discussion 0
Questions 7

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 8

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

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.

Discussion 0
Questions 9

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.

Options:

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

Discussion 0
Questions 10

Which of the following is availableonlyinHCP Terraform workspacesandnot in Terraform CLI?

Options:

A.  

Dry runs with terraform plan.

B.  

Secure variable storage.

C.  

Using one workspace ' s state as a data source for another.

D.  

Support for multiple cloud providers.

Discussion 0
Questions 11

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 12

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?

Options:

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.

Discussion 0
Questions 13

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 14

You must use different Terraform commands depending on the cloud provider you use.

Options:

A.  

True

B.  

False

Discussion 0
Questions 15

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 16

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

Discussion 0
Questions 17

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

Discussion 0
Questions 18

Define the purpose of state in Terraform.

Options:

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

Discussion 0
Questions 19

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

Options:

A.  

terraform fmt -write-false

B.  

terraform fmt -list -recursive

C.  

terraform fmt -check -recursive

D.  

terraform fmt -check

Discussion 0
Questions 20

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

Options:

A.  

Using environment variables

B.  

Specifying the login credentials in the provider block

C.  

Setting credentials as Terraform variables

D.  

None of the above

Discussion 0
Questions 21

A provider configuration block is required in every Terraform configuration.

Example:

Options:

A.  

True

B.  

False

Discussion 0
Questions 22

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 23

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 24

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 25

Which option cannot be used to keep secrets out of Terraform configuration files?

Options:

A.  

A Terraform provider

B.  

Environment variables

C.  

A -var flag

D.  

secure string

Discussion 0
Questions 26

As a developer, you want to ensure your plugins are up to date with the latest versions. Which Terraform command should you use?

Options:

A.  

terraform refresh -upgrade

B.  

terraform apply -upgrade

C.  

terraform init -upgrade

D.  

terraform providers -upgrade

Discussion 0
Questions 27

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

Options:

A.  

True

B.  

False

Discussion 0
Questions 28

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?

Options:

A.  

var.sizes[0]

B.  

var.sizes[1]

C.  

var.sizes[2]

D.  

var.sizes[3]

Discussion 0
Questions 29

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

Options:

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.

Discussion 0
Questions 30

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

Options:

A.  

terraform state list ‘provider_type.name’

B.  

terraform state show ‘provider_type.name’

C.  

terraform get ‘provider_type.name’

D.  

terraform state list

Discussion 0
Questions 31

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 32

How is terraform import run?

Options:

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

Discussion 0
Questions 33

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 34

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

Options:

A.  

True

B.  

False

Discussion 0
Questions 35

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?

Options:

A.  

Local values

B.  

Count arguments

C.  

Collection functions

D.  

Dynamic blocks

Discussion 0
Questions 36

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

Options:

A.  

value

B.  

description

C.  

default

D.  

sensitive

Discussion 0
Questions 37

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 38

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

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

Options:

A.  

Append pref=v1.0.0 argument to the source path

B.  

Add version = “1.0.0” parameter to module block

C.  

Nothing modules stored on GitHub always default to version 1.0.0

Discussion 0
Questions 39

You much initialize your working directory before running terraform validate.

Options:

A.  

True

B.  

False

Discussion 0
Questions 40

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 "

Discussion 0
Questions 41

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 42

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

Options:

A.  

True

B.  

False

Discussion 0
Questions 43

terraform destroy is the only way to remove infrastructure with Terraform.

Options:

A.  

True

B.  

False

Discussion 0
Questions 44

How does Terraform manage most dependencies between resources?

Options:

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

Discussion 0
Questions 45

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?

Options:

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.

Discussion 0
Questions 46

The exhibit shows part of a configuration that you have been asked to update.

The name of the Azure Virtual Network must be set to the name of the resource group, followed by a dash and the word vnet.

Exhibit

data " azurerm_resource_group " " example " {

name = var.resource_group_name

}

resource " azurerm_virtual_network " " example " {

name = ________________________

}

Which expression fulfills this requirement?

Options:

A.  

" ${azurerm_resource_group.example.name}-vnet "

B.  

concat(data.azurerm_resource_group.example.name, " vnet " )

C.  

join( " - " , [var.resource_group_name, " vnet " ])

D.  

" ${data.azurerm_resource_group.example.name}-vnet "

Discussion 0
Questions 47

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 48

Where can Terraform not load a provider from?

Options:

A.  

Plugins directory

B.  

Provider plugin chance

C.  

Official HashCrop Distribution on releases.hashcrop.com

D.  

Source code

Discussion 0
Questions 49

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

Options:

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.

Discussion 0
Questions 50

When should you use the force-unlock command?

Options:

A.  

When 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 you cannot acquire the lock.

Discussion 0
Questions 51

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?

Options:

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.

Discussion 0
Questions 52

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

Options:

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

Discussion 0
Questions 53

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

How can you enable additional logging to see this information?

Options:

A.  

Set the environment variable TF_VAR_log=TRACE.

B.  

Set the environment variable TF_LOG_PATH.

C.  

Set the environment variable TF_LOG=TRACE.

D.  

Set verbose logging for each provider in your Terraform configuration.

Discussion 0
Questions 54

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 55

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 56

You decide to move a Terraform state file to Amazon S3 from another location. You write the code below into a file called backend.tf.

Which command will migrate your current state file to the new S3 remote backend?

Options:

A.  

terraform state

B.  

terraform init

C.  

terraform push

D.  

terraform refresh

Discussion 0
Questions 57

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

Options:

A.  

Terraform plan –refresh-only

B.  

Terraform show –json

C.  

Terraform apply –lock-false

D.  

Terraform plan target-state

Discussion 0
Questions 58

Which is a benefit of the Terraform state file?

Options:

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.

Discussion 0
Questions 59

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

Options:

A.  

True

B.  

False

Discussion 0
Questions 60

Which command must you run before you run a plan or apply for the first time?

Options:

A.  

terraform init

B.  

terraform workspace

C.  

terraform validate

D.  

terraform import

Discussion 0
Questions 61

Which option does not keep secret variable values out of Terraform configuration files?

Options:

A.  

Pass the secret values via a -var flag.

B.  

Pass the secret values as environment variables.

C.  

Store the secrets in a shared credentials file.

D.  

Configure the variable as sensitive.

Discussion 0
Questions 62

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.

Discussion 0
Questions 63

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.

Discussion 0
Questions 64

terraform init creates an example main.tf file in the current directory.

Options:

A.  

True

B.  

False

Discussion 0
Questions 65

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

Options:

A.  

Initialize a configured backend.

B.  

Create template configuration files.

C.  

Load required provider plugins.

D.  

Retrieve the source code for all referenced modules.

Discussion 0
Questions 66

Which of the following can you do with terraform plan?

Pick the two correct responses below.

Options:

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.

Discussion 0
Questions 67

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 68

How can terraform plan aid in the development process?

Options:

A.  

It validates your expectations against the execution plan without permanently modifying state.

B.  

It reconciles Terraform state against deployed resources and permanently modifies state using the current status of deployed resources.

C.  

It initializes your working directory containing Terraform configuration files.

D.  

It formats your Terraform configuration files.

Discussion 0
Questions 69

You have just upgraded the version constraint of a provider in an existing Terraform configuration. What command will install the new provider version?

Options:

A.  

Run terraform init -upgrade.

B.  

Run terraform apply.

C.  

Run terraform plan.

D.  

Run terraform refresh.

Discussion 0
Questions 70

A resource block is shown in the Exhibit space of this page. How would you reference the name value of the second instance of this resource?

Options:

A.  

aws_instance.web[2].name

B.  

aws_instance.web.*.name

C.  

aws_instance.web[l].name

D.  

aws_instance.web[l]

E.  

element(aws_instance.web, 2)

Discussion 0
Questions 71

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

Options:

A.  

True

B.  

False

Discussion 0
Questions 72

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

Pick 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.

Discussion 0
Questions 73

How can terraform plan aid in the development process?

Options:

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

Discussion 0
Questions 74

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

Options:

A.  

A web-based user interface (Ul)

B.  

Automated infrastructure deployment visualization

C.  

Automatic backups

D.  

Remote state storage

Discussion 0
Questions 75

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

Options:

A.  

True

B.  

False

Discussion 0
Questions 76

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 77

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

Discussion 0
Questions 78

You previously applied your Terraform configuration to create infrastructure in your cloud provider. Your configuration uses the local backend, and you accidentally deleted your terraform.tfstate file.

What does Terraform do the next time you run terraform apply?

Options:

A.  

Delete the old resources and create them again.

B.  

Return an error that it cannot find your state file.

C.  

Find the resources it previously created and recreate the state file.

D.  

Create all the resources again without deleting the old resources.

Discussion 0
Questions 79

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 80

A module block is shown in the Exhibit space of this page. When you use a module block to reference a module from the Terraform Registry such as the one in the example, how do you specify version 1.0.0 of the module?

Options:

A.  

Append ?ref=v1.0.0 argument to the source path.

B.  

You cannot. Modules stored on the public Terraform Registry do not support versioning.

C.  

Add a version = " 1.0.0 " attribute to the module block.

D.  

Nothing. Modules stored on the public Terraform module Registry always default to version 1.0.0.

Discussion 0
Questions 81

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

Discussion 0
Questions 82

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 83

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

Discussion 0
Questions 84

Which of these is stored in the .terraform directory?

Options:

A.  

The dependency lock file

B.  

Providers and modules

C.  

The state file

D.  

Terraform configuration files

Discussion 0
Questions 85

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

Discussion 0
Questions 86

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

Options:

A.  

True

B.  

False

Discussion 0
Questions 87

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 88

What task does the terraform import command perform?

Options:

A.  

Imports resources from one Terraform state file to another.

B.  

Imports existing resources into Terraform ' s state file.

C.  

Imports a new Terraform module into Terraform ' s state file.

D.  

Imports all infrastructure from the configured cloud provider.

E.  

Imports provider configuration from one state file to another.

Discussion 0
Questions 89

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

Options:

A.  

source

B.  

count

C.  

version

D.  

lifecycle

Discussion 0
Questions 90

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

Options:

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

Discussion 0
Questions 91

Does terraform init create an example main.tf file in the current directory?

Options:

A.  

True

B.  

False

Discussion 0
Questions 92

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 93

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?

Options:

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.

Discussion 0
Questions 94

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

Options:

A.  

resource

B.  

provider

C.  

data

D.  

locals

Discussion 0
Questions 95

What does Terraform use to deploy infrastructure for different cloud providers?

Options:

A.  

Vendors ' CLI tools

B.  

Vendors ' user interfaces

C.  

Vendor-specific providers

D.  

Custom APIs developed by HashiCorp

Discussion 0
Questions 96

Which method for sharing Terraform configurations fulfills the following criteria:

1. Keeps the configurations confidential within your organization

2. Support Terraform’s semantic version constrains

3. Provides a browsable directory

Options:

A.  

Subfolder within a workspace

B.  

Generic git repository

C.  

Terraform Cloud private registry

D.  

Public Terraform module registry

Discussion 0
Questions 97

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 98

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

Options:

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

Discussion 0
Questions 99

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.

Discussion 0
Questions 100

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

Discussion 0
Questions 101

terraform validate confirms thesyntaxof Terraform files.

Options:

A.  

True

B.  

False

Discussion 0
Questions 102

Any user can publish modules to the public Terraform Module Registry.

Options:

A.  

True

B.  

False

Discussion 0
Questions 103

A developer accidentally launched a VM (virtual machine) outside of the Terraform workflow and ended up with two servers with the same name. They don ' t know which VM Terraform manages but do have a list of all active VM IDs.

Which of the following methods could you use to discover which instance Terraform manages?

Options:

A.  

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

B.  

Update the code to include outputs for the ID of all VMs, then run terraform plan to view the outputs

C.  

Run terraform taint/code on all the VMs to recreate them

D.  

Use terraform refresh/code to find out which IDs are already part of state

Discussion 0
Questions 104

The public Terraform Module Registry is free to use.

Options:

A.  

True

B.  

False

Discussion 0
Questions 105

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

Options:

A.  

Required input variables

B.  

Outputs

C.  

Optional input variables and default values

D.  

All of these are provided

Discussion 0
Questions 106

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 107

A terraform apply can not _________ infrastructure.

Options:

A.  

change

B.  

destroy

C.  

provision

D.  

import

Discussion 0
Questions 108

Which statements are true? Choose two correct answers.

Options:

A.  

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

B.  

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

C.  

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

D.  

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

Discussion 0
Questions 109

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?

Options:

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.

Discussion 0
Questions 110

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

Discussion 0
Questions 111

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 112

You want to create a string that is a combination of a generated random_id and a variable, and reuse that string several times in your configuration.

What is the simplest correct way to implement this without repeating the random_id and variable?

Options:

A.  

Use a data source.

B.  

Use a module.

C.  

Add a local value.

D.  

Add an output value.

Discussion 0
Questions 113

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 114

How can a ticket-based system slow down infrastructure provisioning and limit the ability to scale? Choose two correct answers.

Options:

A.  

End-users have to request infrastructure changes

B.  

Ticket based systems generate a full audit trail of the request and fulfillment process

C.  

Users can access catalog of approved resources from drop down list in a request form

D.  

The more resources your organization needs, the more tickets your infrastructure team has to process

Discussion 0
Questions 115

Which are benefits of migrating from a local state backend to a remote backend? (Pick the 2 correct responses below.)

Options:

A.  

Guarantees that configuration drift cannot occur for the managed infrastructure.

B.  

Eliminates the need to manage credentials when deploying infrastructure to multiple cloud providers.

C.  

Faster plan and apply execution because the state is cached locally on the cloud provider.

D.  

State locking that allows multiple team members to safely work on the same infrastructure.

E.  

The ability to enable server-side encryption at rest.

Discussion 0