Skip to content

Commit

Permalink
feat: added security-group-rule description
Browse files Browse the repository at this point in the history
  • Loading branch information
theprashantyadav committed Jun 15, 2023
1 parent b01f937 commit 4aa24ae
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
10 changes: 5 additions & 5 deletions _example/new_security_group/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ module "security_group" {
environment = "test"
label_order = ["name", "environment"]

vpc_id = module.vpc.vpc_id
allowed_ip = ["172.16.0.0/16", "10.0.0.0/16"]
allowed_ports = [22, 27017]
security_groups = ["sg-xxxxxxxxxxxx"]
prefix_list_ids = ["pl-xxxxxxxxxxxx"]
vpc_id = module.vpc.vpc_id
allowed_ip = ["172.16.0.0/16", "10.0.0.0/16"]
allowed_ports = [22, 27017]
security_groups = ["sg-xxxxxxxxxxxx"]
prefix_list_ids = ["pl-xxxxxxxxxxxx"]
}
12 changes: 6 additions & 6 deletions _example/new_security_group_with_egress/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ module "security_group" {
environment = "test"
label_order = ["name", "environment"]

vpc_id = module.vpc.vpc_id
allowed_ip = ["172.16.0.0/16", "10.0.0.0/16"]
allowed_ipv6 = ["2405:201:5e00:3684:cd17:9397:5734:a167/128"]
allowed_ports = [22, 27017]
security_groups = ["sg-xxxxxxxxx"]
prefix_list_ids = ["pl-6da54004"]
vpc_id = module.vpc.vpc_id
allowed_ip = ["172.16.0.0/16", "10.0.0.0/16"]
allowed_ipv6 = ["2405:201:5e00:3684:cd17:9397:5734:a167/128"]
allowed_ports = [22, 27017]
security_groups = ["sg-xxxxxxxxx"]
prefix_list_ids = ["pl-6da54004"]

egress_rule = true
egress_allowed_ip = ["172.16.0.0/16", "10.0.0.0/16"]
Expand Down
2 changes: 2 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ resource "aws_security_group_rule" "egress" {
to_port = 65535
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"] #tfsec:ignore:aws-vpc-no-public-egress-sgr
description = var.security_group_egress_rule_description
security_group_id = local.id
}
resource "aws_security_group_rule" "egress_ipv6" {
Expand All @@ -87,6 +88,7 @@ resource "aws_security_group_rule" "egress_ipv6" {
protocol = "-1"
ipv6_cidr_blocks = ["::/0"] #tfsec:ignore:aws-vpc-no-public-egress-sgr
security_group_id = local.id
description = var.security_group_egress_ipv6_rule_description
prefix_list_ids = var.prefix_list
}

Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ variable "description" {
description = "The security group description."
}

variable "security_group_egress_rule_description" {
type = string
default = ""
description = "Description of the egress rule."
}

variable "security_group_egress_ipv6_rule_description" {
type = string
default = ""
description = "Description of the egress egress-ipv6 rule."
}

variable "allowed_ports" {
type = list(any)
default = []
Expand Down

0 comments on commit 4aa24ae

Please sign in to comment.