Introduction
Sometimes you need to use resources that already exist outside your Terraform setup. Querying existing resources lets you get their details so you can use them in your Terraform configuration without recreating them.
When you want to use an existing cloud network in your Terraform project without creating a new one.
When you need to attach a new server to an existing database managed outside Terraform.
When you want to reference an existing storage bucket for your application files.
When you want to get the ID of an existing virtual machine to add security rules.
When you want to import details of existing infrastructure to avoid duplication.