From 60401f2cfc0f662f65651dbf495f12a61f5555f7 Mon Sep 17 00:00:00 2001 From: Bertrand Janin Date: Sun, 26 Aug 2018 23:39:19 -0400 Subject: [PATCH] Make vpc_id an input parameter as well. --- main.tf | 5 +++-- variables.tf | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index d3cfcc5..851ef82 100644 --- a/main.tf +++ b/main.tf @@ -198,11 +198,12 @@ data "template_file" "user_data_client" { # --------------------------------------------------------------------------------------------------------------------- data "aws_vpc" "default" { - default = true + default = "${var.vpc_id == "" ? true : false}" + id = "${var.vpc_id}" } data "aws_subnet_ids" "default" { vpc_id = "${data.aws_vpc.default.id}" } -data "aws_region" "current" {} \ No newline at end of file +data "aws_region" "current" {} diff --git a/variables.tf b/variables.tf index 0574b3c..93c9cc4 100644 --- a/variables.tf +++ b/variables.tf @@ -58,3 +58,8 @@ variable "ssh_key_name" { description = "The name of an EC2 Key Pair that can be used to SSH to the EC2 Instances in this cluster. Set to an empty string to not associate a Key Pair." default = "" } + +variable "vpc_id" { + description = "The ID of the VPC in which the nodes will be deployed. Uses default VPC if not supplied." + default = "" +}