Terraform module which creates EC2 security group within VPC on AWS.
These types of resources are supported:
Root module creates security group with provided arguments.
Modules in modules directory has been configured with the list of ingress (inbound) and egress (outbound) ports open for common scenarios (eg, ssh, http, mysql).
Code in this module aims to implement ALL combinations of arguments (IPV4/IPV6 CIDR blocks, VPC endpoint prefix lists, source security groups, self), named rules.
If there is something missing - open an issue.
There are two ways to create security groups using this module:
module "web_server_sg" {
source = "terraform-aws-modules/security-group/aws//modules/http"
name = "web-server"
description = "Security group for web-server with HTTP ports open within VPC"
vpc_id = "vpc-12345678"
ingress_cidr_blocks = ["10.10.0.0/16"]
}
module "vote_service_sg" {
source = "terraform-aws-modules/security-group/aws"
name = "user-service"
description = "Security group for user-service with custom ports open within VPC, and PostgreSQL publicly open"
vpc_id = "vpc-12345678"
ingress_cidr_blocks = ["10.10.0.0/16"]
ingress_rules = ["mysql"]
ingress_with_cidr_blocks = [
{
from_port = 8080
to_port = 8090
protocol = 6
description = "User-service ports"
cidr_blocks = "10.10.0.0/16"
},
{
rule = "postgres"
cidr_blocks = "0.0.0.0/0"
},
]
}
Ingress and egress rules can be configured in a variety of ways as listed on the registry.
Module managed by Anton Babenko.
Apache 2 Licensed. See LICENSE for full details.