From a6f95ebe42658a3813721781da2fbf5a2672a329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paulo=20J=C3=BAnior=20do=20Nascimento=20Lima?= Date: Fri, 21 Jan 2022 09:50:47 -0300 Subject: [PATCH] Add destination_cidr_blocks variable to allow choose sg outbound rule cidr blocks --- main.tf | 2 +- variables.tf | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 5881b98..eedbb81 100644 --- a/main.tf +++ b/main.tf @@ -136,6 +136,6 @@ resource "aws_security_group_rule" "egress" { from_port = 0 to_port = 0 protocol = "-1" - cidr_blocks = ["0.0.0.0/0"] + cidr_blocks = var.destination_cidr_blocks == [] ? ["0.0.0.0/0"] : var.destination_cidr_blocks security_group_id = aws_security_group.default.id } diff --git a/variables.tf b/variables.tf index 5d2459f..22fa115 100644 --- a/variables.tf +++ b/variables.tf @@ -35,6 +35,11 @@ variable "source_cidr_blocks" { description = "List of source CIDR blocks." } +variable "destination_cidr_blocks" { + type = list(string) + description = "List of source CIDR blocks." +} + variable "engine_version" { default = "5.0.6" type = string