Skip to content

Files

Latest commit

 

History

History
55 lines (39 loc) · 1.61 KB

aws-ec2-add-description-to-security-group.md

File metadata and controls

55 lines (39 loc) · 1.61 KB

Pattern: Missing description for AWS EC2 security group

Issue: -

Description

Security groups should include a description for auditing purposes.

Simplifies auditing, debugging, and managing security groups.

Resolution: Add descriptions for all security groups.

Examples

The following example will fail the aws-ec2-add-description-to-security-group check.

 resource "aws_security_group" "bad_example" {
   name        = "http"
   description = ""
 
   ingress {
     description = "HTTP from VPC"
     from_port   = 80
     to_port     = 80
     protocol    = "tcp"
     cidr_blocks = [aws_vpc.main.cidr_block]
   }
 }
 

The following example will pass the aws-ec2-add-description-to-security-group check.

 resource "aws_security_group" "good_example" {
   name        = "http"
   description = "Allow inbound HTTP traffic"
 
   ingress {
     description = "HTTP from VPC"
     from_port   = 80
     to_port     = 80
     protocol    = "tcp"
     cidr_blocks = [aws_vpc.main.cidr_block]
   }
 }
 

Further reading