uwieuwe4
uwieuwe4

Reputation: 153

How to output values from data blocks in Terraform?

In Terraform it is possible to output values from self created resources.

Now I want to output values from resources that are fetched via data block.
I could not find any information on that.

Is it possible? If yes, how?

Upvotes: 2

Views: 3959

Answers (1)

BMW
BMW

Reputation: 45223

Same way. For example, I defined the data source aws_vpc

data "aws_vpc" "vpc" {
  tags {
    Name = "development"
  }
}

You can use it in output as below

output "vpic_id" {
  value = "${data.aws_vpc.vpc.id}"
}

Upvotes: 5

Related Questions