0
0
Terraformcloud~20 mins

Data source vs resource difference in Terraform - Practice Questions

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Terraform Data Source vs Resource Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Terraform Data Sources

In Terraform, what is the primary purpose of a data source?

ATo delete existing infrastructure resources
BTo create new infrastructure resources managed by Terraform
CTo fetch and use information about existing infrastructure outside Terraform's control
DTo define variables for Terraform configurations
Attempts:
2 left
💡 Hint

Think about whether data sources create or just read information.

🧠 Conceptual
intermediate
2:00remaining
Terraform Resource Behavior

Which statement best describes a resource in Terraform?

AIt is a temporary placeholder with no real effect
BIt only reads information from existing infrastructure
CIt is used to store configuration variables
DIt represents infrastructure components that Terraform creates and manages
Attempts:
2 left
💡 Hint

Resources are the main building blocks Terraform controls.

Architecture
advanced
2:00remaining
Choosing Between Data Source and Resource

You want to use an existing AWS VPC ID in your Terraform configuration without creating a new VPC. Which is the best approach?

AUse a <code>resource</code> block to create a new VPC with the existing ID
BUse a <code>data</code> block to fetch the existing VPC ID
CUse a variable to hardcode the VPC ID without fetching it
DUse a <code>resource</code> block to import the existing VPC
Attempts:
2 left
💡 Hint

Think about how to reference existing infrastructure without creating it.

service_behavior
advanced
2:00remaining
Terraform Resource Lifecycle Behavior

What happens when you remove a resource block from your Terraform configuration and run terraform apply?

ATerraform deletes the corresponding infrastructure resource
BTerraform ignores the resource and leaves it unchanged
CTerraform converts the resource into a data source
DTerraform throws an error and stops
Attempts:
2 left
💡 Hint

Consider how Terraform manages resources it no longer sees in the config.

security
expert
3:00remaining
Security Implications of Using Data Sources

Which security risk is most relevant when using Terraform data sources to fetch sensitive information like passwords or keys?

ASensitive data may be exposed in Terraform state files if not encrypted
BData sources automatically encrypt sensitive data in logs
CUsing data sources disables Terraform's access controls
DData sources prevent any sensitive data from being stored locally
Attempts:
2 left
💡 Hint

Think about where Terraform stores fetched data and how it handles sensitive info.