ExamGecko
Home Home / HashiCorp / Terraform Associate 003

HashiCorp Terraform Associate 003 Practice Test - Questions Answers

Question list
Search
Search

You have created a main.tf Terraform configuration consisting of an application server, a database and a load balanced. You ran terraform apply and Terraform created all of the resources successfully.

Now you realize that you do not actually need the load balancer, so you run terraform destroy without any flags. What will happen?

A.
Terraform will prompt you to pick which resource you want to destroy
A.
Terraform will prompt you to pick which resource you want to destroy
Answers
B.
Terraform will destroy the application server because it is listed first in the code
B.
Terraform will destroy the application server because it is listed first in the code
Answers
C.
Terraform will prompt you to confirm that you want to destroy all the infrastructure
C.
Terraform will prompt you to confirm that you want to destroy all the infrastructure
Answers
D.
Terraform will destroy the main, tf file
D.
Terraform will destroy the main, tf file
Answers
E.
Terraform will immediately destroy all the infrastructure
E.
Terraform will immediately destroy all the infrastructure
Answers
Suggested answer: C

Explanation:

This is what will happen if you runterraform destroywithout any flags, as it will attempt to delete all the resources that are associated with your current working directory or workspace. You can use the-targetflag to specify a particular resource that you want to destroy.

How can a ticket-based system slow down infrastructure provisioning and limit the ability to scale? Choose two correct answers.

A.
End-users have to request infrastructure changes
A.
End-users have to request infrastructure changes
Answers
B.
Ticket based systems generate a full audit trail of the request and fulfillment process
B.
Ticket based systems generate a full audit trail of the request and fulfillment process
Answers
C.
Users can access catalog of approved resources from drop down list in a request form
C.
Users can access catalog of approved resources from drop down list in a request form
Answers
D.
The more resources your organization needs, the more tickets your infrastructure team has to process
D.
The more resources your organization needs, the more tickets your infrastructure team has to process
Answers
Suggested answer: A

Explanation:

These are some of the ways that a ticket-based system can slow down infrastructure provisioning and limit the ability to scale, as they introduce delays, bottlenecks, and manual interventions in the process of creating and modifying infrastructure.

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
A.
Terraform will remove the virtual machine from the state file, but the resource will still exist
Answers
B.
Nothing
B.
Nothing
Answers
C.
Terraform will error
C.
Terraform will error
Answers
D.
Terraform will destroy the virtual machine
D.
Terraform will destroy the virtual machine
Answers
Suggested answer: D

Explanation:

This is what will happen if you runterraform applyin the working directory again, after removing the resource definition from your Terraform configuration file. Terraform will detect that there is a resource in the state file that is not present in the configuration file, and will assume that you want to delete it.

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

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

Explanation:

You can develop a custom provider to manage its resources using Terraform, as Terraform is an extensible tool that allows you to write your own plugins in Go language. You can also publish your custom provider to the Terraform Registry or use it privately.

What is one disadvantage of using dynamic blocks in Terraform?

A.
Dynamic blocks can construct repeatable nested blocks
A.
Dynamic blocks can construct repeatable nested blocks
Answers
B.
Terraform will run more slowly
B.
Terraform will run more slowly
Answers
C.
They cannot be used to loop through a list of values
C.
They cannot be used to loop through a list of values
Answers
D.
They make configuration harder to read and understand
D.
They make configuration harder to read and understand
Answers
Suggested answer: D

Explanation:

This is one disadvantage of using dynamic blocks in Terraform, as they can introduce complexity and reduce readability of the configuration. The other options are either advantages or incorrect statements.

Which backend does the Terraform CU use by default?

A.
Depends on the cloud provider configured
A.
Depends on the cloud provider configured
Answers
B.
HTTP
B.
HTTP
Answers
C.
Remote
C.
Remote
Answers
D.
Terraform Cloud
D.
Terraform Cloud
Answers
E.
Local
E.
Local
Answers
Suggested answer: E

Explanation:

This is the backend that the Terraform CLI uses by default, unless you specify a different backend in your configuration. The local backend stores the state file in a local file namedterraform.tfstate, which can be used to track and manage the state of your infrastructure.

How does Terraform manage most dependencies between resources?

A.
Terraform will automatically manage most resource dependencies
A.
Terraform will automatically manage most resource dependencies
Answers
B.
Using the depends_on parameter
B.
Using the depends_on parameter
Answers
C.
By defining dependencies as modules and including them in a particular order
C.
By defining dependencies as modules and including them in a particular order
Answers
D.
The order that resources appear in Terraform configuration indicates dependencies
D.
The order that resources appear in Terraform configuration indicates dependencies
Answers
Suggested answer: A

Explanation:

This is how Terraform manages most dependencies between resources, by using the references between them in the configuration files. For example, if resource A depends on resource B, Terraform will create resource B first and then pass its attributes to resource A.

You should run terraform fnt to rewrite all Terraform configurations within the current working directory to conform to Terraform-style conventions.

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

Explanation:

You should runterraform fmtto rewrite all Terraform configurations within the current working directory to conform to Terraform-style conventions. This command applies a subset of the Terraform language style conventions, along with other minor adjustments for readability. It is recommended to use this command to ensure consistency of style across different Terraform codebases. The command is optional, opinionated, and has no customization options, but it can help you and your team understand the code more quickly and easily.Reference= :Command: fmt:Using Terraform fmt Command to Format Your Terraform Code

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?

A.
Auditing cloud storage buckets with a vulnerability scanning tool
A.
Auditing cloud storage buckets with a vulnerability scanning tool
Answers
B.
By adding variables to each Terraform Cloud workspace to ensure these settings are always enabled
B.
By adding variables to each Terraform Cloud workspace to ensure these settings are always enabled
Answers
C.
With an S3 module with proper settings for buckets
C.
With an S3 module with proper settings for buckets
Answers
D.
With a Sentinel policy, which runs before every apply
D.
With a Sentinel policy, which runs before every apply
Answers
Suggested answer: D

Explanation:

The best way to automatically and proactively enforce the security control that new AWS S3 buckets must be private and encrypted at rest is with a Sentinel policy, which runs before every apply. Sentinel is a policy as code framework that allows you to define and enforce logic-based policies for your infrastructure. Terraform Cloud supports Sentinel policies for all paid tiers, and can run them before anyterraform planorterraform applyoperation. You can write a Sentinel policy that checks the configuration of the S3 buckets and ensures that they have the proper settings for privacy and encryption, and then assign the policy to your Terraform Cloud organization or workspace. This way, Terraform Cloud will prevent any changes that violate the policy from being applied.Reference= [Sentinel Policy Framework], [Manage Policies in Terraform Cloud], [Write and Test Sentinel Policies for Terraform]

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

A.
Self-describing infrastructure
A.
Self-describing infrastructure
Answers
B.
Idempotence
B.
Idempotence
Answers
C.
Versioned infrastructure
C.
Versioned infrastructure
Answers
D.
Golden images
D.
Golden images
Answers
Suggested answer: D

Explanation:

The key principle of infrastructure as code that is not listed among the options isgolden images. Golden images are pre-configured, ready-to-use virtual machine images that contain a specific set of software and configuration. They are often used to create multiple identical instances of the same environment, such as for testing or production. However, golden images are not a principle of infrastructure as code, but rather a technique that can be used with or without infrastructure as code. The other options are all key principles of infrastructure as code, as explained below:

Self-describing infrastructure: This means that the infrastructure is defined in code that describes its desired state, rather than in scripts that describe the steps to create it. This makes the infrastructure easier to understand, maintain, and reproduce.

Idempotence: This means that applying the same infrastructure code multiple times will always result in the same state, regardless of the initial state. This makes the infrastructure consistent and predictable, and avoids errors or conflicts caused by repeated actions.

Total 195 questions
Go to page: of 20