HashiCorp Terraform Associate 003 Practice Test - Questions Answers, Page 4
List of questions
Related questions
Question 31

If you update the version constraint in your Terraform configuration, Terraform will update your lock file the next time you run terraform Init.
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.
Question 32

Once you configure a new Terraform backend with a terraform code block, which command(s) should you use to migrate the state file?
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.
Question 33

What does Terraform use the .terraform.lock.hc1 file for?
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.
Question 34

Why does this backend configuration not follow best practices?
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.
Question 35

It is best practice to store secret data in the same version control repository as your Terraform configuration.
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.
Question 36

_______backends support state locking.
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.
Question 37

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?
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.
Question 38

Which of the following statements about Terraform modules is not true?
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.
Question 39

When you use a remote backend that needs authentication, HashiCorp recommends that you:
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.
Question 40

You can reference a resource created with for_each using a Splat ( *) expression.
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.
Question