Black Friday Special Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 70percent

HashiCorp Terraform-Associate-003 HashiCorp Certified: Terraform Associate (003) (HCTA0-003) Exam Practice Test

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

Question 1

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

Options:

A.

True

B.

False

Question 2

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

Question 3

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

Options:

A.

Cloud infrastructure Most Voted

B.

The .terraform directory

C.

The execution plan

D.

State file

E.

Terraform code

Question 4

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

Options:

A.

True

B.

False

Question 5

Only the user that generated a plan may apply it.

Options:

A.

True

B.

False

Question 6

Why does this backend configuration not follow best practices?

Options:

A.

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

B.

You should use the local enhanced storage backend whenever possible

C.

You should not store credentials in Terraform configuration

D.

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

Question 7

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 8

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

Options:

A.

value

B.

description

C.

default

D.

sensitive

Question 9

A developer on your team is going lo 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]

Question 10

Which command must you first run before performing further Terraform operations in a working directory?

Options:

A.

terraform import

B.

terraform workspace

C.

terraform plan

D.

terraform init

Question 11

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.

Question 12

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 13

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

Options:

A.

True

B.

False

Question 14

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 15

Which command lets you experiment with terraform expressions?

Options:

A.

Terraform console

B.

Terraform validate

C.

Terraform env

D.

Terraform test

Question 16

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 17

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

Question 18

Select the command that doesn’t cause Terraform to refresh its state.

Options:

A.

Terraform destroy

B.

Terraform apply

C.

Terraform plan

D.

Terraform state list

Question 19

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

Options:

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

Question 20

Which of the following is not a key principle of infrastructure as code?

Options:

A.

Self-describing infrastructure

B.

Idempotence

C.

Versioned infrastructure

D.

Golden images

Question 21

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

Question 22

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

Question 23

What does this code do?

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

Question 24

In a Terraform Cloud workpace linked to a version control repository speculative plan rum start automatically commit changes to version control.

Options:

A.

True

B.

False

Question 25

It is best practice to store secret data in the same version control repository as your Terraform configuration.

Options:

A.

True

B.

False

Question 26

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 27

The public Terraform Module Registry is free to use.

Options:

A.

True

B.

False

Question 28

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

Options:

A.

True

B.

False

Question 29

Once you configure a new Terraform backend with a terraform code block, which command(s) should you use to migrate the state file?

Options:

A.

terraform destroy, then terraform apply

B.

terraform init

C.

terraform push

D.

terraform apply

Question 30

Which of these commands makes your code more human readable?

Options:

A.

Terraform validate

B.

Terraform output

C.

Terraform show

D.

Terraform fmt

Question 31

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

Question 32

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

Question 33

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

Options:

A.

True

B.

False

Question 34

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

A)

B)

C)

D)

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 35

Multiple team members are collaborating on infrastructure using Terraform and want to format the* Terraform code following standard Terraform-style convention.

How should they ensure the code satisfies conventions?

Options:

A.

Terraform automatically formats configuration on terraform apply

B.

Run terraform validate prior to executing terraform plan or terraform apply

C.

Use terraform fmt

D.

Replace all tabs with spaces

Question 36

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

Question 37

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

Question 38

What is one disadvantage of using dynamic blocks in Terraform?

Options:

A.

Dynamic blocks can construct repeatable nested blocks

B.

Terraform will run more slowly

C.

They cannot be used to loop through a list of values

D.

They make configuration harder to read and understand

Question 39

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

Options:

A.

True

B.

False

Question 40

How would you reference the volume IDs associated with the ebs_block_device blocks in this configuration?

Options:

A.

aws_instance.example.ebs_block_device[sda2,sda3).volume_id

B.

aws_lnstance.example.ebs_block_device.[*].volume_id

C.

aws_lnstance.example.ebs_block_device.volume_ids

D.

aws_instance.example-ebs_block_device.*.volume_id

Question 41

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 42

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

Question 43

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

Options:

A.

Plan

B.

Import

C.

Alidate

D.

Init

E.

apply

Question 44

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 45

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

Options:

A.

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

B.

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

C.

Run terraform output ip_address to view the result

D.

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

Question 46

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

Options:

A.

True

B.

False

Question 47

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

Options:

A.

Source = “module/consul’’

B.

Source = ‘’githhub.comicrop/example’’

C.

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

D.

Source = ‘’hasicrop/consul/aws’’

Question 48

What does state looking accomplish?

Options:

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

Question 49

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

Options:

A.

True

B.

False

Question 50

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

Options:

A.

They can securely store cloud credentials.

B.

They have role-based access controls.

C.

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

D.

You must use the CLI to switch between workspaces.

Question 51

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

Question 52

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

Options:

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

Question 53

Which of the following is not a valid source path for specifying a module?

Options:

A.

source - "github.com/hashicorp/examplePref-ul.0.8M

B.

source = "./module?version=vl.6.0"

C.

source - "hashicorp/consul/aws"

D.

source - "./module"

Question 54

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 55

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.

Question 56

terraform plan updates your state file.

Options:

A.

True

B.

False

Question 57

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

Options:

A.

True

B.

False

Question 58

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

Options:

A.

True

B.

False