ExamGecko
Home Home / HashiCorp / Terraform Associate 003

HashiCorp Terraform Associate 003 Practice Test - Questions Answers, Page 12

Question list
Search
Search

What is the workflow for deploying new infrastructure with Terraform?

A.
Write Terraform configuration, run terraform init to initialize the working directory or workspace, and run terraform apply
A.
Write Terraform configuration, run terraform init to initialize the working directory or workspace, and run terraform apply
Answers
B.
Write Terraform configuration, run terraform show to view proposed changes, and terraform apply to create new infrastructure
B.
Write Terraform configuration, run terraform show to view proposed changes, and terraform apply to create new infrastructure
Answers
C.
Write Terraform configuration, run terraform apply to create infrastructure, use terraform validate to confirm Terraform deployed resources correctly
C.
Write Terraform configuration, run terraform apply to create infrastructure, use terraform validate to confirm Terraform deployed resources correctly
Answers
D.
Write Terraform configuration, run terraform plan to initialize the working directory or workspace, and terraform apply to create the infrastructure
D.
Write Terraform configuration, run terraform plan to initialize the working directory or workspace, and terraform apply to create the infrastructure
Answers
Suggested answer: A

Explanation:

This is the workflow for deploying new infrastructure with Terraform, as it will create a plan and apply it to the target environment. The other options are either incorrect or incomplete.

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

A.
Terraform destroy
A.
Terraform destroy
Answers
B.
Terraform apply
B.
Terraform apply
Answers
C.
Terraform plan
C.
Terraform plan
Answers
D.
Terraform state list
D.
Terraform state list
Answers
Suggested answer: D

Explanation:

This is the command that does not cause Terraform to refresh its state, as it only lists the resources that are currently managed by Terraform in the state file. The other commands will refresh the state file before performing their operations, unless you use the-refresh=falseflag.

Which command lets you experiment with terraform expressions?

A.
Terraform console
A.
Terraform console
Answers
B.
Terraform validate
B.
Terraform validate
Answers
C.
Terraform env
C.
Terraform env
Answers
D.
Terraform test
D.
Terraform test
Answers
Suggested answer: A

Explanation:

This is the command that lets you experiment with Terraform expressions, by providing an interactive console that allows you to evaluate expressions and see their results. You can use this command to test your expressions before using them in your configuration files.

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?

A.
The team is asked to manage a new application stack built on AWS-native services
A.
The team is asked to manage a new application stack built on AWS-native services
Answers
B.
The organization decides to expand into Azure wishes to deploy new infrastructure
B.
The organization decides to expand into Azure wishes to deploy new infrastructure
Answers
C.
The team is asked to build a reusable code based that can deploy resources into any AWS region
C.
The team is asked to build a reusable code based that can deploy resources into any AWS region
Answers
D.
The DevOps team is tasked with automating a manual, web console-based provisioning.
D.
The DevOps team is tasked with automating a manual, web console-based provisioning.
Answers
Suggested answer: B

Explanation:

This is the scenario that poses a challenge for this team, if they adopt AWS CloudFormation as their standardized method for provisioning public cloud resources, as CloudFormation only supports AWS services and resources, and cannot be used to provision infrastructure on other cloud platforms such as Azure.

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

A.
In an environment variable
A.
In an environment variable
Answers
B.
On the disk
B.
On the disk
Answers
C.
In the remote backend or Terraform Cloud
C.
In the remote backend or Terraform Cloud
Answers
D.
In memory
D.
In memory
Answers
Suggested answer: C

Explanation:

This is where Terraform saves resource state when using a remote backend or Terraform Cloud integration, as it allows you to store and manage your state file in a remote location, such as a cloud storage service or Terraform Cloud's servers. This enables collaboration, security, and scalability for your Terraform infrastructure.

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
A.
Terraform will use the version recorded in your lock file
Answers
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
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
Answers
C.
Terraform will check your state file to determine the provider version to use
C.
Terraform will check your state file to determine the provider version to use
Answers
D.
Terraform will use the latest version of the provider available at the time you provision your new resource
D.
Terraform will use the latest version of the provider available at the time you provision your new resource
Answers
Suggested answer: A

Explanation:

This is how Terraform chooses which version of the provider to use, when you add a new resource to an existing Terraform configuration, but do not update the version constraint in the configuration. The lock file records the exact version of each provider that was installed in your working directory, and ensures that Terraform will always use the same provider versions until you runterraform init -upgradeto update them.

What is a key benefit of the Terraform state file?

A.
A state file can schedule recurring infrastructure tasks
A.
A state file can schedule recurring infrastructure tasks
Answers
B.
A state file is a source of truth for resources provisioned with Terraform
B.
A state file is a source of truth for resources provisioned with Terraform
Answers
C.
A state file is a source of truth for resources provisioned with a public cloud console
C.
A state file is a source of truth for resources provisioned with a public cloud console
Answers
D.
A state file is the desired state expressed by the Terraform code files
D.
A state file is the desired state expressed by the Terraform code files
Answers
Suggested answer: B

Explanation:

This is a key benefit of the Terraform state file, as it stores and tracks the metadata and attributes of the resources that are managed by Terraform, and allows Terraform to compare the current state with the desired state expressed by your configuration files.

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

A.
True
A.
True
Answers
B.
False
B.
False
Answers
Suggested answer: B

Explanation:

You can configure a backend in your Terraform code before initializing it. Initializing a backend will store the state file remotely and enable features like locking and workspaces.Reference= [Terraform Backends]

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?

A.
Use the terraform state rm command to remove the VM from state file
A.
Use the terraform state rm command to remove the VM from state file
Answers
B.
Use the terraform taint command targeting the VMs then run terraform plan and terraform apply
B.
Use the terraform taint command targeting the VMs then run terraform plan and terraform apply
Answers
C.
Use the terraform apply command targeting the VM resources only
C.
Use the terraform apply command targeting the VM resources only
Answers
D.
Delete the Terraform VM resources from your Terraform code then run terraform plan and terraform apply
D.
Delete the Terraform VM resources from your Terraform code then run terraform plan and terraform apply
Answers
Suggested answer: B

Explanation:

The terraform taint command marks a resource as tainted, which means it will be destroyed and recreated on the next apply. This way, you can replace the VM instance without affecting the database or other resources.Reference= [Terraform Taint]

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

A.
Declare the output in the root configuration
A.
Declare the output in the root configuration
Answers
B.
Declare the output in the child module
B.
Declare the output in the child module
Answers
C.
Declare the output in both the root and child module
C.
Declare the output in both the root and child module
Answers
D.
None of the above
D.
None of the above
Answers
Suggested answer: C

Explanation:

To output returned values from a child module in the Terraform CLI output, you need to declare the output in both the child module and the root module. The child module output will return the value to the root module, and the root module output will display the value in the CLI.Reference= [Terraform Outputs]

Total 195 questions
Go to page: of 20