What does the terraform_remote_state data source in Terraform allow you to do?
Think about how Terraform can share information between separate projects.
The terraform_remote_state data source lets one Terraform configuration read outputs from another configuration's state file, enabling resource sharing.
Which Terraform code snippet correctly configures terraform_remote_state to read from an S3 backend named prod-state in region us-west-2?
Remember the correct block type and where to put backend configuration.
The terraform_remote_state data source requires a data block with backend and config map specifying bucket and region. Region must match the actual bucket location.
You have multiple Terraform projects that need to share outputs securely using terraform_remote_state. Which approach is best to ensure security and least privilege?
Think about controlling who can read state files and limiting exposure.
Using separate buckets with strict IAM policies limits access to only authorized projects, following least privilege and improving security.
What happens if you change the backend configuration of a terraform_remote_state data source from S3 to local without updating the actual state files?
Consider what happens if the backend points to a location without the expected state.
Changing backend to local requires the state file to exist locally. If it doesn't, Terraform errors because it cannot find the state.
You want to use terraform_remote_state to share outputs but avoid exposing sensitive values like passwords. Which Terraform practice ensures sensitive outputs are not exposed?
Think about Terraform's built-in way to mark outputs as sensitive.
Marking outputs as sensitive prevents Terraform from showing them in CLI or logs and discourages referencing them in other modules, reducing exposure risk.