diff --git a/aws/tf/modules/sra/network.tf b/aws/tf/modules/sra/network.tf index e8b1634..650ac92 100644 --- a/aws/tf/modules/sra/network.tf +++ b/aws/tf/modules/sra/network.tf @@ -67,18 +67,19 @@ resource "aws_security_group" "sg" { cidr_blocks = ["0.0.0.0/0"] } } + + dynamic "egress" { + for_each = var.compliance_security_profile ? [2443] : [] + + content { + description = "Databricks - Data Plane Security Group - FIPS encryption" + from_port = 2443 + to_port = 2443 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + } tags = { Name = "${var.resource_prefix}-data-plane-sg" } -} - -resource "aws_security_group_rule" "esc_conditional_egress" { - count = var.compliance_security_profile != false ? 1 : 0 - type = "egress" - from_port = 2443 - to_port = 2443 - protocol = "tcp" - security_group_id = aws_security_group.sg[0].id - cidr_blocks = ["0.0.0.0/0"] - description = "Databricks - Data Plane Security Group - FIPS encryption" } \ No newline at end of file diff --git a/aws/tf/modules/sra/privatelink.tf b/aws/tf/modules/sra/privatelink.tf index e9ede5f..fee8559 100644 --- a/aws/tf/modules/sra/privatelink.tf +++ b/aws/tf/modules/sra/privatelink.tf @@ -28,23 +28,23 @@ resource "aws_security_group" "privatelink" { security_groups = [aws_security_group.sg[0].id] } + dynamic "ingress" { + for_each = var.compliance_security_profile ? [2443] : [] + + content { + description = "Databricks - Data Plane Security Group - FIPS encryption" + from_port = 2443 + to_port = 2443 + protocol = "tcp" + security_groups = [aws_security_group.sg[0].id] + } + } + tags = { Name = "${var.resource_prefix}-private-link-sg" } } -resource "aws_security_group_rule" "esc_conditional_ingress_pl_ingress" { - count = var.compliance_security_profile != false ? 1 : 0 - description = "Databricks - PrivateLink Endpoint SG - FIPS Encryption" - type = "ingress" - from_port = 2443 - to_port = 2443 - protocol = "tcp" - security_group_id = aws_security_group.privatelink[0].id - source_security_group_id = aws_security_group.sg[0].id -} - - // EXPLANATION: VPC Gateway Endpoint for S3, Interface Endpoint for Kinesis, and Interface Endpoint for STS