ExamGecko
Home Home / HashiCorp / Terraform Associate 003

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

Question list
Search
Search

What information does the public Terraform Module Registry automatically expose about published modules?

A.
Required input variables
A.
Required input variables
Answers
B.
Optional inputs variables and default values
B.
Optional inputs variables and default values
Answers
C.
Outputs
C.
Outputs
Answers
D.
All of the above
D.
All of the above
Answers
E.
None of the above
E.
None of the above
Answers
Suggested answer: D

Explanation:

The public Terraform Module Registry automatically exposes all the information about published modules, including required input variables, optional input variables and default values, and outputs. This helps users to understand how to use and configure the modules.

You must use different Terraform commands depending on the cloud provider you use.

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

Explanation:

You do not need to use different Terraform commands depending on the cloud provider you use. Terraform commands are consistent across different providers, as they operate on the Terraform configuration files and state files, not on the provider APIs directly.

As a member of an operations team that uses infrastructure as code (lac) practices, you are tasked with making a change to an infrastructure stack running in a public cloud. Which pattern would follow laC best practices for making a change?

A.
Make the change via the public cloud API endpoint
A.
Make the change via the public cloud API endpoint
Answers
B.
Clone the repository containing your infrastructure code and then run the code
B.
Clone the repository containing your infrastructure code and then run the code
Answers
C.
Use the public cloud console to make the change after a database record has been approved
C.
Use the public cloud console to make the change after a database record has been approved
Answers
D.
Make the change programmatically via the public cloud CLI
D.
Make the change programmatically via the public cloud CLI
Answers
E.
Submit a pull request and wait for an approved merge of the proposed changes
E.
Submit a pull request and wait for an approved merge of the proposed changes
Answers
Suggested answer: E

Explanation:

You do not need to use different Terraform commands depending on the cloud provider you use. Terraform commands are consistent across different providers, as they operate on the Terraform configuration files and state files, not on the provider APIs directly.

You ate making changes to existing Terraform code to add some new infrastructure. When is the best time to run terraform validate?

A.
After you run terraform apply so you can validate your infrastructure
A.
After you run terraform apply so you can validate your infrastructure
Answers
B.
Before you run terraform apply so you can validate your provider credentials
B.
Before you run terraform apply so you can validate your provider credentials
Answers
C.
Before you run terraform plan so you can validate your code syntax
C.
Before you run terraform plan so you can validate your code syntax
Answers
D.
After you run terraform plan so you can validate that your state file is consistent with your infrastructure
D.
After you run terraform plan so you can validate that your state file is consistent with your infrastructure
Answers
Suggested answer: C

Explanation:

This is the best time to runterraform validate, as it will check your code for syntax errors, typos, and missing arguments before you attempt to create a plan. The other options are either incorrect or unnecessary.

How would you reference the volume IDs associated with the ebs_block_device blocks in this configuration?

A.
aws_instance.example.ebs_block_device[sda2,sda3).volume_id
A.
aws_instance.example.ebs_block_device[sda2,sda3).volume_id
Answers
B.
aws_lnstance.example.ebs_block_device.[*].volume_id
B.
aws_lnstance.example.ebs_block_device.[*].volume_id
Answers
C.
aws_lnstance.example.ebs_block_device.volume_ids
C.
aws_lnstance.example.ebs_block_device.volume_ids
Answers
D.
aws_instance.example-ebs_block_device.*.volume_id
D.
aws_instance.example-ebs_block_device.*.volume_id
Answers
Suggested answer: D

Explanation:

This is the correct way to reference the volume IDs associated with the ebs_block_device blocks in this configuration, using the splat expression syntax. The other options are either invalid or incomplete.

Which command should you run to check if all code in a Terraform configuration that references multiple modules is properly formatted without making changes?

A.
terraform fmt -write-false
A.
terraform fmt -write-false
Answers
B.
terraform fmt -list -recursive
B.
terraform fmt -list -recursive
Answers
C.
terraform fmt -check -recursive
C.
terraform fmt -check -recursive
Answers
D.
terraform fmt -check
D.
terraform fmt -check
Answers
Suggested answer: C

Explanation:

This command will check if all code in a Terraform configuration that references multiple modules is properly formatted without making changes, and will return a non-zero exit code if any files need formatting. The other commands will either make changes, list the files that need formatting, or not check the modules.

What kind of configuration block will create an infrastructure object with settings specified within the block?

A.
provider
A.
provider
Answers
B.
state
B.
state
Answers
C.
data
C.
data
Answers
D.
resource
D.
resource
Answers
Suggested answer: D

Explanation:

This is the kind of configuration block that will create an infrastructure object with settings specified within the block. The other options are not used for creating infrastructure objects, but for configuring providers, accessing state data, or querying data sources.

What is the Terraform style convention for indenting a nesting level compared to the one above it?

A.
With a tab
A.
With a tab
Answers
B.
With two spaces
B.
With two spaces
Answers
C.
With four spaces
C.
With four spaces
Answers
D.
With three spaces
D.
With three spaces
Answers
Suggested answer: B

Explanation:

This is the Terraform style convention for indenting a nesting level compared to the one above it. The other options are not consistent with the Terraform style guide.

You have never used Terraform before and would like to test it out using a shared team account for a cloud provider. The shared team account already contains 15 virtual machines (VM). You develop a Terraform configuration containing one VM. perform terraform apply, and see that your VM was created successfully. What should you do to delete the newly-created VM with Terraform?

A.
The Terraform state file contains all 16 VMs in the team account. Execute terraform destroy and select the newly-created VM.
A.
The Terraform state file contains all 16 VMs in the team account. Execute terraform destroy and select the newly-created VM.
Answers
B.
Delete the Terraform state file and execute terraform apply.
B.
Delete the Terraform state file and execute terraform apply.
Answers
C.
The Terraform state file only contains the one new VM. Execute terraform destroy.
C.
The Terraform state file only contains the one new VM. Execute terraform destroy.
Answers
D.
Delete the VM using the cloud provider console and terraform apply to apply the changes to the Terraform state file.
D.
Delete the VM using the cloud provider console and terraform apply to apply the changes to the Terraform state file.
Answers
Suggested answer: C

Explanation:

This is the best way to delete the newly-created VM with Terraform, as it will only affect the resource that was created by your configuration and state file. The other options are either incorrect or inefficient.

When do changes invoked by terraform apply take effect?

A.
After Terraform has updated the state file
A.
After Terraform has updated the state file
Answers
B.
Once the resource provider has fulfilled the request
B.
Once the resource provider has fulfilled the request
Answers
C.
Immediately
C.
Immediately
Answers
D.
None of the above are correct
D.
None of the above are correct
Answers
Suggested answer: B

Explanation:

Changes invoked byterraform applytake effect once the resource provider has fulfilled the request, not after Terraform has updated the state file or immediately. The state file is only a reflection of the real resources, not a source of truth.

Total 195 questions
Go to page: of 20