From 34a5c09965e3358b4d290fb4a1e6e5150f6ff642 Mon Sep 17 00:00:00 2001 From: Carlos Vega Meyer Date: Mon, 2 Jul 2018 16:12:49 -0300 Subject: [PATCH] Adds default_security_groups boolean variable --- main.tf | 2 +- variables.tf | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index c94f227..ff9245e 100644 --- a/main.tf +++ b/main.tf @@ -13,7 +13,7 @@ resource "aws_instance" "data_node" { key_name = "${var.key_name}" user_data = "${var.user_data == "" ? file("${path.module}/files/init.sh") : var.user_data }" ebs_optimized = true - vpc_security_group_ids = ["${concat(list(aws_security_group.influx_cluster.id, aws_security_group.data_node.id), var.security_groups)}"] + vpc_security_group_ids = ["${var.default_security_groups == true ? concat(list(aws_security_group.influx_cluster.id, aws_security_group.data_node.id), var.security_groups) : var.security_groups}"] count = "${var.data_instances}" } diff --git a/variables.tf b/variables.tf index be3fa89..82a0759 100644 --- a/variables.tf +++ b/variables.tf @@ -56,6 +56,11 @@ variable "security_groups" { default = [] } +variable "default_security_groups" { + description = "Whether default security groups should be applied" + default = true +} + variable "user_data" { description = "User data script for all instances" default = ""