Skip to content

Latest commit

 

History

History
82 lines (67 loc) · 3.21 KB

README.md

File metadata and controls

82 lines (67 loc) · 3.21 KB

terraform-aws-security-group

Usage:

module "security_groups" {
  source      = "git::https://github.com/petercort/terraform-aws-security-group"
  name        = "Web-SG"
  description = "Security group for web servers."
  vpc_name    = "my-workload-vpc"
  ingress_rules = [
    {
      description         = "Allow 443",
      from_port           = "443",
      to_port             = "443",
      protocol            = "TCP",
      security_group_name = "igw-sg"
    },
    {
      description         = "Allow 8443",
      from_port           = "8443",
      to_port             = "8443",
      protocol            = "TCP",
      security_group_name = "igw-sg"
    }
  ]
  egress_rules = [
    {
      description         = "Allow App Traffic",
      from_port           = "8080",
      to_port             = "8080",
      protocol            = "TCP",
      security_group_name = "app_sg"
    }
  ]
}

This module is specifically designed to handle security group to security group based rules, where none of the security groups exist.

The module will deploy the security groups, and then deploy the rules and attach them to the security group.

Requirements

No requirements.

Providers

Name Version
aws n/a

Modules

No modules.

Resources

Name Type
aws_security_group.create_security_groups resource
aws_security_group_rule.create_sg_egress_rules resource
aws_security_group_rule.create_sg_ingress_rules resource
aws_security_group.security_group data source
aws_vpcs.sg_vpc data source

Inputs

Name Description Type Default Required
description n/a string n/a yes
egress_rules n/a
list(object({
description = string
from_port = string
to_port = string
protocol = string
security_group_name = string
}))
[] no
ingress_rules n/a
list(object({
description = string
from_port = string
to_port = string
protocol = string
security_group_name = string
}))
[] no
name n/a string n/a yes
vpc_name n/a string n/a yes

Outputs

Name Description
security_group_id n/a