Weekend Sale - 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

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?

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

Full Access
Question # 5

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

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

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

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

A.

True

B.

False

Full Access
Question # 9

Terraform providers are part of the Terraform core binary.

A.

True

B.

False

Full Access
Question # 10

What are some benefits of using Sentinel with Terraform Cloud/Terraform Cloud? Choose three correct answers.

A.

You can restrict specific resource configurations, such as disallowing the use of CIDR=0.0.0.0/0.

B.

You can check out and check in cloud access keys

C.

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

D.

Policy-as-code can enforce security best practices

E.

You can enforce a list of approved AWS AMIs

Full Access
Question # 11

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

A.

True

B.

False

Full Access
Question # 12

Which of these actions are forbidden when the Terraform state file is locked? (Pick the 3 correct responses)

A.

terraform apply

B.

terraform state list

C.

terraform destroy

D.

terraform fmt

Full Access
Question # 13

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

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

A.

apply

B.

destroy

C.

Both of these are correct.

D.

Neither of these are correct.

Full Access
Question # 15
A.

version ~> 3.1

B.

version >= 3.1

C.

version = ">= 3.1"

Full Access
Question # 16

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

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)

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 18

Where can Terraform not load a provider from?

A.

Plugins directory

B.

Provider plugin chance

C.

Official HashCrop Distribution on releases.hashcrop.com

D.

Source code

Full Access
Question # 19

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

A.

Subfolder within a workspace

B.

Generic git repository

C.

Terraform Cloud private registry

D.

Public Terraform module registry

Full Access
Question # 20

Which command doesnotcause Terraform to refresh its state?

A.

terraform state list

B.

terraform plan

C.

terraform apply

D.

terraform destroy

Full Access
Question # 21

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

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

A.

True

B.

False

Full Access
Question # 23

Which of the following can you do with terraform plan? (Pick 2 correct responses)

A.

Schedule Terraform to run at a planned time in the future.

B.

View the execution plan and check if the changes match your expectations.

C.

Save a generated execution plan to apply later.

D.

Execute a plan in a different workspace.

Full Access
Question # 24

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

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

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

You have developed a new cloud-based service that uses proprietary APIs and want to use Terraform to create, manage, and delete users from the service. How can Terraform interact with the service?

A.

Terraform can manage users for any service that is hosted on a public cloud provider.

B.

Develop and publish a custom provider to interact with the service using its proprietary APIs.

Full Access
Question # 28

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

A.

list

B.

array

C.

nap

D.

string

Full Access
Question # 29

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?

A.

Artifactory

B.

Amazon S3

C.

Terraform Cloud

D.

Git

Full Access
Question # 30

You want to know from which paths Terraform is loading providers referenced in your Terraform configuration (* files). You need to enable additional logging messages to find this out. Which of the following would achieve this?

A.

Set verbose for each provider in your Terraform configuration

B.

Set the environment variable TF_LOG_TRACE

C.

Set the environment variable TF_LOG_PATH

D.

Set the environment variable TF_log_TRACE

Full Access
Question # 31

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

A.

True

B.

False

Full Access
Question # 32

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?

A.

Local values

B.

Count arguments

C.

Collection functions

D.

Dynamic blocks

Full Access
Question # 33

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

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?

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]

Full Access
Question # 35
A.

True

B.

False

Full Access
Question # 36

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

Full Access
Question # 38

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

A.

terraform destroy, then terraform apply

B.

terraform init

C.

terraform push

D.

terraform apply

Full Access
Question # 39

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

A.

A Terraform provider

B.

Environment variables

C.

A -var flag

D.

secure string

Full Access
Question # 40

When should you write Terraform configuration files for existing infrastructure that you want to start managing with Terraform?

A.

You can import infrastructure without corresponding Terraform code

B.

Terraform will generate the corresponding configuration files for you

C.

Before you run terraform Import

D.

After you run terraform import

Full Access
Question # 41

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

A.

True

B.

False

Full Access
Question # 42

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

A.

terraform fmt -write-false

B.

terraform fmt -list -recursive

C.

terraform fmt -check -recursive

D.

terraform fmt -check

Full Access
Question # 43

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

A.

True

B.

False

Full Access
Question # 44

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.

A.

True

B.

False

Full Access
Question # 45
A.

True

B.

False

Full Access
Question # 46

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

A.

Terraform state show ‘ provider_type_name

B.

Terraform state list

C.

Terraform get provider_type_name

D.

Terraform state list provider_type_name

Full Access
Question # 47

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

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

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

A.

True

B.

False

Full Access
Question # 50

A Terraform provider is NOT responsible for:

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

Full Access
Question # 51

What does the default "local" Terraform backend store?

A.

tfplan files

B.

State file

C.

Provider plugins

D.

Terraform binary

Full Access
Question # 52

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

A.

True

B.

False

Full Access
Question # 53

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

In a Terraform Cloud workspace linked to a version control repository, speculative plan runs start automatically when you merge or commit changes to version control.

A.

True

B.

False

Full Access
Question # 55

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

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

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

A.

True

B.

False

Full Access
Question # 58

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

A.

terraform import

B.

terraform workspace

C.

terraform plan

D.

terraform init

Full Access
Question # 59

Which Terraform command checks that your configuration syntax is correct?

A.

terraform validate

B.

terraform init

C.

terraform show

D.

terraform fmt

Full Access
Question # 60

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

A terraform apply can not _________ infrastructure.

A.

change

B.

destroy

C.

provision

D.

import

Full Access
Question # 62

As a member of an operations team that uses infrastructure as code (lac) practices, you are tasked with making a change to an infrastructure stack running in a public cloud. Which pattern would follow laC best practices for making a change?

A.

Make the change via the public cloud API endpoint

B.

Clone the repository containing your infrastructure code and then run the code

C.

Use the public cloud console to make the change after a database record has been approved

D.

Make the change programmatically via the public cloud CLI

E.

Submit a pull request and wait for an approved merge of the proposed changes

Full Access
Question # 63

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

A.

True

B.

False

Full Access
Question # 64

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

When using multiple configuration of the same Terraform provider, what meta-argument must you include in any non-default provider configurations?

A.

Alias

B.

Id

C.

Depends_on

D.

name

Full Access
Question # 66

Terraform configuration can only call modules from the public registry.

A.

True

B.

False

Full Access
Question # 67

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

Terraform providers are always installed from the Internet.

A.

True

B.

False

Full Access
Question # 69

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

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

A.

True

B.

False

Full Access
Question # 71

What is terraform plan -refresh-only intended to detect?

A.

Terraform configuration code changes

B.

Corrupt state files

C.

State file drift

D.

Empty state files

Full Access
Question # 72

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

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

If a module declares a variable without a default value, you must pass the value of the variable within the module block when you call the module in your configuration.

A.

True

B.

False

Full Access