Skip to content

Commit 36989a8

Browse files
authored
Merge pull request #38 from clouddrove/feat/issue-236-a
Feat/issue 236 a
2 parents 21bcb00 + 719de17 commit 36989a8

File tree

27 files changed

+1038
-822
lines changed

27 files changed

+1038
-822
lines changed

.github/dependabot.yml

+38-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,18 @@
22
# package ecosystems to update and where the package manifests are located.
33
# Please see the documentation for all configuration options:
44
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5-
65
version: 2
76
updates:
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
9+
schedule:
10+
interval: "daily"
11+
open-pull-requests-limit: 3
12+
assignees:
13+
- "clouddrove-ci"
14+
reviewers:
15+
- "approvers"
16+
817
- package-ecosystem: "terraform" # See documentation for possible values
918
directory: "/" # Location of package manifests
1019
schedule:
@@ -15,8 +24,11 @@ updates:
1524
# Add reviewer
1625
reviewers:
1726
- "approvers"
27+
# Allow up to 3 open pull requests for pip dependencies
28+
open-pull-requests-limit: 3
29+
1830
- package-ecosystem: "terraform" # See documentation for possible values
19-
directory: "_example/new_security_group" # Location of package manifests
31+
directory: "/_example/basic" # Location of package manifests
2032
schedule:
2133
interval: "weekly"
2234
# Add assignees
@@ -25,8 +37,11 @@ updates:
2537
# Add reviewer
2638
reviewers:
2739
- "approvers"
40+
# Allow up to 3 open pull requests for pip dependencies
41+
open-pull-requests-limit: 3
42+
2843
- package-ecosystem: "terraform" # See documentation for possible values
29-
directory: "_example/new_security_group_with_egress" # Location of package manifests
44+
directory: "/_example/complete" # Location of package manifests
3045
schedule:
3146
interval: "weekly"
3247
# Add assignees
@@ -35,13 +50,31 @@ updates:
3550
# Add reviewer
3651
reviewers:
3752
- "approvers"
53+
# Allow up to 3 open pull requests for pip dependencies
54+
open-pull-requests-limit: 3
55+
3856
- package-ecosystem: "terraform" # See documentation for possible values
39-
directory: "_example/updated_existing" # Location of package manifests
57+
directory: "/_example/only_rules" # Location of package manifests
4058
schedule:
4159
interval: "weekly"
4260
# Add assignees
4361
assignees:
4462
- "clouddrove-ci"
4563
# Add reviewer
4664
reviewers:
47-
- "approvers"
65+
- "approvers"
66+
# Allow up to 3 open pull requests for pip dependencies
67+
open-pull-requests-limit: 3
68+
69+
- package-ecosystem: "terraform" # See documentation for possible values
70+
directory: "/_example/prefix_list" # Location of package manifests
71+
schedule:
72+
interval: "weekly"
73+
# Add assignees
74+
assignees:
75+
- "clouddrove-ci"
76+
# Add reviewer
77+
reviewers:
78+
- "approvers"
79+
# Allow up to 3 open pull requests for pip dependencies
80+
open-pull-requests-limit: 3

.github/workflows/auto_assignee.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
workflow_dispatch:
88
jobs:
9-
assign-pr:
9+
assignee:
1010
uses: clouddrove/github-shared-workflows/.github/workflows/auto_assignee.yml@master
1111
secrets:
1212
GITHUB: ${{ secrets.GITHUB }}

.github/workflows/tf-checks.yml

+10-6
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@ on:
55
pull_request:
66
workflow_dispatch:
77
jobs:
8-
tf-checks-new-security-group-example:
8+
tf-checks-basic-example:
99
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master
1010
with:
11-
working_directory: './_example/new_security_group/'
12-
tf-checks-new-security-group-with-egres-example:
11+
working_directory: './_example/basic/'
12+
tf-checks-complete-example:
1313
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master
1414
with:
15-
working_directory: './_example/new_security_group_with_egress/'
16-
tf-checks-updated-existing-example:
15+
working_directory: './_example/complete/'
16+
tf-checks-only_rules-example:
1717
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master
1818
with:
19-
working_directory: './_example/updated_existing/'
19+
working_directory: './_example/only_rules/'
20+
tf-checks-prefx_list-example:
21+
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master
22+
with:
23+
working_directory: './_example/prefix_list/'

README.yaml

+191-57
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
name : Terraform Module Security-Group
1+
---
2+
#
3+
# This is the canonical configuration for the `README.md`
4+
# Run `make readme` to rebuild the `README.md`
5+
#
6+
7+
# Name of this project
8+
name : Terraform AWS Subnet
29

310
# License of this project
411
license: "APACHE"
@@ -18,6 +25,9 @@ badges:
1825
image: "https://img.shields.io/badge/License-APACHE-blue.svg"
1926
url: "LICENSE.md"
2027

28+
prerequesties:
29+
- name: Terraform 1.5.4
30+
url: https://learn.hashicorp.com/terraform/getting-started/install.html
2131
# description of this project
2232
description: |-
2333
This terraform module creates set of Security Group and Security Group Rules resources in various combinations.
@@ -26,78 +36,202 @@ description: |-
2636
include:
2737
- "terraform.md"
2838

29-
# How to use this project
3039
# How to use this project
3140
usage: |-
3241
Here are some examples of how you can use this module in your inventory structure:
33-
### NEW_SECURITY_GROUP
42+
### Basic
3443
Here is an example of how you can use this module in your inventory structure:
3544
```hcl
3645
# use this
3746
module "security_group" {
38-
source = "clouddrove/security-group/aws"
39-
version = "1.3.0"
40-
name = "security-group"
47+
source = "clouddrove/security-group/aws"
48+
version = "2.0.0"
49+
name = "app"
4150
environment = "test"
42-
label_order = ["name", "environment"]
43-
44-
vpc_id = module.vpc.vpc_id
45-
new_enable_security_group = true
46-
allowed_ip = ["172.16.0.0/16", "10.0.0.0/16"]
47-
allowed_ports = [22, 27017]
48-
security_groups = []
49-
max_entries = 5
50-
prefix_list_enabled = true
51-
prefix_list_id = []
52-
entry = [
53-
{
54-
cidr = "10.0.0.0/16"
55-
description = "VPC CIDR"
51+
vpc_id = module.vpc.vpc_id
52+
53+
## INGRESS Rules
54+
new_sg_ingress_rules_with_cidr_blocks = [{
55+
rule_count = 1
56+
from_port = 22
57+
protocol = "tcp"
58+
to_port = 22
59+
cidr_blocks = [module.vpc.vpc_cidr_block, "172.16.0.0/16"]
60+
description = "Allow ssh traffic."
5661
},
5762
{
58-
cidr = "10.10.0.0/24"
59-
description = "VPC CIDR"
63+
rule_count = 2
64+
from_port = 27017
65+
protocol = "tcp"
66+
to_port = 27017
67+
cidr_blocks = ["172.16.0.0/16"]
68+
description = "Allow Mongodb traffic."
6069
}
6170
]
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+
}]
6289
}
6390
```
64-
### NEW_SECURITY_GROUP_WITH_EGRESS
65-
module "security_group" {
91+
92+
### ONLY RULES
93+
module "security_group_rules" {
6694
source = "clouddrove/security-group/aws"
67-
version = "1.3.0"
68-
name = "security-group"
69-
environment = "test"
70-
label_order = ["name", "environment"]
71-
72-
vpc_id = module.vpc.vpc_id
73-
prefix_list_enabled = false
74-
allowed_ip = ["172.16.0.0/16", "10.0.0.0/16"]
75-
allowed_ipv6 = ["2405:201:5e00:3684:cd17:9397:5734:a167/128"]
76-
allowed_ports = [22, 27017]
77-
security_groups = ["sg-xxxxxxxxx"]
78-
prefix_list_id = ["pl-6da54004"]
79-
egress_rule = true
80-
egress_allowed_ip = ["172.16.0.0/16", "10.0.0.0/16"]
81-
egress_allowed_ports = [22, 27017]
82-
egress_protocol = "tcp"
83-
egress_prefix_list_ids = ["pl-xxxxxxxxx"]
84-
egress_security_groups = ["sg-xxxxxxxxx"]
95+
version = "2.0.0"
96+
name = "app"
97+
environment = "test"
98+
vpc_id = "vpc-xxxxxxxxx"
99+
new_sg = false
100+
existing_sg_id = "sg-xxxxxxxxx"
101+
102+
## INGRESS Rules
103+
existing_sg_ingress_rules_with_cidr_blocks = [{
104+
rule_count = 1
105+
from_port = 22
106+
protocol = "tcp"
107+
to_port = 22
108+
cidr_blocks = ["10.9.0.0/16"]
109+
description = "Allow ssh traffic."
110+
},
111+
{
112+
rule_count = 2
113+
from_port = 27017
114+
protocol = "tcp"
115+
to_port = 27017
116+
cidr_blocks = ["10.9.0.0/16"]
117+
description = "Allow Mongodb traffic."
118+
}
119+
]
120+
121+
existing_sg_ingress_rules_with_self = [{
122+
rule_count = 1
123+
from_port = 22
124+
protocol = "tcp"
125+
to_port = 22
126+
description = "Allow ssh traffic."
127+
},
128+
{
129+
rule_count = 2
130+
from_port = 27017
131+
protocol = "tcp"
132+
to_port = 27017
133+
description = "Allow Mongodb traffic."
134+
}
135+
]
85136
137+
existing_sg_ingress_rules_with_source_sg_id = [{
138+
rule_count = 1
139+
from_port = 22
140+
protocol = "tcp"
141+
to_port = 22
142+
source_security_group_id = "sg-xxxxxxxxx"
143+
description = "Allow ssh traffic."
144+
},
145+
{
146+
rule_count = 2
147+
from_port = 27017
148+
protocol = "tcp"
149+
to_port = 27017
150+
source_security_group_id = "sg-xxxxxxxxx"
151+
description = "Allow Mongodb traffic."
152+
}]
153+
154+
## EGRESS Rules
155+
existing_sg_egress_rules_with_cidr_blocks = [{
156+
rule_count = 1
157+
from_port = 22
158+
protocol = "tcp"
159+
to_port = 22
160+
cidr_blocks = ["10.9.0.0/16"]
161+
description = "Allow ssh outbound traffic."
162+
},
163+
{
164+
rule_count = 2
165+
from_port = 27017
166+
protocol = "tcp"
167+
to_port = 27017
168+
cidr_blocks = ["10.9.0.0/16"]
169+
description = "Allow Mongodb outbound traffic."
170+
}]
171+
172+
existing_sg_egress_rules_with_self = [{
173+
rule_count = 1
174+
from_port = 22
175+
protocol = "tcp"
176+
to_port = 22
177+
description = "Allow ssh outbound traffic."
178+
},
179+
{
180+
rule_count = 2
181+
from_port = 27017
182+
protocol = "tcp"
183+
to_port = 27017
184+
description = "Allow Mongodb outbound traffic."
185+
}]
186+
187+
existing_sg_egress_rules_with_source_sg_id = [{
188+
rule_count = 1
189+
from_port = 22
190+
protocol = "tcp"
191+
to_port = 22
192+
source_security_group_id = "sg-xxxxxxxxx"
193+
description = "Allow ssh outbound traffic."
194+
},
195+
{
196+
rule_count = 2
197+
from_port = 27017
198+
protocol = "tcp"
199+
to_port = 27017
200+
source_security_group_id = "sg-xxxxxxxxx"
201+
description = "Allow Mongodb outbound traffic."
202+
}]
86203
}
87204
```
88-
### UPDATED_EXISTING
89-
module "security_group" {
90-
source = "clouddrove/security-group/aws"
91-
version = "1.3.0"
92-
name = "security-group"
93-
environment = "test"
94-
label_order = ["name", "environment"]
95-
96-
is_external = true
97-
existing_sg_id = "sg-xxxxxxxxxxxx"
98-
vpc_id = module.vpc.vpc_id
99-
allowed_ip = ["172.16.0.0/16", "10.0.0.0/16"]
100-
allowed_ports = [22, 27017]
101-
security_groups = ["sg-xxxxxxxxxxxxx"]
205+
206+
### PREFIX LIST
207+
module "security_group" {
208+
source = "clouddrove/security-group/aws"
209+
version = "2.0.0"
210+
name = "app"
211+
environment = "test"
212+
vpc_id = module.vpc.vpc_id
213+
prefix_list_enabled = true
214+
entry = [{
215+
cidr = "10.19.0.0/16"
216+
}]
217+
218+
## INGRESS Rules
219+
new_sg_ingress_rules_with_prefix_list = [{
220+
rule_count = 1
221+
from_port = 22
222+
protocol = "tcp"
223+
to_port = 22
224+
description = "Allow ssh traffic."
225+
}
226+
]
227+
## EGRESS Rules
228+
new_sg_egress_rules_with_prefix_list = [{
229+
rule_count = 1
230+
from_port = 3306
231+
protocol = "tcp"
232+
to_port = 3306
233+
description = "Allow mysql/aurora outbound traffic."
234+
}
235+
]
102236
}
103-
```
237+
```

0 commit comments

Comments
 (0)