Terraform

How to get data out of a data source?

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

The general syntax is data...

So if you defined the following data source

data "aws_vpc" "default {
  default = true
}

You can retrieve the ID attribute this way: data.aws_vpc.default.id