Summer Special Flat 65% Limited Time Discount offer - Ends in 0d 00h 00m 00s - Coupon code: netdisc

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

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

Testing Engine

  • Product Type: Testing Engine
$43.75  $124.99

PDF Study Guide

  • Product Type: PDF Study Guide
$38.5  $109.99
Question 1

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

Question 2

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

Options:

A.

apply

B.

destroy

C.

Both of these are correct.

D.

Neither of these are correct.

Question 3

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

Options:

A.

True

B.

False

Question 4

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

Options:

A.

Before the plan phase

B.

During the plan phase

C.

Before the apply phase

D.

After the apply phase

Question 5

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

Options:

A.

Optional

B.

Impossible

C.

Mandatory

D.

Discouraged

Question 6

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

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 7

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

Options:

A.

Prevents manual modifications to your resources

B.

Lets you version, reuse, and share infrastructure configuration

C.

Secures your credentials

D.

Provisions the same resources at a lower cost

E.

Reduces risk of operator error

Question 8

_______backends support state locking.

Options:

A.

All

B.

No

C.

Some

D.

Only local

Question 9

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 10

A module can always refer to all variables declared in its parent module.

Options:

A.

True

B.

False

Question 11

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

Which command should you use to show all of the resources that mil be deleted? Choose two correct answers.

Options:

A.

Run terraform state rm ‘

B.

Run terraform show :destroy

C.

Run terraform destroy and it will first output all the resource that will be deleted before prompting for approval

D.

Run terraform plan .destory

Question 12

Terraform variable names are saved in the state file.

Options:

A.

True

B.

False

Question 13

What is the name of the default file where Terraform stores the state?

Type your answer in the field provided. The text field is not case-sensitive and all variations of the correct answer are accepted.

Options:

Question 14

How does the Terraform cloud integration differ from other state backends such as S3, Consul,etc?

Options:

A.

It can execute Terraform runs on dedicated infrastructure in Terraform Cloud

B.

It doesn't show the output of a terraform apply locally

C.

It is only arable lo paying customers

D.

All of the above

Question 15

You've used Terraform to deploy a virtual machine and a database. You want to replace this virtual machine instance with an identical one without affecting the database. What is the best way to achieve this using Terraform?

Options:

A.

Use the terraform state rm command to remove the VM from state file

B.

Use the terraform taint command targeting the VMs then run terraform plan and terraform apply

C.

Use the terraform apply command targeting the VM resources only

D.

Delete the Terraform VM resources from your Terraform code then run terraform plan and terraform apply

Question 16

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?

Options:

A.

servers = num_servers

B.

servers = var(num_servers)

C.

servers = var.num_servers

D.

servers = ${var.num_servers}

Question 17

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

Question 18

Which of the following statements about Terraform modules is not true?

Options:

A.

Modules can call other modules

B.

A module is a container for one or more resources

C.

Modules must be publicly accessible

D.

You can call the same module multiple times

Question 19

Your DevOps team is currently using the local backend for your Terraform configuration. You would like to move to a remote backend to store the state file in a central location. Which of the following backends would not work?

Options:

A.

Artifactory

B.

Amazon S3

C.

Terraform Cloud

D.

Git

Question 20

Your risk management organization requires that new AWS S3 buckets must be private and encrypted at rest. How can Terraform Cloud automatically and proactively enforce this security control?

Options:

A.

Auditing cloud storage buckets with a vulnerability scanning tool

B.

By adding variables to each Terraform Cloud workspace to ensure these settings are always enabled

C.

With an S3 module with proper settings for buckets

D.

With a Sentinel policy, which runs before every apply

Question 21

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 22

If a DevOps team adopts AWS CloudFormation as their standardized method for provisioning public cloud resoruces, which of the following scenarios poses a challenge for this team?

Options:

A.

The team is asked to manage a new application stack built on AWS-native services

B.

The organization decides to expand into Azure wishes to deploy new infrastructure

C.

The team is asked to build a reusable code based that can deploy resources into any AWS region

D.

The DevOps team is tasked with automating a manual, web console-based provisioning.

Question 23

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

Options:

A.

Automatic backups of configuration and state.

B.

Remote state storage.

C.

Automated infrastructure deployment visualization.

D.

A web-based user interface (UI).

Question 24

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 25

Which task does terraform init not perform?

Options:

A.

Validates all required variables are present

B.

Sources any modules and copies the configuration locally

C.

Connects to the backend

D.

Sources all providers used in the configuration and downloads them

Question 26

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

Options:

A.

True

B.

False

Question 27

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

Options:

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.

Question 28

A Terraform provider is NOT responsible for:

Options:

A.

Exposing resources and data sources based on an APUI

B.

Managing actions to take based on resources differences

C.

Understanding API interactions with some service

D.

Provisioning infrastructure in multiple

Question 29

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

Options:

A.

True

B.

False

Question 30

A provider configuration block is required in every Terraform configuration.

Example:

Options:

A.

True

B.

False

Question 31

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

Question 32

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

Options:

A.

True

B.

False

Question 33

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 34

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

Options:

A.

terraform refresh

B.

terraform graph

C.

terraform output

D.

terraform show

Question 35

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

Options:

A.

True

B.

False

Question 36

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

Question 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 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 38

All modules published on the official Terraform Module Registry have been verified by HasihCorp.

Options:

A.

True

B.

False

Question 39

Terraformrequiresthe Go runtime as a prerequisite for installation.

Options:

A.

True

B.

False

Question 40

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

Question 41

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

Options:

A.

True

B.

False

Question 42

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

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

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

Options:

A.

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

B.

Define the attribute vmet_id as a variable in the networking modeule

C.

Define the attribute vnet_id as an output in the networking module

D.

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

Question 43

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

Options:

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.

Question 44

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

Options:

A.

True

B.

False

Question 45

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.

Options:

A.

True

B.

False

Question 46

Which command lets you experiment with terraform expressions?

Options:

A.

Terraform console

B.

Terraform validate

C.

Terraform env

D.

Terraform test

Question 47

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

Options:

A.

State locking

B.

Version control

C.

Provider constraints

D.

Remote backends

Question 48

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 49

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

Question 50

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 51

Which method for sharing Terraform modules fulfills the following criteria:

    Keeps the module configurations confidential within your organization.

    Supports Terraform's semantic version constraints.

    Provides a browsable directory of your modules.

Options:

A.

A Git repository containing your modules.

B.

Public Terraform module registry.

C.

A subfolder within your workspace.

D.

HCP Terraform/Terraform Cloud private registry.

Question 52

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

Options:

A.

True

B.

False

Question 53

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 54

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 55

You ate creating a Terraform configuration which needs to make use of multiple providers, one for AWS and one for Datadog. Which of the following provider blocks would allow you to do this?

A)

B)

C)

D)

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 56

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 57

When do changes invoked by terraform apply take effect?

Options:

A.

After Terraform has updated the state file

B.

Once the resource provider has fulfilled the request

C.

Immediately

D.

None of the above are correct

Question 58

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

Options:

A.

test

B.

google

C.

compute_instance

D.

main

Question 59

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

Question 60

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 61

You just upgraded the version of a provider in an existing Terraform project. What do you need to do to install the new provider?

Options:

A.

Run terraform refresh.

B.

Run terraform init -upgrade.

C.

Run terraform apply -upgrade.

D.

Upgrade your version of Terraform.

Question 62

terraform validate uses provider APIs to verify your infrastructure settings.

Options:

A.

True

B.

False

Question 63

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

Options:

A.

True

B.

False

Question 64

Terraform providers are part of the Terraform core binary.

Options:

A.

True

B.

False

Question 65

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

Question 66

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

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

Question 67

Which of these commands makes your code more human readable?

Options:

A.

Terraform validate

B.

Terraform output

C.

Terraform show

D.

Terraform file