Spring Sale - Special 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 70dumps

Terraform-Associate-004 Questions and Answers

Question # 6

When does Terraform create the .terraform.lock.hc1 file?

A.

After your first terraform plan

B.

After your first terraform apply

C.

After your first terraform init

D.

When you enable state locking

Full Access
Question # 7

The terraform output command shows outputs from child modules.

A.

True

B.

False

Full Access
Question # 8

Exhibit:

resource "aws_instance" "example" {

ami = "ami-0a123456789abcdef"

instance_type = "t3.micro"

}

You are updating a child module with the resource block shown in the exhibit. The public_ip attribute of the resource needs to be accessible to the parent module. How do you meet this requirement?

A.

Create an output in the child module.

B.

Add a data source to the parent module.

C.

Add an import block to the parent module.

D.

Create a local value in the child module.

Full Access
Question # 9

What type of information can be found on the Terraform Registry when using published modules?

A.

Required input variables.

B.

Outputs.

C.

Optional input variables and default values.

D.

All of the above.

Full Access
Question # 10

Only the user that generated a plan may apply it.

A.

True

B.

False

Full Access
Question # 11

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

A.

True

B.

False

Full Access
Question # 12

You need to destroy all of the resources in your Terraform workspace, except for aws_instance.ubuntu[1], which you want to keep. How can you tell Terraform to stop managing that specific resource without destroying it?

A.

Remove the resource block from your configuration.

B.

Change the value of the count argument on the resource.

C.

Run terraform state rm aws_instance.ubuntu[1].

D.

Use a moved block.

Full Access
Question # 13

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

A.

True

B.

False

Full Access
Question # 14

The -refresh-only parameter will update your state file when used with terraform plan.

A.

True

B.

False

Full Access
Question # 15

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

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

A.

True

B.

False

Full Access
Question # 17

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

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

Full Access
Question # 18

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

Which command generates DOT (Document Template) formatted data to visualize Terraform dependencies?

A.

terraform graph

B.

terraform show

C.

terraform refresh

D.

terraform output

Full Access
Question # 20

A developer launched a VM outside of the Terraform workflow and ended up with two servers with the same name. They are unsure which VM is managed with Terraform, but they do have a list of all active VM IDs. Which method could you use to determine which instance Terraform manages?

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

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

You corrected a typo in a resource name, changing it from aws_s3_bucket.photoes to aws_s3_bucket.photos. You want to update the Terraform state so that the existing resource is recognized under the new name, without destroying and recreating it. Which configuration should you use?

A.

Remove the old resource from your configuration and re-import it.

B.

Run terraform apply -refresh-only.

C.

Do nothing — Terraform will automatically update the state.

D.

Add a moved block to your configuration.

Full Access
Question # 23

Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged into stdout.

A.

True

B.

False

Full Access
Question # 24

You have never used Terraform before and would like to test it out using a shared team account for a cloud provider. The shared team account already contains 15 virtual machines (VM). You develop a Terraform configuration containing one VM. perform terraform apply, and see that your VM was created successfully. What should you do to delete the newly-created VM with Terraform?

A.

The Terraform state file contains all 16 VMs in the team account. Execute terraform destroy and select the newly-created VM.

B.

Delete the Terraform state file and execute terraform apply.

C.

The Terraform state file only contains the one new VM. Execute terraform destroy.

D.

Delete the VM using the cloud provider console and terraform apply to apply the changes to the Terraform state file.

Full Access
Question # 25

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

Exhibit.

You need to deploy resources into two different regions in the same Terraform configuration. To do this, you declare multiple provider configurations as shown in the Exhibit space on this page.

What meta-argument do you need to configure in a resource block to deploy the resource to the us-west-2 AWS region?

A.

provider = aws.west

B.

alias = aws.west

C.

provider = west

D.

alias = west

Full Access
Question # 27

Which of the following is not an action performed by terraform init?

A.

Initialize a configured backend.

B.

Create template configuration files.

C.

Load required provider plugins.

D.

Retrieve the source code for all referenced modules.

Full Access
Question # 28

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?

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

Full Access
Question # 29

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

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

Your team often uses API calls to create and manage cloud infrastructure. In what ways does Terraform differ from conventional infrastructure management approaches?

A.

Terraform describes infrastructure with version-controlled, repeatable configurations that specify the desired state.

B.

Terraform is merely a wrapper for cloud provider APIs, so there is little to no difference in calling the API directly.

C.

Terraform replaces cloud provider APIs with its own protocols, enabling automated deployments.

D.

Terraform enforces infrastructure through imperative scripts to ensure tasks are completed in the proper order.

Full Access
Question # 32

Which backend does the Terraform CLI use by default?

A.

Depends on the cloud provider configured

B.

HTTP

C.

Remote

D.

Terraform Cloud

E.

Local

Full Access
Question # 33

terraform plan updates your state file.

A.

True

B.

False

Full Access
Question # 34

terraform validate uses provider APIs to verify your infrastructure settings.

A.

True

B.

False

Full Access
Question # 35

Which provider authentication method prevents credentials from being stored in the state file?

A.

Using environment variables

B.

Specifying the login credentials in the provider block

C.

Setting credentials as Terraform variables

D.

None of the above

Full Access
Question # 36

Exhibit:

data "vsphere_datacenter" "dc" {}

resource "vsphere_folder" "parent" {

path = "Production"

type = "vm"

datacenter_id = _________

}

You want to pass the id of the vsphere_datacenter data source to the datacenter_id argument of the vsphere_folder resource. Which reference would you use?

A.

data.vsphere_datacenter.de.id

B.

vsphere_datacenter.dc.id

C.

data.vsphere_datacenter.dc

D.

data.de.id

Full Access
Question # 37

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

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

What is modified when executing Terraform inrefresh-only mode?

A.

Your Terraform configuration.

B.

Your Terraform plan.

C.

Your state file.

D.

Your cloud infrastructure.

Full Access
Question # 40

The HCP Terraform private registry keeps the module configurations confidential within your organization.

A.

True

B.

False

Full Access
Question # 41

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

A.

True

B.

False

Full Access
Question # 42

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

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

terraform apply is failing with the following error. What next step should you take to determine the root cause of the problem?

Error:

yaml

CopyEdit

Error loading state: AccessDenied: Access Denied

status code: 403, request id: 288766CE5CCA24A0, host id: web.example.com

A.

Run terraform login to reauthenticate with the provider.

B.

Set TF_LOG=DEBUG.

C.

Review /var/log/terraform.log for error messages.

D.

Review syslog for Terraform error messages.

Full Access
Question # 45

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

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

Terraform providers are part of the Terraform core binary.

A.

True

B.

False

Full Access
Question # 48

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

What is an advantage of immutable infrastructure?

A.

In-place infrastructure upgrades

B.

Quicker infrastructure upgrades

C.

Automatic infrastructure upgrades

D.

Less complex infrastructure upgrades

Full Access
Question # 50

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

A.

Group a collection of Terraform configuration files that map to a single state file.

B.

Provision resources for on-premises infrastructure services.

C.

Provision resources for public cloud infrastructure services.

D.

Interact with cloud provider APIs.

E.

Enforce security and compliance policies.

Full Access
Question # 51

When should you use the force-unlock command?

A.

You have a high priority change

B.

Automatic unlocking failed

C.

apply failed due to a state lock

D.

You see a status message that you cannot acquire the lock

Full Access
Question # 52

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

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

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

A Terraform local value can reference other Terraform local values.

A.

True

B.

False

Full Access
Question # 56

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 delete the VM using the cloud provider console, then run terraform apply again without changing any Terraform code?

A.

Terraform will recreate the VM.

B.

Terraform will report an error.

C.

Terraform will remove the VM from the state file.

D.

Terraform will not make any changes.

Full Access
Question # 57

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

A.

version ~> 3.1

B.

version >= 3.1

C.

version = ">= 3.1"

Full Access
Question # 58

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

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

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

What’s the proper syntax for the plan command?

A.

terraform apply -var-file=tfplan

B.

terraform plan -target=tfplan

C.

terraform plan -generate-config-out=tfplan

D.

terraform plan -out=tfplan

Full Access
Question # 62

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

You are tasked with making a change to an infrastructure stack running in a public cloud using HCP Terraform/Terraform Cloud. Which pattern follows IaC best practices?

A.

Make the change via the public cloud API endpoint.

B.

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

C.

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

D.

Use the public cloud console to make the change after approval.

E.

Make the change programmatically via the cloud CLI.

Full Access
Question # 64

Terraform providers are always installed from the Internet.

A.

True

B.

False

Full Access
Question # 65

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

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

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

Full Access
Question # 67

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

A.

True

B.

False

Full Access
Question # 68

As a developer, you want to ensure your plugins are up to date with the latest versions. Which Terraform command should you use?

A.

terraform refresh -upgrade

B.

terraform apply -upgrade

C.

terraform init -upgrade

D.

terraform providers -upgrade

Full Access
Question # 69

You’ve enabled DEBUG-level logging for Terraform, and you’d like to send the log data to a file. Which action should you take?

A.

Set the TF_LOG_PATH environment variable.

B.

Update the Terraform CLI configuration file.

C.

Add a path argument to the terraform block.

D.

Run the terraform output command.

Full Access
Question # 70

You cannot install third party plugins using terraform init.

A.

True

B.

False

Full Access
Question # 71

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

Which of these commands makes your code more human readable?

A.

Terraform validate

B.

Terraform output

C.

Terraform show

D.

Terraform file

Full Access
Question # 73

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

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

A.

True

B.

False

Full Access
Question # 75

Exhibit:

data "aws_ami" "web" {

most_recent = true

owners = ["self"]

tags = {

Name = "web-server"

}

}

A data source is shown in the exhibit. How do you reference the id attribute of this data source?

A.

aws_ami.web.id

B.

web.id

C.

data.aws_ami.web.id

D.

data.web.id

Full Access
Question # 76

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

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

A.

Run all Terraform commands on a shared server or container.

B.

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

C.

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

D.

None of the above.

Full Access
Question # 78

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

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

A.

True

B.

False

Full Access
Question # 80

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.

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

Full Access
Question # 81

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

Which task does terraform init not perform?

A.

Discovers all providers used in the configuration and downloads them.

B.

Validates that values are set for all required input variables.

C.

Connects to the configured backend.

D.

Discovers any remote modules and downloads them.

Full Access
Question # 83

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

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

A.

True

B.

False

Full Access
Question # 85

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?

A.

terraform state

B.

terraform init

C.

terraform push

D.

terraform refresh

Full Access
Question # 86

What type of block is used to construct a collection of nested configuration blocks?

A.

Dynamic

B.

For_each

C.

Nesting

D.

repeated.

Full Access
Question # 87

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?

A.

file("id_rsa.pub")

B.

templaTefil("id_rsa.pub")

C.

filebase64("id_rsa.pub")

D.

fileset<"id_rsa.pub")

Full Access
Question # 88

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

A child module can always access variables declared in its parent module.

A.

True

B.

False

Full Access