Day 13 - Terraform Data Sources
Today’s learning felt like a shift from “building everything” to working intelligently with what already exists . Until now, most of my Terraform work was about creating infrastructure. But in real-world cloud environments, things are rarely that simple. Networks, security layers, and shared resources are often already in place, managed by different teams. This is where Terraform data sources come in. What Are Terraform Data Sources Terraform data sources allow us to read existing infrastructure instead of creating it. A simple way to think about it: Resources → Create and manage infrastructure Data Sources → Read and reference existing infrastructure This distinction is small in syntax, but huge in real-world usage. Scenario for This Demo In this lab, I simulated a real-world setup: A shared VPC already exists A shared subnet already exists My job is to launch an EC2 instance inside that network The key rule: I should NOT recreate the VPC or subnet I sho...