From 4611bb2220a8f15a3f0e70eb77d5d6cf002c060e Mon Sep 17 00:00:00 2001 From: Andriy Knysh Date: Wed, 16 Aug 2017 21:41:14 -0400 Subject: [PATCH] Add Outputs for public & private subnet ids (#5) * Added outputs.tf * Added `_ids` suffix to `outputs.tf` since the outputs are subnet IDs --- .gitignore | 3 +++ main.tf | 2 +- outputs.tf | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 outputs.tf diff --git a/.gitignore b/.gitignore index 41859c81..a4190a4c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,6 @@ # Module directory .terraform/ + +.idea +*.iml diff --git a/main.tf b/main.tf index 60a74a3e..af93f945 100644 --- a/main.tf +++ b/main.tf @@ -11,7 +11,7 @@ data "aws_vpc" "default" { id = "${var.vpc_id}" } -# Get all subnets from the necessary vpc +# Get all subnets from the VPC data "aws_subnet_ids" "all" { vpc_id = "${data.aws_vpc.default.id}" } diff --git a/outputs.tf b/outputs.tf new file mode 100644 index 00000000..b6836d68 --- /dev/null +++ b/outputs.tf @@ -0,0 +1,7 @@ +output "public_subnet_ids" { + value = ["${aws_subnet.public.*.id}"] +} + +output "private_subnet_ids" { + value = ["${aws_subnet.private.*.id}"] +}