Data Sources in Terraform resources explained with example

  • Data sources provide dynamic information about entities that are not managed by the current Terraform and configuration.
  • Variables provide static information.
  • Referencing a resource defined in a data source won’t create the resource itself, and your plan will fail if you reference nonexistent data or infrastructure.
  • Data sources allow data to be fetched or computed for use elsewhere in Terraform configuration.
  • External data sources must return information in JSON format.

This may include:

  • Configuration data from Consul
  • Information about the state of manually-configured infrastructure components
  • Another Terraform configuration
  • Defined outside of Terraform
  • Defined by another separate Terraform configuration.
Rajesh Kumar
Total Page Visits: 89 - Today Page Visits: 1