New Year Sale Special - Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: mxmas70

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

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

Question # 4

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

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

Full Access
Question # 5

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

A.

True

B.

False

Full Access
Question # 6

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

A.

Copy the sensitive variables into your Terraform code

B.

Store the sensitive variables in a secure_varS.tf file

C.

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

D.

Pass variables to Terraform with a -var flag

Full Access
Question # 7

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

A.

provider

B.

state

C.

data

D.

resource

Full Access
Question # 8

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?

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

Full Access
Question # 9

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

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

A.

Source = “module/consul’’

B.

Source = ‘’githhub.comicrop/example’’

C.

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

D.

Source = ‘’hasicrop/consul/aws’’

Full Access
Question # 11

Which of the following is not true of Terraform providers?

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

Full Access
Question # 12

Your root module contains a variable namednum_servers. Which is the correct way to pass its value to a child module with an input namedservers?

A.

servers = num_servers

B.

servers = var(num_servers)

C.

servers = var.num_servers

D.

servers = ${var.num_servers}

Full Access
Question # 13

You want to use API tokens and other secrets within your team's Terraform workspaces. Where does HashiCorp recommend you store these sensitive values? (Pick 3)

A.

In a plaintext document on a shared drive.

B.

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

C.

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

D.

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

E.

In HashiCorp Vault.

Full Access
Question # 14

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

A.

Cloud infrastructure

B.

The .terraform directory

C.

The execution plan

D.

State file

E.

Terraform code

Full Access
Question # 15

Parent modules can always access a child module's variable values.

A.

True

B.

False

Full Access
Question # 16

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 terraform apply again immediately afterward without changing any Terraform code?

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.

Nothing

Full Access
Question # 17

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

A.

With two spaces.

B.

With four spaces.

C.

With three spaces.

D.

With a tab.

Full Access
Question # 18

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

terraform destroy is the only way to remove infrastructure.

A.

True

B.

False

Full Access
Question # 20

Which command(s) adds existing resources in a public cloud into Terraform state?

A.

terraform init

B.

terraform plan

C.

terraform refresh

D.

terraform import

E.

All of these

Full Access
Question # 21

A terraform apply can not _________ infrastructure.

A.

change

B.

destroy

C.

provision

D.

import

Full Access
Question # 22

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

A.

data

B.

local

C.

resource

D.

provider

Full Access
Question # 23

Terraform configuration can only call modules from the public registry.

A.

True

B.

False

Full Access
Question # 24

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

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

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

A.

True

B.

False

Full Access
Question # 27

Which two steps are required to provision new infrastructure in the Terraform workflow?

(Pick the 2 correct responses below)

A.

import

B.

plan

C.

validate

D.

init

E.

apply

Full Access
Question # 28

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

All modules published on the official Terraform Registry are maintained and tested by HashiCorp.

A.

True

B.

False

Full Access
Question # 30

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

A.

True

B.

False

Full Access
Question # 31

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

A.

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

B.

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

C.

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

D.

You cannot target specific resources for the operation.

E.

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

Full Access
Question # 32

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

A.

Automated infrastructure deployment visualization

B.

Automatic backups

C.

A web-based user interface (Ul)

D.

Remote state storage

Full Access
Question # 33

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

A.

In an environment variable

B.

On the disk

C.

In the remote backend or Terraform Cloud

D.

In memory

Full Access
Question # 34

How can you trigger a run in a Terraform Cloud workspace that is connected to a Version Control System (VCS) repository?

A.

Only Terraform Cloud organization owners can set workspace variables on VCS connected workspaces

B.

Commit a change to the VCS working directory and branch that the Terraform Cloud workspace is connected to

C.

Only Terraform Cloud organization owners can approve plans in VCS connected workspaces

D.

Only members of a VCS organization can open a pull request against repositories that are connected to Terraform Cloud workspaces

Full Access
Question # 35

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

A.

True

B.

False

Full Access
Question # 36

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

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

A.

Edit your state file to scrub out the sensitive data

B.

Always store your secrets in a secrets.tfvars file

C.

Delete the state file every time you run Terraform

D.

Store the state in an encrypted backend

Full Access
Question # 38

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

How is terraform import run?

A.

As a part of terraform init

B.

As a part of terraform plan

C.

As a part of terraform refresh

D.

By an explicit call

E.

All of the above

Full Access
Question # 40

Define the purpose of state in Terraform.

A.

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

B.

State lets you enforce resource configurations that relate to compliance policies

C.

State stores variables and lets you quickly reuse existing code

D.

State codifies the dependencies of related resources

Full Access
Question # 41

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

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

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

A.

True

B.

False

Full Access
Question # 44

_______backends support state locking.

A.

All

B.

No

C.

Some

D.

Only local

Full Access
Question # 45

Which configuration consistency errors does terraform validate report?

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

Full Access
Question # 46

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

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

Full Access
Question # 47

A senior admin accidentally deleted some of your cloud instances. What will Terraform do when you run terraform apply?

A.

Tear down the entire workspace's infrastructure and rebuild it.

B.

Build a completely brand new set of infrastructure.

C.

Rebuild only the instances that were deleted.

D.

Stop and generate an error message about the missing instances.

Full Access
Question # 48

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

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

A.

Versioning

B.

A Graphical User Interface

C.

Reusability of code

D.

Automation

Full Access
Question # 50

Module variable assignments are inherited from the parent module and you do not need to explicitly set them.

A.

True

B.

False

Full Access
Question # 51

How does Terraform manage most dependencies between resources?

A.

Terraform will automatically manage most resource dependencies

B.

Using the depends_on parameter

C.

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

D.

The order that resources appear in Terraform configuration indicates dependencies

Full Access
Question # 52

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

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

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

A.

True

B.

False

Full Access
Question # 55

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

A.

data

B.

local

C.

resource

D.

provider

Full Access
Question # 56

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

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

Full Access
Question # 57

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

A.

True

B.

False

Full Access
Question # 58

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

A.

True

B.

False

Full Access
Question # 59

You should run terraform fnt to rewrite all Terraform configurations within the current working directory to conform to Terraform-style conventions.

A.

True

B.

False

Full Access
Question # 60

Only the user that generated a plan may apply it.

A.

True

B.

False

Full Access
Question # 61

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

Which of these are benefits of using Sentinel with HCP Terraform/Terraform Cloud? (Pick the 3 correct responses)

A.

You can enforce a list of approved AWS AMIs.

B.

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

C.

You can check out and check in cloud access keys.

D.

Policy-as-code can enforce security best practices.

Full Access
Question # 63

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

Why does this backend configuration not follow best practices?

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

Full Access
Question # 65

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

A.

Terraform can only source providers from the internet

B.

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

C.

You can create a provider for your API if none exists

D.

All providers are part of the Terraform core binary

Full Access
Question # 66

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

A.

True

B.

False

Full Access
Question # 67

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

The_________determines how Terraform creates, updates, or delete resources.

A.

Terraform configuration

B.

Terraform provisioner

C.

Terraform provider

D.

Terraform core

Full Access
Question # 69

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

A.

True

B.

False

Full Access
Question # 70

You can configure Terraform to log to a file using the TF_LOG environment variable.

A.

True

B.

False

Full Access
Question # 71

Which command add existing resources into Terraform state?

A.

Terraform init

B.

Terraform plan

C.

Terraform refresh

D.

Terraform import

E.

All of these

Full Access
Question # 72

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

A.

value

B.

description

C.

default

D.

sensitive

Full Access
Question # 73

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

A.

True

B.

False

Full Access
Question # 74

Which statement describes a goal of Infrastructure as Code (IaC)?

A.

A pipeline process to test and deliver software.

B.

Write once, run anywhere.

C.

The programmatic configuration of resources.

D.

Defining a vendor-agnostic API.

Full Access
Question # 75

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