Terraform Associate: HashiCorp Certified Part 4
Question #: 91
Topic #: 1
What type of block is used to construct a collection of nested configuration blocks?
A. for_each
B. repeated
C. nesting
D. dynamic
Selected Answer: D
Question #: 92
Topic #: 1
Module variable assignments are inherited from the parent module and do not need to be explicitly set.
A. True
B. False
Selected Answer: B
Question #: 93
Topic #: 1
If writing Terraform code that adheres to the Terraform style conventions, how would you properly indent each nesting level compared to the one above it?
A. With four spaces
B. With a tab
C. With three spaces
D. With two spaces
Selected Answer: D
Question #: 94
Topic #: 1
Which of the following is not an action performed by terraform init?
A. Create a sample main.tf file
B. Initialize a configured backend
C. Retrieve the source code for all referenced modules
D. Load required provider plugins
Selected Answer: A
Question #: 95
Topic #: 1
HashiCorp Configuration Language (HCL) supports user-defined functions.
A. True
B. False
Selected Answer: B
Question #: 96
Topic #: 1
How can you trigger a run in a Terraform Cloud workspace that is connected to a Version Control System (VCS) repository?
A. Only Terraform Cloud organization owners can set workspace variables on VCS connected workspaces
B. Commit a change to the VCS working directory and branch that the Terraform Cloud workspace is connected to
C. Only members of a VCS organization can open a pull request against repositories that are connected to Terraform Cloud workspaces
D. Only Terraform Cloud organization owners can approve plans in VCS connected workspaces
Selected Answer: B
Question #: 97
Topic #: 1
Terraform and Terraform providers must use the same major version number in a single configuration.
A. True
B. False
Selected Answer: B
Question #: 98
Topic #: 1
Which statement describes a goal of infrastructure as code?
A. An abstraction from vendor specific APIs
B. Write once, run anywhere
C. A pipeline process to test and deliver software
D. The programmatic configuration of resources
Selected Answer: D
Question #: 99
Topic #: 1
When using Terraform to deploy resources into Azure, which scenarios are true regarding state files? (Choose two.)
A. When a change is made to the resources via the Azure Cloud Console, the changes are recorded in a new state file
B. When a change is made to the resources via the Azure Cloud Console, Terraform will update the state file to reflect them during the next plan or apply
C. When a change is made to the resources via the Azure Cloud Console, the current state file will not be updated
D. When a change is made to the resources via the Azure Cloud Console, the changes are recorded in the current state file
Selected Answer: C
Question #: 100
Topic #: 1
You need to deploy resources into two different cloud regions in the same Terraform configuration. To do that, you declare multiple provider configurations as follows:
What meta-argument do you need to configure in a resource block to deploy the resource to the `us-west-2` AWS region?
A. alias = west
B. provider = west
C. provider = aws.west
D. alias = aws.west
Selected Answer: C
Question #: 101
Topic #: 1
You have declared an input variable called environment in your parent module. What must you do to pass the value to a child module in the configuration?
A. Add node_count = var.node_count
B. Declare the variable in a terraform.tfvars file
C. Declare a node_count input variable for child module
D. Nothing, child modules inherit variables of parent module
Selected Answer: C
Question #: 102
Topic #: 1
If a module declares a variable with a default, that variable must also be defined within the module.
A. True
B. False
Selected Answer: B
Question #: 103
Topic #: 1
Which option cannot be used to keep secrets out of Terraform configuration files?
A. Environment Variables
B. Mark the variable as sensitive
C. A Terraform provider
D. A -var flag
Selected Answer: B
Question #: 104
Topic #: 1
Which of the following arguments are required when declaring a Terraform output?
A. sensitive
B. description
C. default
D. value
Selected Answer: D
Question #: 105
Topic #: 1
Your risk management organization requires that new AWS S3 buckets must be private and encrypted at rest. How can Terraform Enterprise automatically and proactively enforce this security control?
A. With a Sentinel policy, which runs before every apply
B. By adding variables to each TFE workspace to ensure these settings are always enabled
C. With an S3 module with proper settings for buckets
D. Auditing cloud storage buckets with a vulnerability scanning tool
Selected Answer: A
Question #: 106
Topic #: 1
Most Terraform providers interact with ____________.
A. API
B. VCS Systems
C. Shell scripts
D. None of the above
Selected Answer: A
Question #: 107
Topic #: 1
terraform validate validates that your infrastructure matches the Terraform state file.
A. True
B. False
Selected Answer: B
Question #: 108
Topic #: 1
What does terraform import allow you to do?
A. Import a new Terraform module
B. Use a state file to import infrastructure to the cloud
C. Import provisioned infrastructure to your state file
D. Import an existing state file to a new Terraform workspace
Selected Answer: C
Question #: 109
Topic #: 1
How would you reference the Volume IDs associated with the ebs_block_device blocks in this configuration?
A. aws_instance.example.ebs_block_device.[*].volume_id
B. aws_instance.example.ebs_block_device.volume_id
C. aws_instance.example.ebs_block_device[sda2,sda3].volume_id
D. aws_instance.example.ebs_block_device.*.volume_id
Selected Answer: D
Question #: 110
Topic #: 1
What does state locking accomplish?
A. Copies the state file from memory to disk
B. Encrypts any credentials stored within the state file
C. Blocks Terraform commands from modifying the state file
D. Prevents accidental deletion of the state file
Selected Answer: C
Question #: 111
Topic #: 1
You just upgraded the version of a provider in an existing Terraform project. What do you need to do to install the new provider?
A. Run terraform apply -upgrade
B. Run terraform init -upgrade
C. Run terraform refresh
D. Upgrade your version of Terraform
Selected Answer: B
Question #: 112
Topic #: 1
A module can always refer to all variables declared in its parent module.
A. True
B. False
Selected Answer: B
Question #: 113
Topic #: 1
When you use a remote backend that needs authentication, HashiCorp recommends that you:
A. Use partial configuration to load the authentication credentials outside of the Terraform code
B. Push your Terraform configuration to an encrypted git repository
C. Write the authentication credentials in the Terraform configuration files
D. Keep the Terraform configuration files in a secret store
Selected Answer: A
Question #: 114
Topic #: 1
You have a simple Terraform configuration containing one virtual machine (VM) in a cloud provider. You run terraform apply and the VM is created successfully.
What will happen if you terraform apply again immediately afterwards without changing any Terraform code?
A. Terraform will terminate and recreate the VM
B. Terraform will create another duplicate VM
C. Terraform will apply the VM to the state file
D. Nothing
Selected Answer: D
Question #: 115
Topic #: 1
A junior admin accidentally deleted some of your cloud instances. What does Terraform do when you run terraform apply?
A. Build a completely brand new set of infrastructure
B. Tear down the entire workspace infrastructure and rebuild it
C. Rebuild only the instances that were deleted
D. Stop and generate an error message about the missing instances
Selected Answer: C
Question #: 116
Topic #: 1
You have created a main.tr Terraform configuration consisting of an application server, a database, and a load balancer. You ran terraform apply and all resources were created successfully. Now you realize that you do not actually need the load balancer so you run terraform destroy without any flags What will happen?
A. Terraform will destroy the application server because it is listed first in the code
B. Terraform will prompt you to confirm that you want to destroy all the infrastructure
C. Terraform will destroy the main.tf file
D. Terraform will prompt you to pick which resource you want to destroy
E. Terraform will immediately destroy all the infrastructure
Selected Answer: B
Question #: 117
Topic #: 1
Which type of block fetches or computes information for use elsewhere in a Terraform configuration?
A. provider
B. resource
C. local
D. data
Selected Answer: D
Question #: 118
Topic #: 1
You have just developed a new Terraform configuration for two virtual machines with a cloud provider. You would like to create the infrastructure for the first time.
Which Terraform command should you run first?
A. terraform apply
B. terraform plan
C. terraform show
D. terraform init
Selected Answer: D
Question #: 119
Topic #: 1
All modules published on the official Terraform Module Registry have been verified by HashiCorp.
A. True
B. False
Selected Answer: B
Question #: 120
Topic #: 1
You have to initialize a Terraform backend before it can be configured.
A. True
B. False
Selected Answer: B