ExamGecko
Home Home / HashiCorp / Terraform Associate 003

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

Question list
Search
Search

What feature stops multiple users from operating on the Terraform state at the same time?

A.
State locking
A.
State locking
Answers
B.
Version control
B.
Version control
Answers
C.
Provider constraints
C.
Provider constraints
Answers
D.
Remote backends
D.
Remote backends
Answers
Suggested answer: A

Explanation:

State locking prevents other users from modifying the state file while a Terraform operation is in progress.This prevents conflicts and data loss1.

Which of the following is not a valid siring function in Terraform?

A.
choaf
A.
choaf
Answers
B.
join
B.
join
Answers
C.
Split
C.
Split
Answers
D.
slice
D.
slice
Answers
Suggested answer: A

Explanation:

This is not a valid string function in Terraform.The other options are valid string functions that can manipulate strings in various ways2.

Module variable assignments are inherited from the parent module and you do not need to explicitly set them.

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

Explanation:

Module variable assignments are not inherited from the parent module and you need to explicitly set them using thesourceargument. This allows you to customize the behavior of each module instance.

What are some benefits of using Sentinel with Terraform Cloud/Terra form Cloud? Choose three correct answers.

A.
You can enforce a list of approved AWS AMIs
A.
You can enforce a list of approved AWS AMIs
Answers
B.
Policy-as-code can enforce security best practices
B.
Policy-as-code can enforce security best practices
Answers
C.
You can check out and check in cloud access keys
C.
You can check out and check in cloud access keys
Answers
D.
You can restrict specific resource configurations, such as disallowing the use of CIDR=0.0.0.0/0.
D.
You can restrict specific resource configurations, such as disallowing the use of CIDR=0.0.0.0/0.
Answers
E.
Sentinel Policies can be written in HashiCorp Configuration Language (HCL)
E.
Sentinel Policies can be written in HashiCorp Configuration Language (HCL)
Answers
Suggested answer: A, B, D

Explanation:

These are some of the benefits of using Sentinel with Terraform Cloud/Terraform Enterprise, as they allow you to implement logic-based policies that can access and evaluate the Terraform plan, state, and configuration. The other options are not true, as Sentinel does not manage cloud access keys, and Sentinel policies are written in Sentinel language, not HCL.

What does Terraform not reference when running a terraform apply -refresh-only ?

A.
State file
A.
State file
Answers
B.
Credentials
B.
Credentials
Answers
C.
Cloud provider
C.
Cloud provider
Answers
D.
Terraform resource definitions in configuration files
D.
Terraform resource definitions in configuration files
Answers
Suggested answer: D

Explanation:

When running aterraform apply -refresh-only, Terraform does not reference the configuration files, but only the state file, credentials, and cloud provider.The purpose of this command is to update the state file with the current status of the real resources, without making any changes to them1.

Which of the following is not a valid Terraform variable type?

A.
list
A.
list
Answers
B.
array
B.
array
Answers
C.
nap
C.
nap
Answers
D.
string
D.
string
Answers
Suggested answer: B

Explanation:

This is not a valid Terraform variable type.The other options are valid variable types that can store different kinds of values2.

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
A.
terraform state
Answers
B.
terraform init
B.
terraform init
Answers
C.
terraform push
C.
terraform push
Answers
D.
terraform refresh
D.
terraform refresh
Answers
Suggested answer: B

Explanation:

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

Your DevOps team is currently using the local backend for your Terraform configuration. You would like to move to a remote backend to store the state file in a central location. Which of the following backends would not work?

A.
Artifactory
A.
Artifactory
Answers
B.
Amazon S3
B.
Amazon S3
Answers
C.
Terraform Cloud
C.
Terraform Cloud
Answers
D.
Git
D.
Git
Answers
Suggested answer: D

Explanation:

This is not a valid backend for Terraform, as it does not support locking or versioning of state files4. The other options are valid backends that can store state files in a central location.

You have deployed a new webapp with a public IP address on a cloud provider. However, you did not create any outputs for your code. What is the best method to quickly find the IP address of the resource you deployed?

A.
In a new folder, use the terraform_remote_state data source to load in the state file, then write an output for each resource that you find the state file
A.
In a new folder, use the terraform_remote_state data source to load in the state file, then write an output for each resource that you find the state file
Answers
B.
Run terraform state list to find the name of the resource, then terraform state show to find the attributes including public IP address
B.
Run terraform state list to find the name of the resource, then terraform state show to find the attributes including public IP address
Answers
C.
Run terraform output ip_address to view the result
C.
Run terraform output ip_address to view the result
Answers
D.
Run terraform destroy then terraform apply and look for the IP address in stdout
D.
Run terraform destroy then terraform apply and look for the IP address in stdout
Answers
Suggested answer: B

Explanation:

This is a quick way to inspect the state file and find the information you need without modifying anything5. The other options are either incorrect or inefficient.

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
A.
terraform refresh -upgrade
Answers
B.
terraform apply -upgrade
B.
terraform apply -upgrade
Answers
C.
terraform init -upgrade
C.
terraform init -upgrade
Answers
D.
terraform providers -upgrade
D.
terraform providers -upgrade
Answers
Suggested answer: C

Explanation:

This command will upgrade the plugins to the latest acceptable version within the version constraints specified in the configuration. The other commands do not have an-upgradeoption.

Total 195 questions
Go to page: of 20