131. 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
B. terraform init
C. terraform refresh
D. terraform push
Answer
B
132. You want to tag multiple resources with a string that is a combination of a generated random_id and a variable.
How should you use the same value in all these resources without repeating the random_id and variable in each resource?
A. Local values
B. Data source
C. Modules
D. Outputs
Answer
A
133. Which of the following is not a benefit of adopting infrastructure as code?
A. Interpolation
B. Reusability of code
C. Versioning
D. Automation
Answer
A
134. Module version is required to reference a module on the Terraform Module Registry.
A. True
B. False
Answer
B
135. While deploying a virtual machine, the first launch user_data script fails due to race condition with another resource deployed during the same Terraform run.
What is the least disruptive method to correct the issue?
A. Run terraform taint against the virtual machine’s resource name, then terraform apply
B. Restart the virtual machine from the cloud portal
C. Run terraform apply again
D. Run terraform destroy then terraform apply
Answer
A
136. The public Module Registry is free to use.
A. True
B. False
Answer
A
137. Both Terraform Cloud and Terraform Enterprise support policy as code (Sentinel).
A. True
B. False
Answer
A
138. You want to define multiple data disks as nested blocks inside the resource block for a virtual machine.
What Terraform feature would help you define the blocks using the values in a variable?
A. Local values
B. Collection functions
C. Dynamic blocks
D. Count arguments
Answer
C
139. Which of the following module source paths does not specify a remote module?
A. source = “./modules/consul”
B. source = “[email protected]:hashicorp/example.git”
C. source = “github.com/hashicorp/example”
D. source = “hashicorp/consul/aws”
Answer
A
140. You have a list of numbers that represents the number of free CPU cores on each virtual cluster:
numcpus = [ 18, 3, 7, 11, 2 ]
What Terraform function could you use to select the largest number from the list?
A. max(numcpus)
B. ceil(numcpus)
C. top(numcpus)
D. high[numcpus]
Answer
A