0
0
Terraformcloud~20 mins

Why data sources query existing infrastructure in Terraform - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Data Source Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why use data sources in Terraform?

What is the main reason Terraform uses data sources to query existing infrastructure?

ATo retrieve information about resources created outside Terraform for use in the current configuration
BTo delete resources that are no longer needed
CTo create new resources based on existing resource templates
DTo automatically update Terraform version to match the infrastructure
Attempts:
2 left
💡 Hint

Think about how Terraform can use information from resources it did not create.

service_behavior
intermediate
2:00remaining
Effect of data sources on Terraform state

When Terraform uses a data source to query existing infrastructure, what happens to the Terraform state file?

AThe state file ignores data source information completely
BThe state file deletes the existing resource from the cloud provider
CThe state file creates a new resource entry for the data source
DThe state file records the data source information but does not manage the resource lifecycle
Attempts:
2 left
💡 Hint

Consider how Terraform tracks resources it manages versus resources it only reads.

Architecture
advanced
3:00remaining
Using data sources to integrate multi-team infrastructure

Your team manages a network infrastructure, and another team manages virtual machines. How can Terraform data sources help your team use the network information without recreating it?

ABy deleting the existing network and recreating it within your Terraform configuration
BBy querying the existing network resources as data sources, your team can reference network IDs without managing them
CBy manually copying network configuration files into your Terraform code
DBy importing the network resources into your Terraform state and managing them directly
Attempts:
2 left
💡 Hint

Think about how to safely use resources managed by others without conflicts.

security
advanced
3:00remaining
Security considerations when using data sources

What is a key security consideration when Terraform queries existing infrastructure using data sources?

ADisable authentication to speed up data source queries
BGrant Terraform full admin permissions to all resources for flexibility
CEnsure Terraform has read-only permissions to prevent accidental changes to existing resources
DStore sensitive data from data sources in public repositories for easy access
Attempts:
2 left
💡 Hint

Think about the principle of least privilege in cloud security.

Best Practice
expert
4:00remaining
Best practice for managing dependencies with data sources

When using Terraform data sources to query existing infrastructure, what is the best practice to ensure reliable and consistent deployments?

AAvoid declaring dependencies and rely on Terraform's automatic ordering
BExplicitly declare dependencies using <code>depends_on</code> to control resource creation order
CManually run separate Terraform commands for data sources and resources
DUse data sources to create resources dynamically during apply
Attempts:
2 left
💡 Hint

Consider how Terraform manages resource creation order and dependencies.