Last active
November 16, 2018 01:44
-
-
Save brainsik/e67e804a9aa2e90e02ac60e214b52937 to your computer and use it in GitHub Desktop.
Takes a list of VPC names and outputs their ID and CIDR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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