How are Data Sources Useful?

In this lesson, we'll discuss Terraform data source advantages.

Terraform data source advantages

As your Terraform project grows, it can be sensible to break it up into smaller projects to make for easier maintenance. When this happens, you can use data sources to reference and utilize resources across Terraform projects. In this case, it would always be better to use a data source rather than to compute the arn yourself, as with something like an S3 bucket. This is because you want Terraform to fail if, for some reason, the bucket no longer exists. By using a data source, you maintain this behavior.

Get hands-on with 1400+ tech skills courses.