Skip to content

Commit 44b8190

Browse files
Update security group ports based on certificate availability
Reasoning: There is a conditional performed that compares the app_port to the lb_port when creating the aws_security_group_rule.ingress_lb_port. It seems that the app_port changed default values between the terraform variables.tf and the action.yaml. This updates action.yaml to use 3000 instead of 80 - Update the port range of the security group ingress rule to `443` if a certificate is available, otherwise `80` - Change the default port for the app to `3000` - Change the default port for the load balancer to `443` if a FQDN is provided [action.yaml] - Change the default port for the app from `80` to `3000` - Change the default port for the load balancer from `80` to `443` if a FQDN is provided [operations/deployment/terraform/security-group.tf] - Change the port range of the ingress security group rule based on the availability of a certificate - Update the `from_port` and `to_port` values to `443` if a certificate is available, otherwise to `80`
1 parent 24bb86d commit 44b8190

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ inputs:
4949
app_port:
5050
description: 'Port to expose for the app'
5151
required: false
52-
default: '80'
52+
default: '3000'
5353
lb_port:
5454
description: 'Load balancer listening port. Defaults to 80 if NO FQDN provided, 443 if FQDN provided'
5555
required: false

operations/deployment/terraform/security-group.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ resource "aws_security_group_rule" "ingress_lb_port" {
3737
count = var.lb_port != var.app_port ? 1 : 0
3838
type = "ingress"
3939
description = "${var.aws_resource_identifier} - lb Port"
40-
from_port = tonumber(var.lb_port != "" ? var.lb_port : 443 )
41-
to_port = tonumber(var.lb_port != "" ? var.lb_port : 443 )
40+
from_port = tonumber(var.lb_port != "" ? var.lb_port : ( local.cert_available ? 443 : 80 ) )
41+
to_port = tonumber(var.lb_port != "" ? var.lb_port : ( local.cert_available ? 443 : 80 ) )
4242
protocol = "tcp"
4343
cidr_blocks = ["0.0.0.0/0"]
4444
security_group_id = aws_security_group.ec2_security_group.id

0 commit comments

Comments
 (0)