Terraform Associate: HashiCorp Certified Part 2
Question #: 31
Topic #: 1
Which of the following is available only in Terraform Enterprise or Cloud workspaces and not in Terraform CLI?
A. Secure variable storage
B. Support for multiple cloud providers
C. Dry runs with terraform plan
D. Using the workspace as a data source
Selected Answer: A
Question #: 32
Topic #: 1
terraform validate validates the syntax of Terraform files.
A. True
B. False
Selected Answer: A
Question #: 33
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. This is not possible. You can only show resources that will be created.
C. Run terraform state rm *.
D. Run terraform destroy and it will first output all the resources that will be deleted before prompting for approval.
Selected Answer: AD
Question #: 34
Topic #: 1
Which of the following is the correct way to pass the value in the variable num_servers into a module with the input servers?
A. servers = num_servers
B. servers = variable.num_servers
C. servers = var(num_servers)
D. servers = var.num_servers
Selected Answer: D
Question #: 35
Topic #: 1
A Terraform provisioner must be nested inside a resource configuration block.
A. True
B. False
Selected Answer: A
Question #: 36
Topic #: 1
Terraform can run on Windows or Linux, but it requires a Server version of the Windows operating system.
A. True
B. False
Selected Answer: B
Question #: 37
Topic #: 1
What does the default “local” Terraform backend store?
A. tfplan files
B. Terraform binary
C. Provider plugins
D. State file
Selected Answer: D
Question #: 38
Topic #: 1
You have multiple team members collaborating on infrastructure as code (IaC) using Terraform, and want to apply formatting standards for readability.
How can you format Terraform HCL (HashiCorp Configuration Language) code according to standard Terraform style convention?
A. Run the terraform fmt command during the code linting phase of your CI/CD process
B. Designate one person in each team to review and format everyone’s code
C. Manually apply two spaces indentation and align equal sign “=” characters in every Terraform file (*.tf)
D. Write a shell script to transform Terraform files using tools such as AWK, Python, and sed
Selected Answer: A
Question #: 39
Topic #: 1
What value does the Terraform Cloud/Terraform Enterprise private module registry provide over the public Terraform Module Registry?
A. The ability to share modules with public Terraform users and members of Terraform Enterprise Organizations
B. The ability to tag modules by version or release
C. The ability to restrict modules to members of Terraform Cloud or Enterprise organizations
D. The ability to share modules publicly with any user of Terraform
Selected Answer: C
Question #: 40
Topic #: 1
Which task does terraform init not perform?
A. Sources all providers present in the configuration and ensures they are downloaded and available locally
B. Connects to the backend
C. Sources any modules and copies the configuration locally
D. Validates all required variables are present
Selected Answer: D
Question #: 41
Topic #: 1
You have declared a variable called var.list which is a list of objects that all have an attribute id.
Which options will produce a list of the IDs? (Choose two.)
A. { for o in var.list : o => o.id }
B. var.list[*].id
C. [ var.list[*].id ]
D. [ for o in var.list : o.id ]
Selected Answer: BD
Question #: 42
Topic #: 1
Which argument(s) is (are) required when declaring a Terraform variable?
A. type
B. default
C. description
D. All of the above
E. None of the above
Selected Answer: E
Question #: 43
Topic #: 1
When using a module block to reference a module stored on the public Terraform Module Registry such as:
How do you specify version 1.0.0?
A. Modules stored on the public Terraform Module Registry do not support versioning
B. Append ?ref=v1.0.0 argument to the source path
C. Add version = “1.0.0” attribute to module block
D. Nothing ג€” modules stored on the public Terraform Module Registry always default to version 1.0.0
Selected Answer: C
Question #: 44
Topic #: 1
What features does the hosted service Terraform Cloud provide? (Choose two.)
A. Automated infrastructure deployment visualization
B. Automatic backups
C. Remote state storage
D. A web-based user interface (UI)
Selected Answer: CD
Question #: 45
Topic #: 1
Where does the Terraform local backend store its state?
A. In the /tmp directory
B. In the terraform file
C. In the terraform.tfstate file
D. In the user’s terraform.state file
Selected Answer: C
Question #: 46
Topic #: 1
Which option can not be used to keep secrets out of Terraform configuration files?
A. A Terraform provider
B. Environment variables
C. A -var flag
D. secure string
Selected Answer: D
Question #: 47
Topic #: 1
Which option can not be used to keep secrets out of Terraform configuration files?
A. A Terraform provider
B. Environment variables
C. A -var flag
D. secure string
Selected Answer: D
Question #: 48
Topic #: 1
What is one disadvantage of using dynamic blocks in Terraform?
A. They cannot be used to loop through a list of values
B. Dynamic blocks can construct repeatable nested blocks
C. They make configuration harder to read and understand
D. Terraform will run more slowly
Selected Answer: C
Question #: 49
Topic #: 1
Only the user that generated a plan may apply it.
A. True
B. False
Selected Answer: B
Question #: 50
Topic #: 1
Examine the following Terraform configuration, which uses the data source for an AWS AMI.
What value should you enter for the ami argument in the AWS instance resource?
A. aws_ami.ubuntu
B. data.aws_ami.ubuntu
C. data.aws_ami.ubuntu.id
D. aws_ami.ubuntu.id
Selected Answer: C
Question #: 51
Topic #: 1
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.
B. The Terraform state file only contains the one new VM. Execute terraform destroy.
C. Delete the Terraform state file and execute Terraform apply.
D. Delete the VM using the cloud provider console and terraform apply to apply the changes to the Terraform state file.
Selected Answer: B
Question #: 52
Topic #: 1
What is the name assigned by Terraform to reference this resource?
A. dev
B. azurerm_resource_group
C. azurerm
D. test
Selected Answer: A
Question #: 53
Topic #: 1
Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged into syslog.
A. True
B. False
Selected Answer: B
Question #: 54
Topic #: 1
Where in your Terraform configuration do you specify a state backend?
A. The terraform block
B. The resource block
C. The provider block
D. The datasource block
Selected Answer: A
Question #: 55
Topic #: 1
In Terraform 0.13 and above, outside of the required_providers block, Terraform configurations always refer to providers by their local names.
A. True
B. False
Selected Answer: A
Question #: 56
Topic #: 1
What command should you run to display all workspaces for the current configuration?
A. terraform workspace
B. terraform workspace show
C. terraform workspace list
D. terraform show workspace
Selected Answer: C
Question #: 57
Topic #: 1
Terraform providers are always installed from the Internet.
A. True
B. False
Selected Answer: B
Question #: 58
Topic #: 1
Which of these is the best practice to protect sensitive values in state files?
A. Blockchain
B. Secure Sockets Layer (SSL)
C. Enhanced remote backends
D. Signed Terraform providers
Selected Answer: C
Question #: 59
Topic #: 1
When does terraform apply reflect changes in the cloud environment?
A. Immediately
B. However long it takes the resource provider to fulfill the request
C. After updating the state file
D. Based on the value provided to the -refresh command line argument
E. None of the above
Selected Answer: B
Question #: 60
Topic #: 1
How would you reference the “name” value of the second instance of this fictitious resource?
A. element(aws_instance.web, 2)
B. aws_instance.web[1].name
C. aws_instance.web[1]
D. aws_instance.web[2].name
E. aws_instance.web.*.name
Selected Answer: B