DELAPARRA
Index
Color
NL
Category: Terraform

data source

Explained by Updated

What is data source?

data source: Reads existing information from a provider without creating anything — look up an AMI, an existing VPC, your account ID. A data source in Terraform reads information that already exists, without creating or changing anything. You can look up the latest Ubuntu image, an existing network, a DNS zone or your account ID.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about data source

How is data source used in practice?

It lets your configuration work with resources managed elsewhere, by another team, another Terraform project or by hand. Instead of copying an ID into your code, you look it up by name each time.

What should you keep in mind with data source?

Data sources are read during every plan, so they always reflect the current state. That is usually what you want, but it can surprise you. A lookup for "the most recent image" may return a new one next week, and Terraform will then propose replacing your servers. Pin to a specific version when stability matters more than freshness.

What does an example of data source look like?

data "aws_ami" "ubuntu" { most_recent = true owners = ["099720109477"] }

At a glance

CategoryTerraform
Explained by
Updated

More Terraform terms

All terms starting with D

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.