Terraform Data Sources | How to Use Data Sources?
Rahul Wagh
Posted on December 14, 2021
GitHub Project - https://github.com/rahulwagh/Terraform-Topics/tree/master/data-sources
Terraform data sources can be used to fetch information back from the Cloud service provider (AWS, Google Cloud, Azure etc..). Along with your terraform provisioning script you need to write the terraform data source resource block for creating the data sources.
Terraform data sources can help you to fetch -
- Internal IP
- External IP
- Instance ID
- Tags
and much more other information associated with your terraform resource which can help automate your infrastructure code.
In this lab session, we are going to create a Terraform Data source to fetch the public IP of an EC2 instance. But similar terraform script can be written for other cloud resources such as S3 Bucket, IAM Rule, etc.
Posted on December 14, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.