In Terraform, what is the primary purpose of a data source?
Think about whether data sources create or just read information.
Data sources in Terraform are used to read or fetch information about existing infrastructure that Terraform does not manage directly. They do not create or modify resources.
Which statement best describes a resource in Terraform?
Resources are the main building blocks Terraform controls.
Resources in Terraform define infrastructure components that Terraform creates, updates, and deletes as part of managing your infrastructure.
You want to use an existing AWS VPC ID in your Terraform configuration without creating a new VPC. Which is the best approach?
Think about how to reference existing infrastructure without creating it.
Using a data source allows Terraform to read the existing VPC ID without managing or creating it. Creating a resource would attempt to create a new VPC.
What happens when you remove a resource block from your Terraform configuration and run terraform apply?
Consider how Terraform manages resources it no longer sees in the config.
When a resource block is removed, Terraform plans to delete the actual infrastructure resource to match the configuration state.
Which security risk is most relevant when using Terraform data sources to fetch sensitive information like passwords or keys?
Think about where Terraform stores fetched data and how it handles sensitive info.
Terraform stores all fetched data, including sensitive info from data sources, in its state file. If the state file is not secured or encrypted, this can expose secrets.