what is the difference between data and resource in terraform?
Whereas a resource causes Terraform to create and manage a new infrastructure component, data sources present read-only views into pre-existing data, or they compute new values on the fly within Terraform itself. ... Every data source in Terraform is mapped to a provider based on longest-prefix matching.