Security group rule descriptions are missing

Briefly document why each rule is needed.

Description

Use each inbound or outbound rule’s description to identify the system that needs the connection and why it needs it.

Potential impact

A rule with no clear purpose can leave a port or address range open after the service stops using it.

Remediation

Use characters AWS accepts and compare the description with the actual source or destination, protocol and ports. Adding a description leaves those permissions unchanged.

Examples

Both web-sg examples allow TCP 443 from 10.0.0.0/16. The added description identifies HTTPS access from the application network as the reason.

Before

hcl
resource "aws_security_group" "web" {
  name   = "web-sg"
  vpc_id = aws_vpc.main.id

  ingress {
    from_port   = 443
    to_port     = 443
    protocol    = "tcp"
    cidr_blocks = ["10.0.0.0/16"]
  }
}

After

hcl
resource "aws_security_group" "web" {
  name   = "web-sg"
  vpc_id = aws_vpc.main.id

  ingress {
    description = "Allow HTTPS from the application network"
    from_port   = 443
    to_port     = 443
    protocol    = "tcp"
    cidr_blocks = ["10.0.0.0/16"]
  }
}

References