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