NEW
Font size
WorksheetsTerraform KPMG Day 5
Total questions: 20
Worksheet time: 10mins
In your Terraform configuration, you have two resources: an AWS S3 bucket and an AWS EC2 instance. You want to ensure that the EC2 instance is provisioned only after the S3 bucket is successfully created.
Which Terraform attribute should you use to establish this dependency?
requires
after
depends_on
connected_to
Your team is collaborating on a Terraform project, and you're concerned about potential conflicts when multiple team members try to apply changes simultaneously. Which feature of Terraform helps prevent such conflicts?
State management
Locking
State commands
Terraform Cloud
You want to inspect the details of resources managed by Terraform within your project. Which Terraform command should you use?
terraform plan
terraform apply
terraform show
terraform state list
You want to list all resources tracked by Terraform within your project. Which Terraform command would provide you with this information?
terraform state list
terraform state show
terraform state pull
terraform state refresh
In your Terraform project, you have accidentally deleted an EC2 resource outside of Terraform, and now you need to remove it from Terraform's state file to avoid conflicts. Which Terraform command should you use to remove the resource from the state file?
terraform state remove aws_instance.example
terraform state rm aws_instance.example
terraform state delete aws_instance.example
terraform state clean aws_instance.example
Where in your Terraform configuration do you specify a state backend?
The terraform block
The resource block
The provider block
The datasource block
After making several changes to your infrastructure, you realize that the state file includes some outdated resources that no longer exist. Which command can remove these resources from the state file without affecting the actual infrastructure?
terraform destroy
terraform state rm
terraform state mv
terraform state pull
If you want to list all resources managed by a specific Terraform state file before merging, which command should you use?
terraform state show
terraform state list
terraform plan
terraform import
You suspect there might be issues with your current state file and want to manually inspect its contents. Which command would you use to download and view the state file in JSON format?
terraform state show
terraform state pull
terraform plan
terraform state list
You need to inspect the details of a specific resource within your state file to verify its attributes. Which command should you use?
terraform state list
terraform state show
terraform plan
terraform state mv
You want to clean up your state file by removing resources that are no longer needed, but you want to confirm the exact resource names first. Which sequence of commands should you use?
terraform plan followed by terraform destroy
terraform state list followed by terraform state rm
terraform state show followed by terraform state rm
terraform apply followed by terraform state rm
When should you use terraform init -reconfigure?
When adding a new resource to your configuration
When changing the backend configuration details
When viewing the current state of the infrastructure
When upgrading Terraform to a new version
Which terraform command can be executed without initializing terraform?
terraform format
terraform plan
terraform fmt
terraform apply
When does terraform apply reflect changes in the cloud environment
Immediately
however long it takes the provider to fulfill the request
After updating the state file
After a minimum wait period of 1 min
All standard backends support state storage, locking, and remote operations like plan, apply and destroy
True
False
What is the default backends used by terraform CLI?
Terraform Cloud
Consul
Remote
Local
Which statement describes a goal of IAC?
An abstraction from vendor specific APIs
Write once, run anywhere
A pipeline process to test and deliver software
The programmatic configuration of resources
A Terraform local value can reference other Terraform variables
True
False
Terraform can run on Windows or Linux, but it requires a Server version of the Windows operating system.
True
False
What does the default "local" Terraform backend store?
tfplan files
Terraform binary
Provider plugins
State file
