Skip to content

Instantly share code, notes, and snippets.



Last active Nov 16, 2018
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