Terraform Associate: HashiCorp Certified Part 5
Question #: 121
Topic #: 1
Which of the following does terraform apply change after you approve the execution plan? (Choose two.)
A. Cloud infrastructure
B. The .terraform directory
C. The execution plan
D. State file
E. Terraform code
Selected Answer: A
Question #: 122
Topic #: 1
A Terraform backend determines how Terraform loads state and stores updates when you execute ___________.
A. apply
B. taint
C. destroy
D. All of the above
E. None of the above
Selected Answer: D
Question #: 123
Topic #: 1
What does Terraform use .terraform.lock.hcl file for?
A. Tracking provider dependencies
B. There is no such file
C. Preventing Terraform runs from occurring
D. Storing references to workspaces which are locked
Selected Answer: A
Question #: 124
Topic #: 1
You’ve used Terraform to deploy a virtual machine and a database. You want to replace this virtual machine instance with an identical one without affecting the database. What is the best way to achieve this using Terraform?
A. Use the terraform state rm command to remove the VM from state file
B. Use the terraform taint command targeting the VMs then run terraform plan and terraform apply
C. Use the terraform apply command targeting the VM resources only
D. Delete the Terraform VM resources from your Terraform code then run terraform plan and terraform apply
Selected Answer: B
Question #: 125
Topic #: 1
How do you specify a module’s version when publishing it to the public Terraform Module Registry?
A. The module’s configuration page on the Terraform Module Registry
B. Terraform Module Registry does not support versioning modules
C. The release tags in the associated repo
D. The module’s Terraform code
Selected Answer: C
Question #: 126
Topic #: 1
Terraform plan updates your state file.
A. True
B. False
Selected Answer: B
Question #: 127
Topic #: 1
To check if all code in a Terraform configuration with multiple modules is properly formatted without making changes, what command should be run?
A. terraform fmt -check
B. terraform fmt -write-false
C. terraform fmt ג€”list -recursive
D. terraform fmt -check -recursive
Selected Answer: D
Question #: 128
Topic #: 1
As a member of the operations team, you need to run a script on a virtual machine created by Terraform. Which provision is best to use in your Terraform code?
A. null-ex׀µׁ
B. local-exec
C. remote-exec
D. file
Selected Answer: C
Question #: 129
Topic #: 1
You are using a networking module in your Terraform configuration with the name label my_network. In your main configuration you have the following code:
When you run terraform validate, you get the following error:
What must you do to successfully retrieve this value from your networking module?
A. Define the attribute vnet_id as a variable in the networking module
B. Change the referenced value to module.my_network.outputs.vnet_id
C. Define the attribute vnet_id as an output in the networking module
D. Change the referenced value to my_network.outputs.vnet_id
Selected Answer: C
Question #: 130
Topic #: 1
How can a ticket-based system slow down infrastructure provisioning and limit the ability to scale? (Choose two.)
A. A full audit trail of the request and fulfillment process is generated
B. A request must be submitted for infrastructure changes
C. As additional resources are required, more tickets are submitted
D. A catalog of approved resources can be accessed from drop down lists in a request form
Selected Answer: C
Question #: 131
Topic #: 1
Which of the following statements about Terraform modules is not true?
A. Modules must be publicly accessible
B. Modules can be called multiple times
C. Module is a container for one or more resources
D. Modules can call other modules
Selected Answer: A
Question #: 132
Topic #: 1
Which Terraform collection type should you use to store key/value pairs?
A. tuple
B. set
C. maׁ€
D. list
Selected Answer: C
Question #: 133
Topic #: 1
You have used Terraform to create an ephemeral development environment in the cloud and are now ready to destroy all the infrastructure described by your
Terraform configuration. To be safe, you would like to first see all the infrastructure that will be deleted by Terraform.
Which command should you use to show all of the resources that will be deleted? (Choose two.)
A. Run terraform plan -destroy
B. Run terraform show -destroy
C. Run terraform destroy and it will first output all the resources that will be deleted before prompting for approval
D. Run terraform show -destroy
Selected Answer: AC
Question #: 134
Topic #: 1
When do you need to explicitly execute terraform refresh?
A. Before every terraform plan
B. Before every terraform apply
C. Before every terraform import
D. None of the above
Selected Answer: D
Question #: 135
Topic #: 1
All Terraform Cloud tiers support team management and governance.
A. True
B. False
Selected Answer: B
Question #: 136
Topic #: 1
What advantage does an operations team that uses infrastructure as code have?
A. The ability to delete infrastructure
B. The ability to update existing infrastructure
C. The ability to reuse best practice configurations and settings
D. The ability to autoscale a group of servers
Selected Answer: C
Question #: 137
Topic #: 1
You have modified your Terraform configuration to fix a typo in the Terraform ID of a resource from aws_security_group.http to aws_security_group.http
Which of the following commands would you run to update the ID in state without destroying the resource?
A. terraform mv aws_security_group.htp aws_security_group.http
B. terraform apply
C. terraform refresh
Selected Answer: A
Question #: 138
Topic #: 1
Terraform variable names are saved in the state file.
A. True
B. False
Selected Answer: B
Question #: 139
Topic #: 1
Terraform Cloud is available only as a paid offering from HashiCorp.
A. True
B. False
Selected Answer: B
Question #: 140
Topic #: 1
Which of the following is not a way to trigger terraform destroy?
A. Using the destroy command with auto-approve
B. Running terraform destroy from the correct directory and then typing “yes” when prompted in the CLI
C. Passing –destroy at the end of a plan request
D. Delete the state file and run terraform apply
Selected Answer: C
Question #: 141
Topic #: 1
Which of the following is not an advantage of using infrastructure as code operations?
A. Self-service infrastructure deployment
B. Troubleshoot via a Linux diff command
C. Public cloud console configuration workflows
D. Modify a count parameter to scale resources
E. API driven workflows
Selected Answer: C
Question #: 142
Topic #: 1
You’re writing a Terraform configuration that needs to read input from a local file called id_rsa.pub.
Which built-in Terraform function can you use to import the file’s contents as a string?
A. fileset(“id_rsa.pub”)
B. filebase64(“id_rsa.pub”)
C. templatefile(“id_rsa.pub”)
D. file(“id_rsa.pub”)
Selected Answer: D
Question #: 143
Topic #: 1
What does Terraform use providers for? (Choose three.)
A. Provision resources for on-premises infrastructure services
B. Simplify API interactions
C. Provision resources for public cloud infrastructure services
D. Enforce security and compliance policies
E. Group a collection of Terraform configuration files that map to a single state file
Selected Answer: ABC
Question #: 144
Topic #: 1
You can reference a resource created with for_each using a Splat (*) expression.
A. True
B. False
Selected Answer: A
Question #: 145
Topic #: 1
How does Terraform determine dependencies between resources?
A. Terraform automatically builds a resource graph based on resources, provisioners, special meta-parameters, and the state file, if present.
B. Terraform requires all dependencies between resources to be specified using the depends_on parameter
C. Terraform requires resources in a configuration to be listed in the order they will be created to determine dependencies
D. Terraform requires resource dependencies to be defined as modules and sourced in order
Selected Answer: A
Question #: 146
Topic #: 1
Which parameters does terraform import require? (Choose two.)
A. Path
B. Provider
C. Resource ID
D. Resource address
Selected Answer: CD
Question #: 147
Topic #: 1
Once a new Terraform backend is configured with a Terraform code block, which command(s) is (are) used to migrate the state file?
A. terraform apply
B. terraform push
C. terraform destroy, then terraform apply
D. terraform init
Selected Answer: D
Question #: 148
Topic #: 1
What does this code do?
A. Requires any version of the AWS provider >= 3.0 and < 4.0
B. Requires any version of the AWS provider >= 3.0
C. Requires any version of the AWS provider after the 3.0 major release, like 4.1
D. Requires any version of the AWS provider > 3.0
Selected Answer: A
Question #: 149
Topic #: 1
What does terraform refresh modify?
A. Your cloud infrastructure
B. Your state file
C. Your Terraform plan
D. Your Terraform configuration
Selected Answer: B
Question #: 150
Topic #: 1
Which of the following is not valid source path for specifying a module?
A. source = “./modulelversion=v1.0.0”
B. source = “github.com/hashicorp/example?ref=v1.0.0”
C. source = “./module”
D. source = “hashicorp/consul/aws”
Selected Answer: A