Skip to content

Commit

Permalink
Allow specifying ingress cidr blocks (#24)
Browse files Browse the repository at this point in the history
* Allow specifying ingress cidr blocks

* fix syntax
  • Loading branch information
dmattia authored Mar 15, 2023
1 parent f51fcab commit 9ae4dc3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ resource "aws_security_group" "service_security_group" {
from_port = ingress.value.container_port
to_port = ingress.value.container_port
security_groups = var.alb_security_group_ids
cidr_blocks = var.ingress_cidr_blocks
protocol = "tcp"
}
}
Expand Down
9 changes: 8 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,14 @@ variable "health_check_grace_period_seconds" {

variable "alb_security_group_ids" {
type = list(string)
description = "The ids of all security groups set on the ALB. We require that the tasks can only talk to the ALB"
description = "The ids of all security groups set on the ALB. We require that the tasks can only talk to the ALB. If using an NLB, use ingress_cidr_blocks instead"
default = null
}

variable "ingress_cidr_blocks" {
type = list(string)
description = "CIDR blocks to allow accessing the ECS tasks. This is usually not specified, as the alb_security_group_ids covers the ingress, but in some cases is useful if using an NLB instead of an ALB, which cannot attach security groups to itself."
default = null
}

variable "execution_role_arn" {
Expand Down

0 comments on commit 9ae4dc3

Please sign in to comment.