Skip to content

Commit

Permalink
Try using can (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmattia authored Mar 17, 2023
1 parent 9ae4dc3 commit 73847b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ resource "aws_security_group" "service_security_group" {
content {
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
security_groups = can(length(ingress.value.security_groups)) ? ingress.value.security_groups : var.alb_security_group_ids
cidr_blocks = can(length(ingress.value.cidr_blocks)) ? ingress.value.cidr_blocks : var.ingress_cidr_blocks
protocol = "tcp"
}
}
Expand Down
2 changes: 2 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ variable "load_balancers" {
target_group_arn = string
container_name = string
container_port = string
security_groups = optional(list(string))
cidr_blocks = optional(list(string))
}))

default = []
Expand Down

0 comments on commit 73847b6

Please sign in to comment.