resource "aws_default_security_group" "DIGSYS-P3-DEFAULT-SG" {
  vpc_id = aws_vpc.DIGSYS-P3.id
  tags = merge(var.tags, {
    Name = "DIGSYS-P3-DEFAULT-SG"
    Name = "DIGSYS-P3-DEFAULT-SG"
  })
}

resource "aws_security_group" "DIGSYS-P3-GSIRT-SG" {
  name        = "DIGSYS-P3-GSIRT-SG"
  description = "DIGSYS-P3-GSIRT-SG"
  egress = [
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.249.6.208/28", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.249.6.208/28", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65535
    }
  ]
  ingress = [
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.249.6.208/28", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "GSIRT-TCP-8089"
      from_port        = 8089
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 8089
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.249.6.208/28", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "GSIRT-TCP-9998"
      from_port        = 9998
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9998
    },
  ]
  tags = merge(var.tags, {
    Name     = "DIGSYS-P3-GSIRT-SG"
    CLOPS_FW = "NO"
  })
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-MIDICT01-SG" {
  description = "DIGSYS-P3-MIDICT01-SG"
  egress = [
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "HTTP"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "HTTPS"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["10.12.246.64/26", "10.12.237.160/27"]
      description      = "SMTPS"
      from_port        = 587
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 587
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "NTP-TCP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "NTP-UDP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR-ORACLE"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23", "10.11.189.0/26", "10.11.189.64/26"]
      description      = "DIGSYS-P3-VPC-CIDR-ORACLE"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23", "10.11.189.0/26", "10.11.189.64/26"]
      description      = "DIGSYS-P3-VPC-CIDR-ORACLE"
      from_port        = 8080
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 8080
    },
    {
      cidr_blocks      = ["10.11.107.128/25"]
      description      = "EOM-FF-P-VPC-CIDR-ORACLE"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
  ]
  ingress = [
    {
      cidr_blocks      = ["10.11.176.219/32", "10.12.246.64/27", "10.250.2.64/27", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "CloudOPS Bastions"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR-ORACLE"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23", "10.11.189.0/26", "10.11.189.64/26"]
      description      = "DIGSYS-P3-VPC-CIDR-ORACLE"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.0.0.0/8"]
      description      = "VPN-1"
      from_port        = 8080
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 8080
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23", "10.11.189.0/26", "10.11.189.64/26"]
      description      = "DIGSYS-P3-VPC-CIDR-ORACLE"
      from_port        = 8080
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 8080
    },
  ]
  name = "DIGSYS-P3-MIDICT01-SG"
  tags = {
    Name                     = "DIGSYS-P3-MIDICT01-SG"
    "Business-Unit"          = "SME-DIGTAL-SYSTEMS",
    "Project-Code"           = "SME-2000-0512C"
    "Project-Name"           = "DIGITAL-SYSTEMS"
    "Environment"            = "Prod",
    "CLOPS_APPROVED"         = "YES",
    "OWNER"                  = "steve.leeds@sonymusic.com",
    "Terraform"              = "True",
    CLOPS_FW                 = "NO"
    aws-migration-project-id = "MPE22602"
    map-migrated             = "d-server-02sa4nzuab143a"
  }
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-CSA2APP01-SG" {
  description = "DIGSYS-P3-CSA2APP01-SG"
  egress = [
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTP"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTPS"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks      = ["10.11.107.128/25"]
      description      = "EOM-FF-P"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.12.246.64/26",
        "10.12.237.160/27",
      ]
      description      = "CLOPS-SMTP-EP"
      from_port        = 587
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 587
    },
    {
      cidr_blocks = [
        "162.49.251.8/32",
      ]
      description      = "psmegrps.arvato-systems.de"
      from_port        = 8000
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 8000
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
  ]
  ingress = [
    {
      cidr_blocks      = ["10.11.176.219/32", "10.12.246.75/32", "10.250.2.64/27"]
      description      = "cloudopsff-bastion02"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks      = ["10.11.189.0/25"]
      description      = "DIGSYS-P3-IDMZ-CIDR"
      from_port        = 8080
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 8080
    },
    {
      cidr_blocks      = ["10.11.189.0/25"]
      description      = "DIGSYS-P3-IDMZ-CIDR"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["10.11.189.0/25"]
      description      = "DIGSYS-P3-IDMZ-CIDR"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
  ]
  name = "DIGSYS-P3-CSA2APP01-SG"
  tags = {
    Name                     = "DIGSYS-P3-CSA2APP01-SG"
    "Business-Unit"          = "SME-DIGTAL-SYSTEMS",
    "Project-Code"           = "SME-2000-0512C"
    "Project-Name"           = "DIGITAL-SYSTEMS"
    "Environment"            = "Prod",
    "CLOPS_APPROVED"         = "YES",
    "OWNER"                  = "steve.leeds@sonymusic.com",
    "Terraform"              = "True",
    CLOPS_FW                 = "NO"
    aws-migration-project-id = "MPE22602"
    map-migrated             = "d-server-02sa4nzuab143a"
  }
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-DRA2APP01-SG" {
  description = "DIGSYS-P3-DRA2APP01-SG"
  egress = [
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTP"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTPS"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "smtp.sendgrid.net"
      from_port        = 587
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 587
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
  ]
  ingress = [
    {
      cidr_blocks      = ["10.11.176.219/32", "10.250.2.64/27", "10.12.246.75/32"]
      description      = "cloudopsff-bastion02"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks      = ["10.251.11.235/32"]
      description      = "digsysp3-tools01"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks = [
        "10.11.176.219/32",
      ]
      description      = "cloudopsff-bastion02"
      from_port        = 9990
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9990
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-EXT-LB-SG"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "Load Balancers"
      from_port        = 8080
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 8080
    },
  ]
  name = "DIGSYS-P3-DRA2APP01-SG"
  tags = {
    Name                     = "DIGSYS-P3-DRA2APP01-SG"
    "Business-Unit"          = "SME-DIGTAL-SYSTEMS",
    "Project-Code"           = "SME-2000-0512C"
    "Project-Name"           = "DIGITAL-SYSTEMS"
    "Environment"            = "Prod",
    "CLOPS_APPROVED"         = "YES",
    "OWNER"                  = "steve.leeds@sonymusic.com",
    "Terraform"              = "True",
    CLOPS_FW                 = "NO"
    aws-migration-project-id = "MPE22602"
    map-migrated             = "d-server-02sa4nzuab143a"
  }
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-DS2APP01-SG" {
  description = "DIGSYS-P3-DS2APP01-SG"
  egress = [
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTP"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTPS"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks = [
        "10.12.246.64/26",
        "10.12.237.160/27",
      ]
      description      = "CLOPS-SMTP-EP"
      from_port        = 587
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 587
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
  ]
  ingress = [
    {
      cidr_blocks      = ["10.11.176.219/32", "10.12.246.75/32", "10.250.2.64/27"]
      description      = "cloudopsff-bastion02"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks = [
        "10.11.176.219/32",
      ]
      description      = "cloudopsff-bastion02"
      from_port        = 9990
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9990
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-INT-ELB-SG"
      from_port        = 8080
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 8080
    },
  ]
  name = "DIGSYS-P3-DS2APP01-SG"
  tags = {
    Name                     = "DIGSYS-P3-DS2APP01-SG"
    "Business-Unit"          = "SME-DIGTAL-SYSTEMS",
    "Project-Code"           = "SME-2000-0512C"
    "Project-Name"           = "DIGITAL-SYSTEMS"
    "Environment"            = "Prod",
    "CLOPS_APPROVED"         = "YES",
    "OWNER"                  = "steve.leeds@sonymusic.com",
    "Terraform"              = "True",
    CLOPS_FW                 = "NO"
    aws-migration-project-id = "MPE22602"
    map-migrated             = "d-server-02sa4nzuab143a"
  }
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-DSMSAPP01A-SG" {
  description = "DIGSYS-P3-DSMSAPP01A-SG"
  egress = [
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTP"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
    {
      cidr_blocks = [
        "0.0.0.0/0"
      ]
      description      = ""
      from_port        = 27010
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 27017
    },
    {
      cidr_blocks = [
        "162.49.0.0/16",
        "192.168.0.0/16"
      ]
      description      = ""
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks = [
        "162.49.0.0/16",
        "192.168.0.0/16"
      ]
      description      = ""
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTPS"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23", "10.11.189.64/26", "10.11.189.0/26"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks = [
        "10.12.246.64/26",
        "10.12.237.160/27",
      ]
      description      = "CLOPS-SMTP-EP"
      from_port        = 587
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 587
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
    {
      cidr_blocks      = ["10.11.107.192/27"]
      description      = "OCM-EOM-FF-P"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks      = []
      description      = "dsms-config"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = ["sg-06ec12af8b347b19c"]
      self             = true
      to_port          = 65535
    },
  ]
  ingress = [
    {
      cidr_blocks      = ["10.11.176.219/32", "10.12.246.75/32", "10.250.2.64/27"]
      description      = "cloudopsff-bastion02"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks = [
        "10.11.176.219/32",
      ]
      description      = "cloudopsff-bastion02"
      from_port        = 8761
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 8762
    },
    {
      cidr_blocks      = ["10.11.50.71/32"]
      description      = "cloudopsff-bastion02"
      from_port        = 8762
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 8762
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-INT-ELB-SG"
      from_port        = 8761
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9191
    },
    {
      cidr_blocks      = []
      description      = "DIGSYS-P3-DSMSAPP01A-SG"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = true
      to_port          = 65535
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = []
      description      = "From-ALB-SG"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups = [
        "sg-06ec12af8b347b19c",
      ]
      self    = false
      to_port = 65535
    },
    {
      cidr_blocks      = ["10.11.176.219/32"]
      description      = "cloudopsff-bastion02"
      from_port        = 9090
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9090
    },
  ]
  name = "DIGSYS-P3-DSMSAPP01A-SG"
  tags = {
    Name                     = "DIGSYS-P3-DSMSAPP01A-SG"
    "Business-Unit"          = "SME-DIGTAL-SYSTEMS",
    "Project-Code"           = "SME-2000-0512C"
    "Project-Name"           = "DIGITAL-SYSTEMS"
    "Environment"            = "Prod",
    "CLOPS_APPROVED"         = "YES",
    "OWNER"                  = "steve.leeds@sonymusic.com",
    "Terraform"              = "True",
    CLOPS_FW                 = "NO"
    aws-migration-project-id = "MPE22602"
    map-migrated             = "d-server-02sa4nzuab143a"
  }
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-EAI2APP01-SG" {
  description = "DIGSYS-P3-EAI2APP01-SG"
  egress = [
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTP"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTPS"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks = [
        "10.12.246.64/26",
        "10.12.237.160/27",
      ]
      description      = "CLOPS-SMTP-EP"
      from_port        = 587
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 587
    },
    {
      cidr_blocks = [
        "172.34.24.128/25",
      ]
      description      = "MAX-FF-P-MSK"
      from_port        = 9094
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9094
    },
    {
      cidr_blocks      = ["10.11.107.128/25", "172.34.29.0/25", "10.250.19.128/28", "10.250.21.0/26"]
      description      = "EOM-FF-P-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = ["10.11.107.128/25", "172.34.29.0/25", "10.250.19.128/28", "10.250.21.0/26"]
      description      = "EOM-FF-P-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
  ]
  ingress = [
    {
      cidr_blocks      = ["10.11.176.192/27", "10.12.246.75/32", "10.250.2.64/27"]
      description      = "CloudOPS Bastions"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks      = ["10.251.11.235/32"]
      description      = "digsysp3-tools01"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks = [
        "172.34.22.0/24",
      ]
      description      = "Switch Board PROD"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks = [
        "10.250.35.0/25",
      ]
      description      = "Delivery-Prod-EKS"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks = [
        "172.34.24.155/32",
      ]
      description      = "maxffp-utils01"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks = [
        "172.34.24.157/32",
      ]
      description      = "maxffp-replayEAI01"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks = [
        "172.34.24.128/25",
      ]
      description      = "maxffp-replayEAI02"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks = [
        "10.250.47.192/28",
        "10.250.47.208/28",
      ]
      description      = "connectivty from dsrv-prod-eks-cluster"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks = [
        "172.34.24.128/27",
      ]
      description      = "MAX-FF-P-APP-1A"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
  ]
  name = "DIGSYS-P3-EAI2APP01-SG"
  tags = {
    Name                     = "DIGSYS-P3-EAI2APP01-SG"
    "Business-Unit"          = "SME-DIGTAL-SYSTEMS",
    "Project-Code"           = "SME-2000-0512C"
    "Project-Name"           = "DIGITAL-SYSTEMS"
    "Environment"            = "Prod",
    "CLOPS_APPROVED"         = "YES",
    "OWNER"                  = "steve.leeds@sonymusic.com",
    "Terraform"              = "True",
    CLOPS_FW                 = "NO"
    aws-migration-project-id = "MPE22602"
    map-migrated             = "d-server-02sa4nzuab143a"
  }
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-EAI2APP02-SG" {
  description = "DIGSYS-P3-EAI2APP02-SG"
  egress = [
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTP"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTPS"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks = [
        "10.12.246.64/26",
        "10.12.237.160/27",
      ]
      description      = "CLOPS-SMTP-EP"
      from_port        = 587
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 587
    },
    {
      cidr_blocks = [
        "172.34.24.128/25",
      ]
      description      = "MAX-FF-P-MSK"
      from_port        = 9094
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9094
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
  ]
  ingress = [
    {
      cidr_blocks      = ["10.11.176.219/32", "10.12.246.75/32", "10.250.2.64/27", ]
      description      = "cloudopsff-bastion02"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks = [
        "172.34.22.0/24",
      ]
      description      = "Switch Board PROD"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks = [
        "172.34.24.155/32",
      ]
      description      = "maxffp-utils01"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks = [
        "172.34.24.157/32",
      ]
      description      = "maxffp-replayEAI01"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks = [
        "172.34.24.150/32",
      ]
      description      = "maxffp-replayEAI02"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
  ]
  name = "DIGSYS-P3-EAI2APP02-SG"
  tags = {
    Name                     = "DIGSYS-P3-EAI2APP02-SG"
    "Business-Unit"          = "SME-DIGTAL-SYSTEMS",
    "Project-Code"           = "SME-2000-0512C"
    "Project-Name"           = "DIGITAL-SYSTEMS"
    "Environment"            = "Prod",
    "CLOPS_APPROVED"         = "YES",
    "OWNER"                  = "steve.leeds@sonymusic.com",
    "Terraform"              = "True",
    CLOPS_FW                 = "NO"
    aws-migration-project-id = "MPE22602"
    map-migrated             = "d-server-02sa4nzuab143a"
  }
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-EOM1APP01-SG" {
  description = "DIGSYS-P3-EOM1APP01-SG"
  egress = [
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTP"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTPS"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks = [
        "10.12.246.64/26",
        "10.12.237.160/27",
      ]
      description      = "CLOPS-SMTP-EP"
      from_port        = 587
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 587
    },
    {
      cidr_blocks = [
        "162.49.251.8/32",
      ]
      description      = "psmegrps.arvato-systems.de"
      from_port        = 8000
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 8000
    },
    {
      cidr_blocks = [
        "162.49.251.8/32",
      ]
      description      = "psmegrps.arvato-systems.de"
      from_port        = 8020
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 8020
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
  ]
  ingress = [
    {
      cidr_blocks      = ["10.11.176.219/32", "10.12.246.75/32", "10.250.2.64/27"]
      description      = "cloudopsff-bastion02"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks = [
        "10.11.176.219/32",
      ]
      description      = "cloudopsff-bastion02"
      from_port        = 9990
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9990
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-EXT-LB-SG"
      from_port        = 8080
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 8080
    },
  ]
  name = "DIGSYS-P3-EOM1APP01-SG"
  tags = {
    Name                     = "DIGSYS-P3-EOM1APP01-SG"
    "Business-Unit"          = "SME-DIGTAL-SYSTEMS",
    "Project-Code"           = "SME-2000-0512C"
    "Project-Name"           = "DIGITAL-SYSTEMS"
    "Environment"            = "Prod",
    "CLOPS_APPROVED"         = "YES",
    "OWNER"                  = "steve.leeds@sonymusic.com",
    "Terraform"              = "True",
    CLOPS_FW                 = "NO"
    aws-migration-project-id = "MPE22602"
    map-migrated             = "d-server-02sa4nzuab143a"
  }
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-EOM2APP01-SG" {
  description = "DIGSYS-P3-EOM2APP01-SG"
  egress = [
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTP"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTPS"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = ["10.11.107.128/25", "172.34.29.0/25", "10.250.19.128/28", "10.250.21.0/26"]
      description      = "EOM-FF-P-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = ["10.11.107.128/25", "172.34.29.0/25", "10.250.19.128/28", "10.250.21.0/26"]
      description      = "EOM-FF-P-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks = [
        "10.12.246.64/26",
        "10.12.237.160/27",
      ]
      description      = "CLOPS-SMTP-EP"
      from_port        = 587
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 587
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
  ]
  ingress = [
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 7090
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 7090
    },
    {
      cidr_blocks      = ["10.11.176.219/32", "10.12.246.75/32", "10.250.2.64/27", "10.251.11.224/27", "10.251.26.0/23"]
      description      = "cloudopsff-bastion02"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks = [
        "10.11.176.219/32",
      ]
      description      = "cloudopsff-bastion02"
      from_port        = 9990
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9990
    },
  ]
  name = "DIGSYS-P3-EOM2APP01-SG"
  tags = {
    Name                     = "DIGSYS-P3-EOM2APP01-SG"
    "Business-Unit"          = "SME-DIGTAL-SYSTEMS",
    "Project-Code"           = "SME-2000-0512C"
    "Project-Name"           = "DIGITAL-SYSTEMS"
    "Environment"            = "Prod",
    "CLOPS_APPROVED"         = "YES",
    "OWNER"                  = "steve.leeds@sonymusic.com",
    "Terraform"              = "True",
    CLOPS_FW                 = "NO"
    aws-migration-project-id = "MPE22602"
    map-migrated             = "d-server-02sa4nzuab143a"
  }
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-INTERNAL-LB-SG" {
  description = "DIGSYS-P3-INTERNAL-LB-SG"
  egress = [
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23", "10.0.0.0/8", "162.49.0.0/16", "192.168.0.0/16", "10.11.189.10/32"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTP"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTPS"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
  ]
  ingress = [
    {
      cidr_blocks = [
        "10.0.0.0/8",
      ]
      description      = "SME-CIDR-1"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks = [
        "162.49.0.0/16",
      ]
      description      = "SME-CIDR-2"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks = [
        "192.168.0.0/16",
      ]
      description      = "SME-CIDR-3"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["172.34.24.128/25", "172.34.32.64/28", "172.34.12.0/25", "172.34.12.192/28", "172.32.6.0/24"]
      description      = "MAX-FF-P"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23", "10.0.0.0/8", "162.49.0.0/16", "192.168.0.0/16", "10.11.189.10/32"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
  ]
  name = "DIGSYS-P3-INTERNAL-LB-SG"
  tags = {
    Name                     = "DIGSYS-P3-INTERNAL-LB-SG"
    "Business-Unit"          = "SME-DIGTAL-SYSTEMS",
    "Project-Code"           = "SME-2000-0512C"
    "Project-Name"           = "DIGITAL-SYSTEMS"
    "Environment"            = "Prod",
    "CLOPS_APPROVED"         = "YES",
    "OWNER"                  = "steve.leeds@sonymusic.com",
    "Terraform"              = "True",
    CLOPS_FW                 = "NO"
    aws-migration-project-id = "MPE22602"
    map-migrated             = "d-server-02sa4nzuab143a"
  }
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-OCM01A-SG" {
  description = "DIGSYS-P3-OCM01A-SG"
  egress = [
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTP"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTPS"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks      = ["10.11.107.128/25"]
      description      = "EOM-FF-P"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.11.121.75/32",
      ]
      description      = "sftp-int-smart-oci.smedigitalapps.com"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks = [
        "10.11.123.0/24",
      ]
      description      = "smeed5-scan.server.arvato-systems.de"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.12.246.64/26",
        "10.12.237.160/27",
      ]
      description      = "CLOPS-SMTP-EP"
      from_port        = 587
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 587
    },
    {
      cidr_blocks = [
        "162.49.169.228/32",
      ]
      description      = "degtlun5844.server.arvato-systems.de"
      from_port        = 9335
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9335
    },
    {
      cidr_blocks = [
        "162.49.169.228/32",
      ]
      description      = "degtlun5844.server.arvato-systems.de"
      from_port        = 9642
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9642
    },
    {
      cidr_blocks = [
        "162.49.169.228/32",
      ]
      description      = "degtlun5844.server.arvato-systems.de"
      from_port        = 9774
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9774
    },
    {
      cidr_blocks      = ["172.34.25.0/24"]
      description      = "DIGSYS-FF-AUDIT"
      from_port        = 1521
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1521
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
  ]
  ingress = [
    {
      cidr_blocks = [
        "10.11.106.128/25",
      ]
      description      = "AOMA-P"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks      = ["10.250.92.0/24", "10.11.107.0/26"]
      description      = "MAX-UAT"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.11.119.64/26",
      ]
      description      = "GRPS-D2-APP"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.11.107.192/26",
      ]
      description      = "VPC APP Subnets"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.11.120.0/26",
      ]
      description      = "Arvato"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.11.120.150/32",
      ]
      description      = "exunxlvs06233.server.arvato-systems.de"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.11.120.42/32",
        "10.11.120.44/32",
        "10.11.120.43/32",
      ]
      description      = "smeed2-scan.server.arvato-systems.de"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.11.123.0/25",
      ]
      description      = "SMEED4"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.11.123.0/25",
      ]
      description      = "SMEED4"
      from_port        = 1521
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1521
    },
    {
      cidr_blocks = [
        "10.11.176.219/32",
      ]
      description      = "Shared bastion"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.11.33.18/32",
      ]
      description      = "degtluv0244.server.arvato-systems.de"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.11.33.19/32",
      ]
      description      = "degtluv0245.server.arvato-systems.de"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.11.33.20/32",
      ]
      description      = "degtluv0246.server.arvato-systems.de"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.11.33.21/32",
      ]
      description      = "degtluv0247.server.arvato-systems.de"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.11.96.133/32",
      ]
      description      = "gtunxlvz06526.server.arvato-systems.de"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.11.96.134/32",
      ]
      description      = "gtunxlvs07013.server.arvato-systems.de"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks      = ["10.11.96.164/32"]
      description      = "gtunxlvj19640.server.arvato-systems.de"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.11.96.165/32",
      ]
      description      = "gtunxlvv07016.server.arvato-systems.de"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.11.96.166/32",
      ]
      description      = "gtunxlvw07017.server.arvato-systems.de"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks      = ["10.11.96.167/32"]
      description      = "gtunxlvk19641.server.arvato-systems.de"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.11.97.133/32",
      ]
      description      = "gtunxlvb06684.server.arvato-systems.de"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks      = ["10.11.176.219/32", "10.12.246.75/32", "10.250.2.64/27"]
      description      = "CloudOPS Bastions"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks = [
        "162.49.124.129/32",
      ]
      description      = "SCA-Culpeper"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "162.49.150.31/32",
      ]
      description      = "HKGSMEDB0001.me.sonymusic.com"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "162.49.151.24/32",
        "162.49.150.14/32",
      ]
      description      = "HK-DSRS-Server"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "162.49.169.132/32",
      ]
      description      = "degtlun5843.server.arvato-systems.de"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "162.49.169.228/32",
      ]
      description      = "degtlun5844.server.arvato-systems.de"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks      = ["10.11.113.128/26", "10.11.178.160/27", "10.250.6.0/24", "10.249.7.144/28", "10.250.26.192/26", "10.11.119.128/26"]
      description      = "GRPS-P2"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks      = ["10.11.113.0/26", "10.11.119.0/25", "10.11.177.64/26", "10.250.47.32/27", "10.251.12.0/22"]
      description      = "GRPS-D2"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks      = ["10.12.214.128/25", "10.250.25.0/26"]
      description      = "GRPSNV-D3"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks      = ["10.11.178.176/28", "10.11.178.160/28"]
      description      = "GRPS-P2"
      from_port        = 1482
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1482
    },
    {
      cidr_blocks      = ["10.12.215.128/25", "10.250.97.0/24"]
      description      = "GRPS-P1"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
  ]
  name = "DIGSYS-P3-OCM01A-SG"
  tags = {
    Name                     = "DIGSYS-P3-OCM01A-SG"
    "Business-Unit"          = "SME-DIGTAL-SYSTEMS",
    "Project-Code"           = "SME-2000-0512C"
    "Project-Name"           = "DIGITAL-SYSTEMS"
    "Environment"            = "Prod",
    "CLOPS_APPROVED"         = "YES",
    "OWNER"                  = "steve.leeds@sonymusic.com",
    "Terraform"              = "True",
    CLOPS_FW                 = "NO"
    aws-migration-project-id = "MPE22602"
    map-migrated             = "d-server-02sa4nzuab143a"
  }
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-TOOLS-SG" {
  description = "DIGSYS-P3-TOOLS-SG"
  egress = [
    {
      cidr_blocks = [
        "192.168.248.0/21",
      ]
      description      = ""
      from_port        = 27010
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 27017
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTP"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "HTTPS"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks = [
        "10.12.246.64/26",
        "10.12.237.160/27",
      ]
      description      = "CLOPS-SMTP-EP"
      from_port        = 587
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 587
    },
    {
      cidr_blocks = [
        "192.30.252.0/22",
        "185.199.108.0/22",
        "140.82.112.0/20",
        "13.230.158.120/32",
        "18.179.245.253/32",
        "52.69.239.207/32",
        "13.209.163.61/32",
        "54.180.75.25/32",
        "13.233.76.15/32",
        "13.234.168.60/32",
        "13.250.168.23/32",
        "13.250.94.254/32",
        "54.169.195.247/32",
        "13.236.14.80/32",
        "13.238.54.232/32",
        "52.63.231.178/32",
        "18.229.199.252/32",
        "54.207.47.76/32",
      ]
      description      = "Github"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks = [
        "10.11.106.192/26", "10.11.114.192/26"
      ]
      description      = "AOMA-Prod-MSK"
      from_port        = 9094
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9098
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
  ]
  ingress = [
    {
      cidr_blocks = [
        "10.11.176.219/32",
        "10.250.2.0/24",
        "10.12.246.64/27",
      ]
      description      = "SSH from Tower"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
  ]
  name = "DIGSYS-P3-TOOLS-SG"
  tags = {
    Name                     = "DIGSYS-P3-TOOLS-SG"
    "Business-Unit"          = "SME-DIGTAL-SYSTEMS",
    "Project-Code"           = "SME-2000-0512C"
    "Project-Name"           = "DIGITAL-SYSTEMS"
    "Environment"            = "Prod",
    "CLOPS_APPROVED"         = "YES",
    "OWNER"                  = "steve.leeds@sonymusic.com",
    "Terraform"              = "True",
    CLOPS_FW                 = "NO"
    aws-migration-project-id = "MPE22602"
    map-migrated             = "d-server-02sa4nzuab143a"
  }
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-UTIL-SG" {
  description = "DIGSYS-P3-UTIL-SG"
  egress = [
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "Clops-OutBound"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "Clops-OutBound"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "VPC CIDR-1"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "VPC CIDR-1"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks      = ["10.11.107.128/25"]
      description      = "EOM-FF-P"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 6432
    },
    {
      cidr_blocks = [
        "10.11.121.75/32",
      ]
      description      = "sftp-int-smart-oci.smedigitalapps.com"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks = [
        "10.11.121.75/32",
      ]
      description      = "sftp-int-smart-oci.smedigitalapps.com"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks = [
        "10.11.123.0/24",
      ]
      description      = "smeed5-scan.server.arvato-systems.de"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.11.182.30/32",
      ]
      description      = "canp1-sftp01"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks = [
        "10.12.246.64/26",
        "10.12.237.160/27",
      ]
      description      = "CLOPS-SMTP-EP"
      from_port        = 587
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 587
    },
    {
      cidr_blocks = [
        "172.34.25.224/27",
      ]
      description      = "DIGSYS-FF-AUDIT-RDS"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks = [
        "172.34.25.224/27",
      ]
      description      = "DIGSYS-FF-AUDIT-RDS"
      from_port        = 1521
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1521
    },
    {
      cidr_blocks = [
        "207.164.240.117/32",
      ]
      description      = "ftp.sonymusic.ca"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks = [
        "3.125.221.209/32",
        "18.184.91.252/32",
      ]
      description      = "digsysprodsftp.medigitalapps.com"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "NTP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
    {
      cidr_blocks      = ["162.49.251.8/32"]
      description      = "psmegrps.arvato-systems.de"
      from_port        = 8000
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 8020
    },
    {
      cidr_blocks = [
        "172.34.25.224/28",
        "172.34.25.240/28",
      ]
      description      = "DIGSYS-FF-AUDIT-RDS-1A & DIGSYS-FF-AUDIT-RDS-1B"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
  ]
  ingress = [
    {
      cidr_blocks = [
        "10.11.176.192/27",
      ]
      description      = "From CCSHARE-FF-APP-1A"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks = [
        "10.11.176.219/32",
        "10.250.2.0/24",
        "10.12.246.64/27",
      ]
      description      = "SSH from Tower"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.249.6.208/28", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3 VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
  ]
  name = "DIGSYS-P3-UTIL-SG"
  tags = {
    Name                     = "DIGSYS-P3-UTIL-SG"
    "Business-Unit"          = "SME-DIGTAL-SYSTEMS",
    "Project-Code"           = "SME-2000-0512C"
    "Project-Name"           = "DIGITAL-SYSTEMS"
    "Environment"            = "Prod",
    "CLOPS_APPROVED"         = "YES",
    "OWNER"                  = "steve.leeds@sonymusic.com",
    "Terraform"              = "True",
    CLOPS_FW                 = "NO"
    aws-migration-project-id = "MPE22602"
    map-migrated             = "d-server-02sa4nzuab143a"
  }
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-RDS-SG" {
  description = "DIGSYS-P3-RDS-SG"
  egress = [
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "For sendgrid"
      from_port        = 587
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 587
    },
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "CLOUDOPS-19574"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["10.0.0.0/8"]
      description      = "CLOUDOPS-22516"
      from_port        = 8080
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 8080
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "VPC CIDR-1"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "VPC CIDR-1"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks = [
        "10.11.120.228/32",
      ]
      description      = "Arvato datacenter"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 6432
    },
    {
      cidr_blocks = [
        "10.11.123.0/25",
      ]
      description      = "smeed6shrd1-scan.server.arvato-systems.de"
      from_port        = 1521
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1521
    },
    {
      cidr_blocks = [
        "10.11.123.0/24",
      ]
      description      = "smeed5-scan.server.arvato-systems.de"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.11.33.17/32",
        "10.11.189.13/32"
      ]
      description      = "degtluv0241.server.arvato-systems.de"
      from_port        = 8080
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 8080
    },
    {
      cidr_blocks = [
        "172.34.25.0/24",
      ]
      description      = "DMS"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks      = []
      description      = "SMTP Servers smtp.sendgrid.net"
      from_port        = 587
      ipv6_cidr_blocks = ["::/0"]
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 587
    },
    {
      cidr_blocks      = ["10.250.70.180/32", "10.11.189.13/32"]
      description      = "digsyss3-lti01"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.11.107.128/25"]
      description      = "EOM-FF-P-CIDR"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 6432
    },
  ]
  ingress = [
    {
      cidr_blocks = [
        "10.11.176.0/25",
      ]
      description      = "MAXP-ECS"
      from_port        = 1480
      to_port          = 1480
      protocol         = "tcp"
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      security_groups  = []
      self             = false
    },
    {
      cidr_blocks = [
        "10.11.96.164/30",
      ]
      description      = "CLOUDSD-7776"
      from_port        = 1480
      to_port          = 6432
      protocol         = "tcp"
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      security_groups  = []
      self             = false
    },
    {
      cidr_blocks = [
        "10.11.106.128/25",
      ]
      description      = "AOMA-P"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.251.11.0/24",
        "10.11.189.0/25",
        "10.251.12.0/22",
        "10.11.187.176/28",
        "10.11.107.128/25",
        "172.34.29.0/25",
        "10.250.19.128/28",
        "10.250.21.0/26",
      ]
      description      = "From-EOM-FF-P-DIGSYS-P3 "
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks = [
        "10.11.107.0/25",
        "10.250.1.0/25",
        "10.11.107.235/32",
      ]
      description      = "EOM-FF-D"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks      = ["172.34.24.128/25", "172.34.32.64/28", "172.34.12.0/25", "172.34.12.192/28", "172.32.6.0/24"]
      description      = "MAX-FF-P"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 6432
    },
    {
      cidr_blocks      = ["10.250.70.0/24", "10.11.187.0/25", "10.249.1.48/28"]
      description      = "DIGSYS-S3-VPC-CIDR"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 6432
    },
    {
      cidr_blocks = [
        "10.11.123.0/25",
      ]
      description      = "SMEED4"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.11.123.0/25",
      ]
      description      = "SMEED4"
      from_port        = 1521
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1521
    },
    {
      cidr_blocks = [
        "10.11.176.192/27",
      ]
      description      = "From CCSHARE-FF-APP-1A"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks = [
        "10.11.176.192/27",
      ]
      description      = "From CCSHARE-FF-APP-1A"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks = [
        "10.12.213.0/25",
        "172.34.14.192/26",
        "172.34.29.32/27",
        "172.34.29.0/27",
      ]
      description      = ""
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "10.12.213.73/32",
      ]
      description      = "supply-chain-max-dev_DMSinstance"
      from_port        = 1521
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1521
    },
    {
      cidr_blocks = [
        "172.34.25.0/24",
      ]
      description      = "DIGSYS-FF-AUDIT-RDS-SG"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks = [
        "172.34.25.0/24",
      ]
      description      = "DIGSYS-FF-AUDIT-RDS-SG"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks = [
        "35.158.190.82/32",
      ]
      description      = "DMS Instance"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks = [
        "52.58.160.10/32",
      ]
      description      = "MAX-P-DMS"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks      = ["10.250.70.180/32", "10.11.189.13/32"]
      description      = "digsyss3-lti01"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.11.96.134/32"]
      description      = "gtunxlvs07013.server.arvato-systems.de"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.11.96.133/32"]
      description      = "gtunxlvz06526.server.arvato-systems.de "
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.11.96.165/32"]
      description      = "gtunxlvv07016.server.arvato-systems.de"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.11.96.166/32"]
      description      = "gtunxlvw07017.server.arvato-systems.de"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.11.119.22/32"]
      description      = "grpsd2-utilities03"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.11.107.128/25"]
      description      = "EOM-FF-P-CIDR"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 6432
    },
    {
      cidr_blocks      = ["10.11.119.96/27", "10.11.119.64/27"]
      description      = "sme-label-copy-schedule-dev-euc1-cluster-01"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.12.214.192/27", "10.12.214.224/27"]
      description      = "sme-label-copy-schedule-dev-use1-cluster-01"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.11.178.176/28", "10.11.178.160/28"]
      description      = "sme-label-copy-schedule-prod-euc1-cluster-01"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.12.215.128/27", "10.12.215.160/27", "10.12.215.224/27", "10.12.215.192/27"]
      description      = "sme-label-copy-schedule-prod-use1-cluster-01"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.11.106.128/25", "10.11.114.192/26", "10.250.7.64/26"]
      description      = "AOMA-P1 VPC CIDR"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks = [
        "10.11.33.17/32",
        "10.11.189.13/32"
      ]
      description      = "degtluv0241.server.arvato-systems.de"
      from_port        = 8080
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 8080
    },
    {
      cidr_blocks      = ["10.11.107.128/25", "172.34.29.0/25", "10.250.19.128/28", "10.250.21.0/26", ]
      description      = "EOM-FF-P"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks      = []
      description      = "EOM-Fivetran-Proxy"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = ["sg-01da31d1d1a9ac5e8"]
      self             = false
      to_port          = 1480
    },
  ]
  name = "DIGSYS-P3-RDS-SG"
  tags = {
    Name                     = "DIGSYS-P3-RDS-SG"
    "Business-Unit"          = "SME-DIGTAL-SYSTEMS",
    "Project-Code"           = "SME-2000-0512C"
    "Project-Name"           = "DIGITAL-SYSTEMS"
    "Environment"            = "Prod",
    "CLOPS_APPROVED"         = "YES",
    "OWNER"                  = "steve.leeds@sonymusic.com",
    "Terraform"              = "True",
    CLOPS_FW                 = "NO"
    aws-migration-project-id = "MPE22602"
    map-migrated             = "d-server-02sa4nzuab143a"
  }
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-LAMBDA-SG" {
  description = "DIGSYS-P3-LAMBDA-SG"
  egress = [
    {
      cidr_blocks = [
        "0.0.0.0/0",
      ]
      description      = "For sendgrid"
      from_port        = 587
      ipv6_cidr_blocks = ["::/0"]
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 587
    },
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "atlas"
      from_port        = 27010
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 27017
    },
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "CLOUDOPS-19574"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "CLOUDOPS-19574"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.251.26.0/23"]
      description      = "VPC CIDR-1"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.251.26.0/23"]
      description      = "VPC CIDR-1"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65534
    },
  ]
  ingress = [
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
  ]
  name = "DIGSYS-P3-LAMBDA-SG"
  tags = {
    Name                     = "DIGSYS-P3-LAMBDA-SG"
    "Business-Unit"          = "SME-DIGTAL-SYSTEMS",
    "Project-Code"           = "SME-2000-0512C"
    "Project-Name"           = "DIGITAL-SYSTEMS"
    "Environment"            = "Prod",
    "CLOPS_APPROVED"         = "YES",
    "OWNER"                  = "steve.leeds@sonymusic.com",
    "Terraform"              = "True",
    CLOPS_FW                 = "NO"
    aws-migration-project-id = "MPE22602"
    map-migrated             = "d-server-02sa4nzuab143a"
  }
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-EXTERNAL-LB-SG" {
  #checkov:skip=CKV_AWS_260: Ensure no security groups allow ingress from 0.0.0.0:0 to port 80
  description = "DIGSYS-P3-EXTERNAL-LB-SG"
  egress = [
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
  ]
  ingress = [
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
  ]
  name = "DIGSYS-P3-EXTERNAL-LB-SG"
  tags = {
    Name                     = "DIGSYS-P3-EXTERNAL-LB-SG"
    "Business-Unit"          = "SME-DIGTAL-SYSTEMS",
    "Project-Code"           = "SME-2000-0512C"
    "Project-Name"           = "DIGITAL-SYSTEMS"
    "Environment"            = "Prod",
    "CLOPS_APPROVED"         = "YES",
    "OWNER"                  = "steve.leeds@sonymusic.com",
    "Terraform"              = "True",
    CLOPS_FW                 = "NO"
    aws-migration-project-id = "MPE22602"
    map-migrated             = "d-server-02sa4nzuab143a"
  }
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-SFTP-SG" {
  description = "DIGSYS-P3-SFTP-SG"
  egress = [
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "To CLSHRD-P CIDR-2"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "To CLSHRD-P CIDR-2"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
  ]
  ingress = [
    {
      cidr_blocks      = ["10.12.246.64/27", "10.250.2.64/27", "10.11.176.219/32"]
      description      = "SSH from CloudOPS-Bastions"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks = [
        "109.235.141.224/32",
      ]
      description      = "gtunxlvn04226 & gtunxlvp04228"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks = [
        "162.49.194.10/32",
        "84.17.180.232/32",
      ]
      description      = "sme-out-proxy.server.arvato-systems.de"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28"]
      description      = "SSH from VPC-CIDR"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks = [
        "3.121.35.114/32",
      ]
      description      = "CARMA-P-NAT"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks = [
        "18.184.91.252/32",
      ]
      description      = "DIGSYS-P3-NAT"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
  ]
  name = "DIGSYS-P3-SFTP-SG"
  tags = {
    Name                     = "DIGSYS-P3-SFTP-SG"
    "Business-Unit"          = "SME-DIGTAL-SYSTEMS",
    "Project-Code"           = "SME-2000-0512C"
    "Project-Name"           = "DIGITAL-SYSTEMS"
    "Environment"            = "Prod",
    "CLOPS_APPROVED"         = "YES",
    "OWNER"                  = "steve.leeds@sonymusic.com",
    "Terraform"              = "True",
    CLOPS_FW                 = "NO"
    aws-migration-project-id = "MPE22602"
    map-migrated             = "d-server-02sa4nzuab143a"
  }
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-MSK-SG" {
  description = "DIGSYS-P3-MSK-SG"
  egress = [
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks = [
        "10.12.246.64/26",
        "10.12.237.160/27",
      ]
      description      = "CLOPS-SMTP-EP"
      from_port        = 587
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 587
    },
    {
      cidr_blocks = [
        "0.0.0.0/0"
      ]
      description      = "HTTPS Internet"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks = [
        "0.0.0.0/0"
      ]
      description      = "DNS UDP"
      from_port        = 53
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 53
    },
    {
      cidr_blocks = [
        "0.0.0.0/0"
      ]
      description      = "DNS TCP"
      from_port        = 53
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 53
    },
  ]
  ingress = [
    {
      cidr_blocks = [
        "10.11.107.112/28",
      ]
      description      = "EOM-D"
      from_port        = 9094
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9094
    },
    {
      cidr_blocks = [
        "10.11.107.122/32",
      ]
      description      = "digsysd-akhq01"
      from_port        = 9094
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9094
    },
    {
      cidr_blocks      = ["10.250.242.128/25"]
      description      = "DIGSYS-D3-XAPP-SUBNETS"
      from_port        = 9094
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9094
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC CIDR"
      from_port        = 2181
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9098
    },
    {
      cidr_blocks      = ["10.11.106.128/25", "10.11.114.192/26", "172.34.29.32/27", "172.34.29.0/27"]
      description      = "AOMA-P1"
      from_port        = 9098
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9098
    },
    {
      cidr_blocks = [
        "10.11.113.0/26",
        "10.11.119.0/25",
        "10.250.6.0/24",
        "10.11.177.64/26",
      ]
      description      = "GRPS-D2"
      from_port        = 9094
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9094
    },
    {
      cidr_blocks      = ["10.11.176.192/27"]
      description      = "cloudopsff-haproxy01"
      from_port        = 9094
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9094
    },
    {
      cidr_blocks      = ["10.12.215.192/26"]
      description      = "GRPS-P1-IAPP"
      from_port        = 9094
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9094
    },
    {
      cidr_blocks = [
        "10.11.178.160/28",
      ]
      description      = "GRPS-P2-APP-1A"
      from_port        = 9094
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9094
    },
    {
      cidr_blocks = [
        "10.11.178.176/28",
      ]
      description      = "GRPS-P2-APP-1B"
      from_port        = 9094
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9094
    },
    {
      cidr_blocks = [
        "10.12.246.0/24",
      ]
      description      = "Prometheus"
      from_port        = 11001
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 11001
    },
    {
      cidr_blocks = [
        "10.12.246.0/24",
      ]
      description      = "Prometheus"
      from_port        = 11002
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 11002
    },
    {
      cidr_blocks = [
        "10.12.252.0/24",
        "172.34.22.0/24",
      ]
      description      = "SWITCHBOARD"
      from_port        = 2181
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 2181
    },
    {
      cidr_blocks = [
        "10.12.252.0/24",
        "172.34.22.0/24",
      ]
      description      = "SWITCHBOARD"
      from_port        = 9094
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9094
    },
    {
      cidr_blocks = [
        "172.34.29.24/32",
      ]
      description      = "digsysp-tools01"
      from_port        = 2182
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 2182
    },
    {
      cidr_blocks      = ["10.250.242.192/26"]
      description      = "digsysd3-akhq01"
      from_port        = 2181
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9098
    },
  ]
  name = "DIGSYS-P3-MSK-SG"
  tags = {
    Name                     = "DIGSYS-P3-MSK-SG"
    "Business-Unit"          = "SME-DIGTAL-SYSTEMS",
    "Project-Code"           = "SME-2000-0512C"
    "Project-Name"           = "DIGITAL-SYSTEMS"
    "Environment"            = "Prod",
    "CLOPS_APPROVED"         = "YES",
    "OWNER"                  = "steve.leeds@sonymusic.com",
    "Terraform"              = "True",
    CLOPS_FW                 = "NO"
    aws-migration-project-id = "MPE22602"
    map-migrated             = "d-server-02sa4nzuab143a"
  }
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-EKS-WORKER-SG" {
  description = "DIGSYS-P3-EKS-WORKER-SG"
  egress = [
    {
      cidr_blocks      = ["10.11.180.128/25"]
      description      = "GDS-P1 VPC CIDR"
      from_port        = 9094
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9098
    },
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "HTTP"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
    {
      cidr_blocks      = ["10.0.0.0/8"]
      description      = "RDS"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.0.0.0/8"]
      description      = "RDS"
      from_port        = 1480
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 1480
    },
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "HTTPS"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["10.12.246.64/26", "10.12.237.160/27"]
      description      = "SMTPS"
      from_port        = 587
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 587
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "NTP-TCP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "NTP-UDP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
    {
      cidr_blocks      = ["10.11.106.128/25", "10.11.114.192/26"]
      description      = "AOMA-P1 VPC CIDR"
      from_port        = 9094
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9098
    },
    {
      cidr_blocks      = ["10.11.180.128/25"]
      description      = "GDS-P1 VPC CIDR"
      from_port        = 9094
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 9098
    },
  ]
  ingress = [
    {
      cidr_blocks      = ["10.11.176.219/32", "10.12.246.64/27", "10.250.2.64/27"]
      description      = "CloudOPS Bastions"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks = [
        "10.12.237.0/24",
      ]
      description      = "TowerVPCcidr3"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks = [
        "10.12.246.0/25",
        "10.250.2.0/24",
      ]
      description      = "Shared-VPC"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
  ]
  name   = "DIGSYS-P3-EKS-WORKER-SG"
  tags   = merge(var.tags, { Name = "DIGSYS-P3-EKS-WORKER-SG" })
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-EKS-CLUSTER-SG" {
  description = "DIGSYS-P3-EKS-CLUSTER-SG"
  egress = [
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "HTTP"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "HTTPS"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["10.12.246.64/26", "10.12.237.160/27"]
      description      = "SMTPS"
      from_port        = 587
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 587
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "NTP-TCP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "NTP-UDP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
    {
      cidr_blocks      = ["10.11.187.53/32"]
      description      = "digsyss3-eai2app01"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
  ]
  ingress = [
    {
      cidr_blocks      = ["10.11.176.219/32", "10.12.246.64/27", "10.250.2.64/27"]
      description      = "CloudOPS Bastions"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks      = ["10.0.0.0/8"]
      description      = "HTTPS"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks = [
        "10.12.237.0/24",
      ]
      description      = "TowerVPCcidr3"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks = [
        "10.12.246.0/25",
        "10.250.2.0/24",
      ]
      description      = "Shared-VPC"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
  ]
  name   = "DIGSYS-P3-EKS-CLUSTER-SG"
  tags   = merge(var.tags, { Name = "DIGSYS-P3-EKS-CLUSTER-SG" })
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-INT-ALB-SG" {
  description = "DIGSYS-P3-INT-ALB-SG"
  egress = [
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "HTTP"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "HTTPS"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
  ]
  ingress = [
    {
      cidr_blocks      = ["10.0.0.0/8", "162.49.0.0/16", "192.168.0.0/16"]
      description      = "SME-VPN"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["172.34.24.128/25", "172.34.32.64/28", "172.34.12.0/25", "172.34.12.192/28", "172.32.6.0/24"]
      description      = "MAX-FF-P"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
  ]
  name   = "DIGSYS-P3-INT-ALB-SG"
  tags   = merge(var.tags, { Name = "DIGSYS-P3-INT-ALB-SG" })
  vpc_id = aws_vpc.DIGSYS-P3.id
}

resource "aws_security_group" "DIGSYS-P3-PGBOUNCER-SG" {
  description = "DIGSYS-P3-PGBOUNCER-SG"
  egress = [
    {
      cidr_blocks      = ["10.12.246.64/26", "10.12.237.160/27"]
      description      = "For clops-smtp-ep.smecloudops.com"
      from_port        = 587
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 587
    },
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "HTTPS"
      from_port        = 443
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 443
    },
    {
      cidr_blocks      = ["10.0.0.0/8"]
      description      = "HTTP"
      from_port        = 80
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 80
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "VPC CIDR-1"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "VPC CIDR-1"
      from_port        = 0
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 65535
    },
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "NTP-TCP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
    {
      cidr_blocks      = ["0.0.0.0/0"]
      description      = "NTP-UDP"
      from_port        = 123
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "udp"
      security_groups  = []
      self             = false
      to_port          = 123
    },
  ]
  ingress = [
    {
      cidr_blocks      = ["10.11.176.219/32", "10.12.246.64/27", "10.250.2.64/27"]
      description      = "CloudOPS Bastions"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks      = ["10.11.189.94/32", "10.251.11.235/32"]
      description      = "digsysp3 util01 & tools01"
      from_port        = 22
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 22
    },
    {
      cidr_blocks      = ["10.11.107.204/32", "10.250.70.180/32"]
      description      = "digsysp-util01 & digsyss3-lti01"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.251.11.0/24", "10.11.189.0/25", "10.251.12.0/22", "10.11.187.176/28", "10.251.26.0/23"]
      description      = "DIGSYS-P3-VPC-CIDR"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.11.176.192/27", ]
      description      = "From CCSHARE-FF-APP-1A"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.11.96.134/32"]
      description      = "gtunxlvs07013.server.arvato-systems.de"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.11.96.133/32"]
      description      = "gtunxlvz06526.server.arvato-systems.de "
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.11.96.165/32"]
      description      = "gtunxlvv07016.server.arvato-systems.de"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.11.96.166/32"]
      description      = "gtunxlvw07017.server.arvato-systems.de"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.11.96.164/32"]
      description      = "gtunxlvj19640.server.arvato-systems.de"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.11.96.167/32"]
      description      = "gtunxlvk19641.server.arvato-systems.de"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.11.119.22/32"]
      description      = "grpsd2-utilities03"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.11.119.96/27", "10.11.119.64/27"]
      description      = "sme-label-copy-schedule-dev-euc1-cluster-01"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.12.214.192/27", "10.12.214.224/27"]
      description      = "sme-label-copy-schedule-dev-use1-cluster-01"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.11.178.176/28", "10.11.178.160/28"]
      description      = "sme-label-copy-schedule-prod-euc1-cluster-01"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
    {
      cidr_blocks      = ["10.12.215.128/27", "10.12.215.160/27", "10.12.215.224/27", "10.12.215.192/27"]
      description      = "sme-label-copy-schedule-prod-use1-cluster-01"
      from_port        = 5432
      ipv6_cidr_blocks = []
      prefix_list_ids  = []
      protocol         = "tcp"
      security_groups  = []
      self             = false
      to_port          = 5432
    },
  ]
  name = "DIGSYS-P3-PGBOUNCER-SG"
  tags = {
    Name                     = "DIGSYS-P3-PGBOUNCER-SG"
    "Business-Unit"          = "SME-DIGTAL-SYSTEMS",
    "Project-Code"           = "SME-2000-0512C"
    "Project-Name"           = "DIGITAL-SYSTEMS"
    "Environment"            = "Prod",
    "CLOPS_APPROVED"         = "YES",
    "OWNER"                  = "steve.leeds@sonymusic.com",
    "Terraform"              = "True",
    CLOPS_FW                 = "NO"
    aws-migration-project-id = "MPE22602"
    map-migrated             = "d-server-02sa4nzuab143a"
  }
  vpc_id = aws_vpc.DIGSYS-P3.id
}


resource "aws_security_group" "DIGSYS-P3-DSMS-SCIM-SG" {
  name        = "DIGSYS-P3-DSMS-SCIM-SG"
  description = "DIGSYS-P3-DSMS-SCIM-SG"
  vpc_id      = aws_vpc.DIGSYS-P3.id

  ingress {
    from_port       = 8103
    to_port         = 8103
    protocol        = "tcp"
    security_groups = [aws_security_group.DIGSYS-P3-DSMSAPP01A-SG.id, aws_security_group.DIGSYS-P3-DSMS-ADMIN-SG.id, aws_security_group.DIGSYS-P3-DSMS-GATEWAY-SG.id, aws_security_group.DIGSYS-P3-INTERNAL-LB-SG.id]
    description     = "Allow DSMS App and Internal LB to communicate on port 8103"
  }

  egress {
    from_port   = 0
    to_port     = 65535
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }
}

resource "aws_security_group" "DIGSYS-P3-DSMS-ADMIN-SG" {
  name        = "DIGSYS-P3-DSMS-ADMIN-SG"
  description = "DIGSYS-P3-DSMS-ADMIN-SG"
  vpc_id      = aws_vpc.DIGSYS-P3.id

  ingress {
    from_port       = 9090
    to_port         = 9090
    protocol        = "tcp"
    security_groups = [aws_security_group.DIGSYS-P3-DSMSAPP01A-SG.id, aws_security_group.DIGSYS-P3-INTERNAL-LB-SG.id]
    description     = "Allow DSMS App and Internal LB to communicate on port 9090"
  }

  egress {
    from_port   = 0
    to_port     = 65535
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }
}

resource "aws_security_group" "DIGSYS-P3-DSMS-AUTH-SG" {
  name        = "DIGSYS-P3-DSMS-AUTH-SG"
  description = "DIGSYS-P3-DSMS-AUTH-SG"
  vpc_id      = aws_vpc.DIGSYS-P3.id

  ingress {
    from_port       = 9100
    to_port         = 9100
    protocol        = "tcp"
    security_groups = [aws_security_group.DIGSYS-P3-DSMSAPP01A-SG.id, aws_security_group.DIGSYS-P3-DSMS-ADMIN-SG.id, aws_security_group.DIGSYS-P3-DSMS-GATEWAY-SG.id]
    description     = "Allow DSMS App and Internal LB to communicate on port 9100"
  }

  egress {
    from_port   = 0
    to_port     = 65535
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }
}

resource "aws_security_group" "DIGSYS-P3-DSMS-RS-CLEARANCES-SG" {
  name        = "DIGSYS-P3-DSMS-RS-CLEARANCES-SG"
  description = "DIGSYS-P3-DSMS-RS-CLEARANCES-SG"
  vpc_id      = aws_vpc.DIGSYS-P3.id

  ingress {
    from_port       = 8102
    to_port         = 8102
    protocol        = "tcp"
    security_groups = [aws_security_group.DIGSYS-P3-DSMSAPP01A-SG.id, aws_security_group.DIGSYS-P3-INTERNAL-LB-SG.id, aws_security_group.DIGSYS-P3-DSMS-ADMIN-SG.id, aws_security_group.DIGSYS-P3-DSMS-GATEWAY-SG.id]
    description     = "Allow DSMS App and Internal LB to communicate on port 8102"
  }

  egress {
    from_port   = 0
    to_port     = 65535
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }
}


resource "aws_security_group" "DIGSYS-P3-DSMS-NOTES-SG" {
  name        = "DIGSYS-P3-DSMS-NOTES-SG"
  description = "DIGSYS-P3-DSMS-NOTES-SG"
  vpc_id      = aws_vpc.DIGSYS-P3.id
  ingress {
    from_port       = 8750
    to_port         = 8750
    protocol        = "tcp"
    security_groups = [aws_security_group.DIGSYS-P3-DSMSAPP01A-SG.id, aws_security_group.DIGSYS-P3-INTERNAL-LB-SG.id, aws_security_group.DIGSYS-P3-DSMS-ADMIN-SG.id, aws_security_group.DIGSYS-P3-DSMS-GATEWAY-SG.id]
    description     = "Allow DSMS App and Internal LB to communicate on port 8750"
  }

  egress {
    from_port   = 0
    to_port     = 65535
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }
}

resource "aws_security_group" "DIGSYS-P3-DSMS-MI-SG" {
  name        = "DIGSYS-P3-DSMS-MI-SG"
  description = "DIGSYS-P3-DSMS-MI-SG"
  vpc_id      = aws_vpc.DIGSYS-P3.id
  ingress {
    from_port       = 8550
    to_port         = 8550
    protocol        = "tcp"
    security_groups = [aws_security_group.DIGSYS-P3-DSMSAPP01A-SG.id, aws_security_group.DIGSYS-P3-DSMS-ADMIN-SG.id, aws_security_group.DIGSYS-P3-DSMS-GATEWAY-SG.id, aws_security_group.DIGSYS-P3-DSMS-CONTRACTS-SG.id, aws_security_group.DIGSYS-P3-DSMS-RS-CLEARANCES-SG.id, aws_security_group.DIGSYS-P3-DSMS-NOTES-SG.id, aws_security_group.DIGSYS-P3-DSMS-CLEARANCES-SG.id]
    description     = "Allow DSMS App and Internal LB to communicate on port 8550"
  }

  egress {
    from_port   = 0
    to_port     = 65535
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }
}
resource "aws_security_group" "DIGSYS-P3-DSMS-CLEARANCES-SG" {
  name        = "DIGSYS-P3-DSMS-CLEARANCES-SG"
  description = "DIGSYS-P3-DSMS-CLEARANCES-SG"
  vpc_id      = aws_vpc.DIGSYS-P3.id
  ingress {
    from_port       = 8100
    to_port         = 8100
    protocol        = "tcp"
    security_groups = [aws_security_group.DIGSYS-P3-DSMSAPP01A-SG.id,  aws_security_group.DIGSYS-P3-INTERNAL-LB-SG.id, aws_security_group.DIGSYS-P3-DSMS-ADMIN-SG.id, aws_security_group.DIGSYS-P3-DSMS-GATEWAY-SG.id]
    description     = "Allow DSMS App and Internal LB to communicate on port 8100"
  }

  egress {
    from_port   = 0
    to_port     = 65535
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }
}

resource "aws_security_group" "DIGSYS-P3-DSMS-CONTRACTS-SG" {
  name        = "DIGSYS-P3-DSMS-CONTRACTS-SG"
  description = "DIGSYS-P3-DSMS-CONTRACTS-SG"
  vpc_id      = aws_vpc.DIGSYS-P3.id
  ingress {
    from_port       = 8000
    to_port         = 8000
    protocol        = "tcp"
    security_groups = [aws_security_group.DIGSYS-P3-DSMSAPP01A-SG.id, aws_security_group.DIGSYS-P3-INTERNAL-LB-SG.id, aws_security_group.DIGSYS-P3-DSMS-ADMIN-SG.id, aws_security_group.DIGSYS-P3-DSMS-GATEWAY-SG.id]
    description     = "Allow DSMS App and Internal LB to communicate on port 8000"
  }

  egress {
    from_port   = 0
    to_port     = 65535
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }
}

resource "aws_security_group" "DIGSYS-P3-DSMS-USER-SG" {
  name        = "DIGSYS-P3-DSMS-USER-SG"
  description = "DIGSYS-P3-DSMS-USER-SG"
  vpc_id      = aws_vpc.DIGSYS-P3.id
  ingress {
    from_port       = 8104
    to_port         = 8104
    protocol        = "tcp"
    security_groups = [aws_security_group.DIGSYS-P3-DSMSAPP01A-SG.id, aws_security_group.DIGSYS-P3-DSMS-ADMIN-SG.id, aws_security_group.DIGSYS-P3-DSMS-GATEWAY-SG.id]
    description     = "Allow DSMS App and Internal LB to communicate on port 8104"
  }

  egress {
    from_port   = 0
    to_port     = 65535
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }
}

resource "aws_security_group" "DIGSYS-P3-DSMS-GATEWAY-SG" {
  name        = "DIGSYS-P3-DSMS-GATEWAY-SG"
  description = "DIGSYS-P3-DSMS-GATEWAY-SG"
  vpc_id      = aws_vpc.DIGSYS-P3.id
  ingress {
    from_port       = 8762
    to_port         = 8762
    protocol        = "tcp"
    security_groups = [aws_security_group.DIGSYS-P3-DSMSAPP01A-SG.id, aws_security_group.DIGSYS-P3-INTERNAL-LB-SG.id, aws_security_group.DIGSYS-P3-DSMS-ADMIN-SG.id]
    description     = "Allow DSMS App and Internal LB to communicate on port 8762"
  }

  egress {
    from_port   = 0
    to_port     = 65535
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }
}

resource "aws_security_group" "DIGSYS-P3-DSMS-EUREKA-SG" {
  name        = "DIGSYS-P3-DSMS-EUREKA-SG"
  description = "DIGSYS-P3-DSMS-EUREKA-SG"
  vpc_id      = aws_vpc.DIGSYS-P3.id
  ingress {
    from_port       = 8761
    to_port         = 8761
    protocol        = "tcp"
    security_groups = [aws_security_group.DIGSYS-P3-DSMSAPP01A-SG.id, aws_security_group.DIGSYS-P3-INTERNAL-LB-SG.id, aws_security_group.DIGSYS-P3-DSMS-ADMIN-SG.id]
    description     = "Allow DSMS App and Internal LB to communicate on port 8761"
  }

  egress {
    from_port   = 0
    to_port     = 65535
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }
}
