|
@@ -3,10 +3,12 @@
|
|
|
# LOAD BALANCER FOR PORTAL
|
|
|
# ---------------------------------------------------------------------------------------------------------------------
|
|
|
resource "aws_alb" "portal" {
|
|
|
- name = "portal-alb-${var.environment}"
|
|
|
- security_groups = [aws_security_group.customer_portal_alb.id, ]
|
|
|
- internal = false #tfsec:ignore:aws-elb-alb-not-public The ALB requires Internet exposure
|
|
|
- subnets = var.public_subnets
|
|
|
+ name = "portal-alb-${var.environment}"
|
|
|
+ security_groups = [aws_security_group.customer_portal_alb.id, ]
|
|
|
+ internal = false #tfsec:ignore:aws-elb-alb-not-public The ALB requires Internet exposure
|
|
|
+ subnets = var.public_subnets
|
|
|
+ load_balancer_type = "application"
|
|
|
+ drop_invalid_header_fields = true
|
|
|
|
|
|
tags = merge(local.standard_tags, var.tags, { Name = "portal-alb-${var.environment}" })
|
|
|
|
|
@@ -95,18 +97,21 @@ module "public_dns_record" {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-#------------------------------------
|
|
|
-# Security Group
|
|
|
-#------------------------------------
|
|
|
-
|
|
|
+#----------------------------------------------------------------------------
|
|
|
+# ALB Security Group
|
|
|
+#----------------------------------------------------------------------------
|
|
|
resource "aws_security_group" "customer_portal_alb" {
|
|
|
name = "customer_portal_alb_inbound_sg"
|
|
|
description = "Allow Customer Portal ALB HTTP Traffic Inbound"
|
|
|
vpc_id = var.vpc_id
|
|
|
}
|
|
|
|
|
|
+#----------------------------------------------------------------------------
|
|
|
+# INGRESS
|
|
|
+#----------------------------------------------------------------------------
|
|
|
resource "aws_security_group_rule" "customer_portal_alb_https" {
|
|
|
protocol = "tcp"
|
|
|
+ description = "Portal - Allow 443 from any"
|
|
|
type = "ingress"
|
|
|
from_port = 443
|
|
|
to_port = 443
|
|
@@ -117,6 +122,7 @@ resource "aws_security_group_rule" "customer_portal_alb_https" {
|
|
|
#Allow viewing of test portal from home. We don't want world to view test portal.
|
|
|
resource "aws_security_group_rule" "customer_portal_alb_https_test" {
|
|
|
protocol = "tcp"
|
|
|
+ description = "Portal - Allow 443 from strictly XDR Engineers staticly assigned address"
|
|
|
type = "ingress"
|
|
|
from_port = 443
|
|
|
to_port = 443
|
|
@@ -127,6 +133,7 @@ resource "aws_security_group_rule" "customer_portal_alb_https_test" {
|
|
|
## Needed for HTTPs redirect
|
|
|
resource "aws_security_group_rule" "customer_portal_alb_http" {
|
|
|
protocol = "tcp"
|
|
|
+ description = "Portal - 80 redirect to 443"
|
|
|
type = "ingress"
|
|
|
from_port = 80
|
|
|
to_port = 80
|
|
@@ -138,6 +145,7 @@ resource "aws_security_group_rule" "customer_portal_alb_http" {
|
|
|
resource "aws_security_group_rule" "customer_portal_sensu_check" {
|
|
|
count = var.environment == "test" ? 1 : 0
|
|
|
protocol = "tcp"
|
|
|
+ description = "Portal - Allow Sensu Check from proxy in test on 443"
|
|
|
type = "ingress"
|
|
|
from_port = 443
|
|
|
to_port = 443
|
|
@@ -145,8 +153,12 @@ resource "aws_security_group_rule" "customer_portal_sensu_check" {
|
|
|
cidr_blocks = ["${var.proxy_public_ip}/32", ]
|
|
|
}
|
|
|
|
|
|
+#----------------------------------------------------------------------------
|
|
|
+# EGRESS
|
|
|
+#----------------------------------------------------------------------------
|
|
|
resource "aws_security_group_rule" "customer_portal_alb" {
|
|
|
protocol = "tcp"
|
|
|
+ description = "Portal - Allow 443 to any"
|
|
|
type = "egress"
|
|
|
from_port = 443
|
|
|
to_port = 443
|