Query existing infrastructure data for use in resources.
Section: Dynamic Blocks and Data Sources
Data source example
hcl
hcl
data "aws_ami" "ubuntu" {
most_recent = true
owners = ["099720109477"]
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"]
}
}Explanation
Query existing infrastructure data for use in resources.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Dynamic Blocks and Data Sources