Font size
WorksheetsTerraform KPMG Day 1
Total questions: 15
Worksheet time: 9mins
How would you define Terraform?
A configuration management tool
An orchestration tool
An infrastructure as code tool
A continuous integration tool
What is the primary language used by terraform to define resources and infrastructure?
YAML
JSON
HCL
XML
Which command initializes the terraform configuration?
terraform start
terraform init
terraform fmt
terraform apply
What does the terraform plan command do?
Applies the changes required to reach the desired state of the configuration
Shows the execution plan for the changes required to reach the desired state
Initializes the configuration
Deletes the resources defined in the configuration
Which file format is used by Terraform to store infrastructure state data?
YAML
HCL
JSON
XML
Which among the following is an apt description of Terraform providers?
A module that provides configuration files
A plugin that allows Terraform to interact with cloud providers
A feature to manage multiple configurations
A tool to visualize infrastructure
When checking the syntax of Terraform configuration files, which command ought to be executed?
terraform check
terraform validate
terraform plan
terraform fmt
How can you format Terraform configuration files?
terraform plan
terraform validate
terraform fmt
terraform format
What is the purpose of the Terraform state file?
To store the configuration files
To store metadata about terraform
To keep track of resources managed by Terraform
To define variables and outputs
Which two Terraform commands will refresh the state automatically unless given additional flags or arguments? Choose TWO correct answers.
terraform plan
terraform state
terraform apply
terraform validate
What happens when you apply Terraform configuration? Choose TWO correct answers.
Terraform makes any infrastructure changes that are defined in your configuration.
Terraform gets the plugins that the configuration requires.
Terraform updates the state file with the configuration changes it made.
Terraform will destroy and recreate all your infrastructure from scratch.
What is the workflow for deploying new infrastructure when using Terraform?
Use the Terraform plan command to import the current infrastructure to the state file, make code changes, and run the Terraform apply command to update the infrastructure.
Write the Terraform configuration, run the terraform show command to view proposed changes, and run terraform apply to create the new infrastructure.
Terraform import is used to import the current infrastructure to the state file, make code changes, and apply terraform to update the infrastructure.
Write a Terraform configuration, run Terraform init, run Terraform plan to view planned infrastructure changes, and terraform apply to create new infrastructure.
You've used Terraform to construct a cloud-based development environment and are now prepared to destroy all of the infrastructure outlined in your Terraform setup. To be safe, you should first view all of the infrastructure that Terraform would remove.
Which terraform command will show all of the resources to be deleted? (Choose two.)
Run terraform plan -destroy.
This is not possible. You can just display the resources that will be created.
Run terraform state rm *.
Run terraform destroy first which will first output all the resources that will be deleted before prompting for approval.
Which task does the Terraform init command NOT perform?
Ensures that all providers in the setup are downloaded and available locally.
Connects to the backend
Locates any modules and replicates the configuration locally.
Validates all required variables are present
You have never used Terraform before and would like to test it out using a shared team account for a cloud provider. Your shared team account currently holds fifteen virtual machines (VMs). You develop a Terraform configuration containing one VM, perform terraform apply, and see that your VM was created successfully.
What exactly must be done to delete your newly generated Terraform VM?
The Terraform state file contains all 16 VMs in the team account. Execute terraform destroy and select the newly-created VM.
The Terraform state file contains only one new VM. Execute terraform destroy.
Delete the Terraform state file and execute Terraform apply.
Delete the VM from the cloud service provider console and run Terraform apply to set up the modifications into the Terraform state file.
