From cf8a54c783b9772db77ccc830659e94a5b7b0523 Mon Sep 17 00:00:00 2001 From: Steven Nemetz Date: Tue, 8 Jan 2019 15:36:44 -0800 Subject: [PATCH] Add private subnet cidr blocks output --- outputs.tf | 4 ++++ private.tf | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/outputs.tf b/outputs.tf index cebb5f51..216cbb9f 100644 --- a/outputs.tf +++ b/outputs.tf @@ -13,3 +13,7 @@ output "public_route_table_ids" { output "private_route_table_ids" { value = ["${aws_route_table.private.*.id}"] } + +output "private_subnet_cidr_blocks" { + value = ["${data.aws_subnet.private_subnets.*.cidr_block}"] +} diff --git a/private.tf b/private.tf index 8e4502a0..b183396d 100644 --- a/private.tf +++ b/private.tf @@ -29,6 +29,11 @@ resource "aws_subnet" "private" { tags = "${merge(module.private_subnet_label.tags, map("Name",format("%s%s%s", module.private_subnet_label.id, var.delimiter, replace(element(var.availability_zones, count.index),"-",var.delimiter))))}" } +data "aws_subnet" "private_subnets" { + count = "${length(var.availability_zones)}" + id = "${element(aws_subnet.private.*.id, count.index)}" +} + resource "aws_route_table" "private" { count = "${length(var.availability_zones)}"