Summer Special Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: myex65

Home > HashiCorp > Terraform Associate > Terraform-Associate-003

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

Question # 4

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

A.

Lets you version, reuse, and share infrastructure configuration

B.

Provisions the same resources at a lower cost

C.

Secures your credentials

D.

Reduces risk of operator error

E.

Prevents manual modifications to your resources

Full Access
Question # 5

You cannot install third party plugins using terraform init.

A.

True

B.

False

Full Access
Question # 6

Which of these statements about Terraform Cloud workspaces is false?

A.

They have role-based access controls

B.

You must use the CLI to switch between workspaces

C.

Plans and applies can be triggered via version control system integrations

D.

They can securely store cloud credentials

Full Access
Question # 7

Terraform variable names are saved in the state file.

A.

True

B.

False

Full Access
Question # 8

Which of these actions will prevent two Terraform runs from changing the same state file at the same time?

A.

Refresh the state after running Terraform

B.

Delete the state before running Terraform

C.

Configure state locking for your state backend

D.

Run Terraform with parallelism set to 1

Full Access
Question # 9

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

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

A.

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

B.

Nothing

C.

Terraform will error

D.

Terraform will destroy the virtual machine

Full Access
Question # 10

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

A.

Using the destroy command with auto-approve.

B.

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

C.

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

Full Access
Question # 11

What is one disadvantage of using dynamic blocks in Terraform?

A.

Dynamic blocks can construct repeatable nested blocks

B.

Terraform will run more slowly

C.

They cannot be used to loop through a list of values

D.

They make configuration harder to read and understand

Full Access
Question # 12

Which of these are features of HCP Terraform/Terraform Cloud? (Pick the 2 correct responses)

A.

Automatic backups of configuration and state.

B.

Remote state storage.

C.

Automated infrastructure deployment visualization.

D.

A web-based user interface (UI).

Full Access
Question # 13

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

A.

With a tab

B.

With two spaces

C.

With four spaces

D.

With three spaces

Full Access
Question # 14

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

A.

True

B.

False

Full Access
Question # 15

terraform destroy is the only way to remove infrastructure.

A.

True

B.

False

Full Access
Question # 16

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

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

Full Access
Question # 17

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

A.

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

B.

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

C.

Run terraform output ip_address to view the result

D.

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

Full Access
Question # 18

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

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.

Full Access
Question # 19

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

A.

Set

B.

Map

C.

Tuple

D.

list

Full Access
Question # 20

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

A.

State locking

B.

Version control

C.

Provider constraints

D.

Remote backends

Full Access
Question # 21

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

A.

True

B.

False

Full Access
Question # 22

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

A.

version >= 3.1

B.

version = “>= 3.1”

C.

version ~> 3.1

Full Access
Question # 23

Which command doesnotcause Terraform to refresh its state?

A.

terraform state list

B.

terraform plan

C.

terraform apply

D.

terraform destroy

Full Access
Question # 24

Terraform encrypts sensitive values stored in your state file.

A.

True

B.

False

Full Access
Question # 25

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

A.

Required input variables

B.

Optional inputs variables and default values

C.

Outputs

D.

All of the above

E.

None of the above

Full Access
Question # 26

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

A.

terraform get

B.

terraform refresh

C.

terraform import

D.

terraform init

Full Access
Question # 27

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

A.

Terraform plan –refresh-only

B.

Terraform show –json

C.

Terraform apply –lock-false

D.

Terraform plan target-state

Full Access
Question # 28

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

Which command should you use to show all the resources that will be deleted? (Pick the 2 correct responses)

A.

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

B.

Runterraform show -destroy.

C.

Runterraform state rm *.

Full Access
Question # 29

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

A.

The resource block

B.

The data source block

C.

The terraform block

D.

The provider block

Full Access
Question # 30

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

A.

TF_LOG_PAIH

B.

TF_LOG

C.

TF_VAR_log_path

D.

TF_VAR_log_level

Full Access
Question # 31

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

A.

Self-service infrastructure deployment.

B.

Modify a count parameter to scale resources.

C.

API-driven workflows.

D.

Troubleshoot via a Linux diff command.

E.

Public cloud console configuration workflows.

Full Access
Question # 32

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

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

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

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

A.

Terraform will recreate the load balancer.

B.

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

C.

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

D.

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

Full Access
Question # 33

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

A.

list

B.

array

C.

nap

D.

string

Full Access
Question # 34

When does Sentinel enforce policy logic during a Terraform Cloud run?

A.

Before the plan phase

B.

During the plan phase

C.

Before the apply phase

D.

After the apply phase

Full Access
Question # 35

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

A.

True

B.

False

Full Access
Question # 36

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

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.

Full Access
Question # 37

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

A.

True

B.

False

Full Access
Question # 38

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

A.

True

B.

False

Full Access
Question # 39

How would you output returned values from a child module in the Terraform CLI output?

A.

Declare the output in the root configuration

B.

Declare the output in the child module

C.

Declare the output in both the root and child module

D.

None of the above

Full Access
Question # 40

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

A.

Plan

B.

Import

C.

Alidate

D.

Init

E.

apply

Full Access
Question # 41

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

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

A.

Terraform will use the version recorded in your lock file

B.

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

C.

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

D.

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

Full Access
Question # 42

What does this code do?

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

A.

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

B.

Requires any version of the AWS provider >= 3.0

C.

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

D.

Requires any version of the AWS provider > 3.0

Full Access
Question # 43

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

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

What Terraform function could you use to select the largest number from the list?

A.

top(numcpus)

B.

max(numcpus)

C.

ceil (numcpus)

D.

hight[numcpus]

Full Access
Question # 44

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

A.

True

B.

False

Full Access
Question # 45

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

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.

Full Access
Question # 46

If you manually destroy infrastructure, what is the best practice reflecting this change in Terraform?

A.

Run terraform refresh

B.

It will happen automatically

C.

Manually update the state fire

D.

Run terraform import

Full Access
Question # 47

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

A.

True

B.

False

Full Access
Question # 48

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

A.

True

B.

False

Full Access
Question # 49

What does terraform import do?

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

Full Access
Question # 50

You have multiple team members collaborating on infrastructure as code (IaC) using Terraform, and want to apply formatting standards for readability.

How can you format Terraform HCL (HashiCorp Configuration Language) code according to standard Terraform style convention?

A.

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

B.

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

C.

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

D.

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

Full Access
Question # 51

You modified your Terraform configuration and run Terraform plan to review the changes. Simultaneously, your teammate manually modified the infrastructure component you are working on. Since you already ran terraform plan locally, the execution plan for terraform apply will be the same.

A.

True

B.

False

Full Access
Question # 52

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

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

Full Access
Question # 53

You have declared a variable called var.list which is a list of objects that all have an attribute id . Which options will produce a list of the IDs? Choose two correct answers.

A.

[ var.list [ * ] , id ]

B.

[ for o in var.list : o.Id ]

C.

var.list[*].id

D.

{ for o in var.llst : o => o.id }

Full Access
Question # 54

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

A.

True

B.

False

Full Access
Question # 55

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

A.

chomp

B.

join

C.

slice

D.

split

Full Access
Question # 56

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?

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

Full Access
Question # 57

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

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 58

Terraform installs its providers during which phase?

A.

Plan

B.

Init

C.

Refresh

D.

All of the above

Full Access
Question # 59

terraform validate confirms thesyntaxof Terraform files.

A.

True

B.

False

Full Access
Question # 60

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

A.

In the /tmp directory.

B.

In the .terraform sub-directory.

C.

In memory.

D.

They are not cached.

Full Access
Question # 61

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

A.

True

B.

False

Full Access
Question # 62

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

A.

True

B.

False

Full Access
Question # 63

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

A.

version

B.

version = "3.1"

C.

version: 3.1

D.

version - 3.1

Full Access
Question # 64

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

resource "aws_vpc" "main" {

name = "test"

}

A.

VPC

B.

test

C.

main

D.

aws

Full Access
Question # 65

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

A.

resource.kubernetes_namespace.example.name

B.

kubernetes_namespace.example.name

C.

data.kubernetes.namespace.name

D.

kubernetes_namespace.test.name

Full Access
Question # 66

If a module declares a variable with a default, that variable must also be defined within the module.

A.

True

B.

False

Full Access
Question # 67

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?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 68

What does state looking accomplish?

A.

Prevent accidental Prevent accident deletion of the state file

B.

Blocks Terraform commands from modifying, the state file

C.

Copies the state file from memory to disk

D.

Encrypts any credentials stored within the state file

Full Access
Question # 69

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

A.

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

B.

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

C.

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

D.

None of the above.

Full Access
Question # 70

Which task does terraform init not perform?

A.

Validates all required variables are present

B.

Sources any modules and copies the configuration locally

C.

Connects to the backend

D.

Sources all providers used in the configuration and downloads them

Full Access
Question # 71

A provider configuration block is required in every Terraform configuration.

Example:

A.

True

B.

False

Full Access