Introduction
When managing infrastructure with Terraform, you often need to use existing resources or create new ones. Data sources let you read information about existing infrastructure, while resources let you create or change infrastructure. Understanding the difference helps you manage your cloud setup correctly.
When you want to use details of an existing cloud resource without changing it, like reading a VPC ID.
When you need to create a new server, database, or network component from scratch.
When you want to reference existing infrastructure in your Terraform code without managing its lifecycle.
When you want Terraform to manage the lifecycle of a resource, including creation, update, and deletion.
When you want to combine existing infrastructure data with new resources in your setup.