File tree Expand file tree Collapse file tree 5 files changed +97
-17
lines changed
Expand file tree Collapse file tree 5 files changed +97
-17
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,24 @@ usage: |-
6868 description = "Allow Mongodb traffic."
6969 }
7070 ]
71+
72+ ## EGRESS Rules
73+ new_sg_egress_rules_with_cidr_blocks = [{
74+ rule_count = 1
75+ from_port = 22
76+ protocol = "tcp"
77+ to_port = 22
78+ cidr_blocks = [module.vpc.vpc_cidr_block, "172.16.0.0/16"]
79+ description = "Allow ssh outbound traffic."
80+ },
81+ {
82+ rule_count = 2
83+ from_port = 27017
84+ protocol = "tcp"
85+ to_port = 27017
86+ cidr_blocks = ["172.16.0.0/16"]
87+ description = "Allow Mongodb outbound traffic."
88+ }]
7189 }
7290 ```
7391
@@ -209,10 +227,10 @@ usage: |-
209227 ## EGRESS Rules
210228 new_sg_egress_rules_with_prefix_list = [{
211229 rule_count = 1
212- from_port = 0
213- protocol = "-1 "
214- to_port = 0
215- description = "Allow all outbound traffic."
230+ from_port = 3306
231+ protocol = "tcp "
232+ to_port = 3306
233+ description = "Allow mysql/aurora outbound traffic."
216234 }
217235 ]
218236 }
Original file line number Diff line number Diff line change @@ -46,4 +46,22 @@ module "security_group" {
4646 description = " Allow Mongodb traffic."
4747 }
4848 ]
49+
50+ # # EGRESS Rules
51+ new_sg_egress_rules_with_cidr_blocks = [{
52+ rule_count = 1
53+ from_port = 22
54+ protocol = " tcp"
55+ to_port = 22
56+ cidr_blocks = [module.vpc.vpc_cidr_block, " 172.16.0.0/16" ]
57+ description = " Allow ssh outbound traffic."
58+ },
59+ {
60+ rule_count = 2
61+ from_port = 27017
62+ protocol = " tcp"
63+ to_port = 27017
64+ cidr_blocks = [" 172.16.0.0/16" ]
65+ description = " Allow Mongodb outbound traffic."
66+ }]
4967}
Original file line number Diff line number Diff line change @@ -79,4 +79,55 @@ module "security_group" {
7979 source_security_group_id = " sg-xxxxxxxxx"
8080 description = " Allow Mongodb traffic."
8181 }]
82+
83+ # # EGRESS Rules
84+ new_sg_egress_rules_with_cidr_blocks = [{
85+ rule_count = 1
86+ from_port = 22
87+ protocol = " tcp"
88+ to_port = 22
89+ cidr_blocks = [module.vpc.vpc_cidr_block, " 172.16.0.0/16" ]
90+ description = " Allow ssh outbound traffic."
91+ },
92+ {
93+ rule_count = 2
94+ from_port = 27017
95+ protocol = " tcp"
96+ to_port = 27017
97+ cidr_blocks = [" 172.16.0.0/16" ]
98+ description = " Allow Mongodb outbound traffic."
99+ }
100+ ]
101+
102+ new_sg_egress_rules_with_self = [{
103+ rule_count = 1
104+ from_port = 22
105+ protocol = " tcp"
106+ to_port = 22
107+ description = " Allow ssh outbound traffic."
108+ },
109+ {
110+ rule_count = 2
111+ from_port = 27017
112+ protocol = " tcp"
113+ to_port = 27017
114+ description = " Allow Mongodb traffic."
115+ }]
116+
117+ new_sg_egress_rules_with_source_sg_id = [{
118+ rule_count = 1
119+ from_port = 22
120+ protocol = " tcp"
121+ to_port = 22
122+ source_security_group_id = " sg-xxxxxxxxx"
123+ description = " Allow ssh outbound traffic."
124+ },
125+ {
126+ rule_count = 2
127+ from_port = 27017
128+ protocol = " tcp"
129+ to_port = 27017
130+ source_security_group_id = " sg-xxxxxxxxx"
131+ description = " Allow Mongodb traffic."
132+ }]
82133}
Original file line number Diff line number Diff line change @@ -44,10 +44,10 @@ module "security_group" {
4444 # # EGRESS Rules
4545 new_sg_egress_rules_with_prefix_list = [{
4646 rule_count = 1
47- from_port = 0
48- protocol = " -1 "
49- to_port = 0
50- description = " Allow all outbound traffic."
47+ from_port = 3306
48+ protocol = " tcp "
49+ to_port = 3306
50+ description = " Allow mysql/aurora outbound traffic."
5151 }
5252 ]
5353}
Original file line number Diff line number Diff line change @@ -114,15 +114,8 @@ variable "existing_sg_ingress_rules_with_prefix_list" {
114114}
115115
116116variable "new_sg_egress_rules_with_cidr_blocks" {
117- type = any
118- default = [{
119- rule_count = 1
120- from_port = 0
121- protocol = " -1"
122- to_port = 0
123- cidr_blocks = [" 0.0.0.0/0" ]
124- description = " Allow all outboud traffic."
125- }]
117+ type = any
118+ default = {}
126119 description = " Egress rules with only cidr_blockd. Should be used when new security group is been deployed."
127120}
128121
You can’t perform that action at this time.
0 commit comments