Sign in
Menu
Start free trial

Use this module

module "security_group" {
  source = "registry.compliance.tf/terraform-aws-modules/security-group/aws"

  name        = "example"
  description = "Example security group"
  vpc_id      = "vpc-12345678"

  ingress_rules = {
    https = {
      from_port   = 443
      ip_protocol = "tcp"
      cidr_ipv4   = "10.0.0.0/16"
      description = "HTTPS from internal"
    }
    self-all = {
      ip_protocol                  = "-1"
      referenced_security_group_id = "self"
      description                  = "All traffic from members of this SG"
    }
  }

  egress_rules = {
    all = {
      ip_protocol = "-1"
      cidr_ipv4   = "0.0.0.0/0"
    }
  }

  tags = {
    Environment = "dev"
  }
}

The example from the module's README, with this page's source.

Key inputs

Required inputs first, then the inputs the README example sets.

  • namestring, default ""

    Name of security group

  • descriptionstring, default null

    Description of security group

  • vpc_idstring, default null

    ID of the VPC where the security group is created

  • ingress_rulesmap({...}), default {}

    Map of ingress rules to add to the security group

  • egress_rulesmap({...}), default {}

    Map of egress rules to add to the security group

  • tagsmap(string), default {}

    A map of tags to add to all resources

All 14 inputs