This module creates EC2 Security Group Rules.
# main.tf
module "instance_sg_rules" {
source = "git::https://github.com/lpavliuk/Terraform-Modules.git//aws_security_group_rules"
security_group_id = local.instance_sg_id
inbound_rules = [
{
description = "(MySQL) from Specific IP Address"
protocol = "tcp"
port_range = 3306
source_type = "cidr_ipv4"
source = "172.31.11.16/32"
},
{
description = "(MSs Ports) from VPC"
protocol = "tcp"
port_range = "52000-52999"
source_type = "cidr_ipv4"
source = "172.31.0.0/16"
},
{
description = "from EC2 VPN"
port_range = "all"
source_type = "security_group_id"
source = local.vpn_instance_sg_id
},
]
}
Name | Version |
---|---|
terraform | < 2.0.0, >= 1.6.6 |
aws | < 6.0, >= 5.22 |
Name | Description | Type | Default | Required |
---|---|---|---|---|
security_group_id | Security Group ID | string |
n/a | yes |
inbound_rules | Inbound Rules. Use port_range = "all" to define all traffic rule.port_range definition examples:- 80 - "80" - "80-443" - "all" Available source_type values:- cidr_ipv4 - cidr_ipv6 - security_group_id - prefix_list_id |
list(object({ |
[] |
no |
outbound_rules | Outbound Rules. Use port_range = "all" to define all traffic rule.port_range definition examples:- 80 - "80" - "80-443" - "all" Available source_type values:- cidr_ipv4 - cidr_ipv6 - security_group_id - prefix_list_id |
list(object({ |
[] |
no |
Name | Description |
---|---|
security_group_id | Security Group ID |
Name | Type |
---|---|
aws_vpc_security_group_egress_rule.this | resource |
aws_vpc_security_group_ingress_rule.this | resource |