Overview - Data source vs resource difference
What is it?
In Terraform, a resource is something you create and manage, like a server or a database. A data source is a way to look up or read information about something that already exists outside your Terraform setup. Resources change your cloud environment, while data sources only read information without making changes.
Why it matters
Understanding the difference helps you avoid mistakes like trying to create something that already exists or accidentally changing infrastructure you only wanted to observe. Without this, managing cloud infrastructure can become confusing and error-prone, leading to downtime or unexpected costs.
Where it fits
Before learning this, you should know basic Terraform concepts like providers and configuration files. After this, you can learn about Terraform modules and state management to organize and reuse your infrastructure code better.