ExamGecko
Home Home / HashiCorp / Terraform Associate 003

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

Question list
Search
Search

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

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

Explanation:

If you update the version constraint in your Terraform configuration, Terraform will update your lock file the next time you runterraform init3. This will ensure that you use the same provider versions across different machines and runs.

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
A.
terraform destroy, then terraform apply
Answers
B.
terraform init
B.
terraform init
Answers
C.
terraform push
C.
terraform push
Answers
D.
terraform apply
D.
terraform apply
Answers
Suggested answer: A

Explanation:

This command will initialize the new backend and prompt you to migrate the existing state file to the new location4. The other commands are not relevant for this task.

What does Terraform use the .terraform.lock.hc1 file for?

A.
There is no such file
A.
There is no such file
Answers
B.
Tracking specific provider dependencies
B.
Tracking specific provider dependencies
Answers
C.
Preventing Terraform runs from occurring
C.
Preventing Terraform runs from occurring
Answers
D.
Storing references to workspaces which are locked
D.
Storing references to workspaces which are locked
Answers
Suggested answer: B

Explanation:

The.terraform.lock.hclfile is a new feature in Terraform 0.14 that records the exact versions of each provider used in your configuration. This helps ensure consistent and reproducible behavior across different machines and runs.

Why does this backend configuration not follow best practices?

A.
An alias meta-argument should be included in backend blocks whenever possible
A.
An alias meta-argument should be included in backend blocks whenever possible
Answers
B.
You should use the local enhanced storage backend whenever possible
B.
You should use the local enhanced storage backend whenever possible
Answers
C.
You should not store credentials in Terraform configuration
C.
You should not store credentials in Terraform configuration
Answers
D.
The backend configuration should contain multiple credentials so that more than one user can execute terraform plan and terraform apply
D.
The backend configuration should contain multiple credentials so that more than one user can execute terraform plan and terraform apply
Answers
Suggested answer: C

Explanation:

This is a bad practice, as it exposes your credentials to anyone who can access your configuration files or state files. You should use environment variables, credential files, or other mechanisms to provide credentials to Terraform.

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

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

Explanation:

It is not a best practice to store secret data in the same version control repository as your Terraform configuration, as it could expose your sensitive information to unauthorized parties or compromise your security. You should use environment variables, vaults, or other mechanisms to store and provide secret data to Terraform.

_______backends support state locking.

A.
All
A.
All
Answers
B.
No
B.
No
Answers
C.
Some
C.
Some
Answers
D.
Only local
D.
Only local
Answers
Suggested answer: C

Explanation:

Some backends support state locking, which prevents other users from modifying the state file while a Terraform operation is in progress. This prevents conflicts and data loss. Not all backends support this feature, and you can check the documentation for each backend type to see if it does.

You want to define a single input variable to capture configuration values for a server. The values must represent memory as a number, and the server name as a string.

Which variable type could you use for this input?

A.
List
A.
List
Answers
B.
Object
B.
Object
Answers
C.
Map
C.
Map
Answers
D.
Terraform does not support complex input variables of different types
D.
Terraform does not support complex input variables of different types
Answers
Suggested answer: B

Explanation:

This is the variable type that you could use for this input, as it can store multiple attributes of different types within a single value. The other options are either invalid or incorrect for this use case.

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

A.
Modules can call other modules
A.
Modules can call other modules
Answers
B.
A module is a container for one or more resources
B.
A module is a container for one or more resources
Answers
C.
Modules must be publicly accessible
C.
Modules must be publicly accessible
Answers
D.
You can call the same module multiple times
D.
You can call the same module multiple times
Answers
Suggested answer: C

Explanation:

This is not true, as modules can be either public or private, depending on your needs and preferences. You can use the Terraform Registry to publish and consume public modules, or use Terraform Cloud or Terraform Enterprise to host and manage private modules.

When you use a remote backend that needs authentication, HashiCorp recommends that you:

A.
Write the authentication credentials in the Terraform configuration files
A.
Write the authentication credentials in the Terraform configuration files
Answers
B.
Keep the Terraform configuration files in a secret store
B.
Keep the Terraform configuration files in a secret store
Answers
C.
Push your Terraform configuration to an encrypted git repository
C.
Push your Terraform configuration to an encrypted git repository
Answers
D.
Use partial configuration to load the authentication credentials outside of the Terraform code
D.
Use partial configuration to load the authentication credentials outside of the Terraform code
Answers
Suggested answer: D

Explanation:

This is the recommended way to use a remote backend that needs authentication, as it allows you to provide the credentials via environment variables, command-line arguments, or interactive prompts, without storing them in the Terraform configuration files.

You can reference a resource created with for_each using a Splat ( *) expression.

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

Explanation:

You cannot reference a resource created withfor_eachusing a splat (*) expression, as it will not work with resources that have non-numeric keys. You need to use aforexpression instead to iterate over the resource instances.

Total 195 questions
Go to page: of 20