From bd4541c227b9493c5dbc321b58986103514012d2 Mon Sep 17 00:00:00 2001 From: dimisjim Date: Wed, 24 Nov 2021 10:29:27 +0100 Subject: [PATCH 1/2] added subnet ids --- main.tf | 4 ++-- variables.tf | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 19daa765..1fdc059a 100644 --- a/main.tf +++ b/main.tf @@ -79,7 +79,7 @@ module "consul_servers" { }) vpc_id = data.aws_vpc.default.id - subnet_ids = data.aws_subnet_ids.default.ids + subnet_ids = var.subnet_ids != null ? var.subnet_ids : data.aws_subnet_ids.default.ids # If set to true, this allows access to the consul HTTPS API enable_https_port = var.enable_https_port @@ -128,7 +128,7 @@ module "consul_clients" { }) vpc_id = data.aws_vpc.default.id - subnet_ids = data.aws_subnet_ids.default.ids + subnet_ids = var.subnet_ids != null ? var.subnet_ids : data.aws_subnet_ids.default.ids # To make testing easier, we allow Consul and SSH requests from any IP address here but in a production # deployment, we strongly recommend you limit this to the IP address ranges of known, trusted servers inside your VPC. diff --git a/variables.tf b/variables.tf index 6e69029d..211e00e5 100644 --- a/variables.tf +++ b/variables.tf @@ -65,3 +65,9 @@ variable "enable_https_port" { type = bool default = false } + +variable "subnet_ids" { + description = "The subnet IDs into which the EC2 Instances should be deployed. We recommend one subnet ID per node in the cluster_size variable. At least one of var.subnet_ids or var.availability_zones must be non-empty." + type = list(string) + default = null +} From 7ee82d1e2b73cdbbe1655248fe2cfd8eb7700b05 Mon Sep 17 00:00:00 2001 From: dimisjim Date: Wed, 24 Nov 2021 10:32:49 +0100 Subject: [PATCH 2/2] minor var description fix --- variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variables.tf b/variables.tf index 211e00e5..5a2a97f1 100644 --- a/variables.tf +++ b/variables.tf @@ -67,7 +67,7 @@ variable "enable_https_port" { } variable "subnet_ids" { - description = "The subnet IDs into which the EC2 Instances should be deployed. We recommend one subnet ID per node in the cluster_size variable. At least one of var.subnet_ids or var.availability_zones must be non-empty." + description = "The subnet IDs into which the EC2 Instances should be deployed. We recommend one subnet ID per node in the cluster_size variable." type = list(string) default = null }