Recall & Review
beginner
What is a resource in Terraform?
A resource is an infrastructure object that Terraform creates, updates, or deletes. It represents real cloud services like servers, databases, or networks.
Click to reveal answer
beginner
What is a data source in Terraform?
A data source lets Terraform read or fetch information from existing infrastructure or external sources without changing them.
Click to reveal answer
beginner
How does a resource differ from a data source in Terraform?
Resources create or manage infrastructure, while data sources only read existing information without making changes.
Click to reveal answer
intermediate
Why use a data source instead of a resource?
Use a data source to get details about existing infrastructure you did not create or want to keep unchanged.
Click to reveal answer
intermediate
Give an example of when to use a resource vs a data source.
Use a resource to create a new virtual machine. Use a data source to get the IP address of an existing database.
Click to reveal answer
What does a Terraform resource do?
✗ Incorrect
Resources create, update, or delete infrastructure objects.
What is the main purpose of a Terraform data source?
✗ Incorrect
Data sources fetch information from existing infrastructure without changing it.
Which Terraform block would you use to get the IP of an existing server?
✗ Incorrect
Data blocks read existing information like IP addresses.
If you want to create a new database, which Terraform block do you use?
✗ Incorrect
Resources create new infrastructure components.
Can a data source modify infrastructure?
✗ Incorrect
Data sources only read existing infrastructure; they do not modify it.
Explain the difference between a Terraform resource and a data source.
Think about who controls the infrastructure changes.
You got /4 concepts.
When would you choose to use a data source instead of a resource in Terraform?
Consider scenarios where infrastructure is already set up.
You got /4 concepts.