Skip to content

Instantly share code, notes, and snippets.

@brainsik brainsik/cidrs.tf
Last active Nov 16, 2018

Embed
What would you like to do?
Takes a list of VPC names and outputs their ID and CIDR
data "aws_vpc" "found" {
count = "${length(var.vpc_names)}"
filter {
name = "tag:Name"
values = ["${element(var.vpc_names, count.index)}"]
}
}
output "vpc_id" {
value = "${formatlist("%21s %s", data.aws_vpc.found.*.id, data.aws_vpc.found.*.cidr_block)}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.