-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathREADME.yaml
249 lines (229 loc) · 7.12 KB
/
README.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
---
#
# This is the canonical configuration for the `README.md`
# Run `make readme` to rebuild the `README.md`
#
# Name of this project
name : Terraform AWS Security Group
# License of this project
license: "APACHE"
# Canonical GitHub repo
github_repo: clouddrove/terraform-aws-security-group
# Badges to display
badges:
- name: "Latest Release"
image: "https://img.shields.io/github/release/clouddrove/terraform-aws-security-group.svg"
url: "https://github.com/clouddrove/terraform-aws-security-group/releases/latest"
- name: "tfsec"
image: "https://github.com/clouddrove/terraform-aws-security-group/actions/workflows/tfsec.yml/badge.svg"
url: "https://github.com/clouddrove/terraform-aws-security-group/actions/workflows/tfsec.yml"
- name: "Licence"
image: "https://img.shields.io/badge/License-APACHE-blue.svg"
url: "LICENSE.md"
- name: "Changelog"
image: "https://img.shields.io/badge/Changelog-blue"
url: "CHANGELOG.md"
prerequesties:
- name: Terraform
url: https://learn.hashicorp.com/terraform/getting-started/install.html
version: ">= 1.5.0"
providers:
- name: aws
url: https://aws.amazon.com/
version: ">= 5.1.0"
module_dependencies:
- name: Labels Module
url: https://github.com/clouddrove/terraform-aws-labels
description: Provides resource tagging.
# description of this project
description: |-
This terraform module creates set of Security Group and Security Group Rules resources in various combinations.
# How to use this project
usage: |-
Here are some examples of how you can use this module in your inventory structure:
### Basic
Here is an example of how you can use this module in your inventory structure:
```hcl
module "security_group" {
source = "clouddrove/security-group/aws"
version = "2.0.0"
name = "app"
environment = "test"
vpc_id = module.vpc.vpc_id
## INGRESS Rules
new_sg_ingress_rules_with_cidr_blocks = [{
rule_count = 1
from_port = 22
protocol = "tcp"
to_port = 22
cidr_blocks = [module.vpc.vpc_cidr_block, "172.16.0.0/16"]
description = "Allow ssh traffic."
},
{
rule_count = 2
from_port = 27017
protocol = "tcp"
to_port = 27017
cidr_blocks = ["172.16.0.0/16"]
description = "Allow Mongodb traffic."
}
]
## EGRESS Rules
new_sg_egress_rules_with_cidr_blocks = [{
rule_count = 1
from_port = 22
protocol = "tcp"
to_port = 22
cidr_blocks = [module.vpc.vpc_cidr_block, "172.16.0.0/16"]
description = "Allow ssh outbound traffic."
},
{
rule_count = 2
from_port = 27017
protocol = "tcp"
to_port = 27017
cidr_blocks = ["172.16.0.0/16"]
description = "Allow Mongodb outbound traffic."
}]
}
```
### ONLY RULES
```hcl
module "security_group_rules" {
source = "clouddrove/security-group/aws"
version = "2.0.0"
name = "app"
environment = "test"
vpc_id = "vpc-xxxxxxxxx"
new_sg = false
existing_sg_id = "sg-xxxxxxxxx"
## INGRESS Rules
existing_sg_ingress_rules_with_cidr_blocks = [{
rule_count = 1
from_port = 22
protocol = "tcp"
to_port = 22
cidr_blocks = ["10.9.0.0/16"]
description = "Allow ssh traffic."
},
{
rule_count = 2
from_port = 27017
protocol = "tcp"
to_port = 27017
cidr_blocks = ["10.9.0.0/16"]
description = "Allow Mongodb traffic."
}
]
existing_sg_ingress_rules_with_self = [{
rule_count = 1
from_port = 22
protocol = "tcp"
to_port = 22
description = "Allow ssh traffic."
},
{
rule_count = 2
from_port = 27017
protocol = "tcp"
to_port = 27017
description = "Allow Mongodb traffic."
}
]
existing_sg_ingress_rules_with_source_sg_id = [{
rule_count = 1
from_port = 22
protocol = "tcp"
to_port = 22
source_security_group_id = "sg-xxxxxxxxx"
description = "Allow ssh traffic."
},
{
rule_count = 2
from_port = 27017
protocol = "tcp"
to_port = 27017
source_security_group_id = "sg-xxxxxxxxx"
description = "Allow Mongodb traffic."
}]
## EGRESS Rules
existing_sg_egress_rules_with_cidr_blocks = [{
rule_count = 1
from_port = 22
protocol = "tcp"
to_port = 22
cidr_blocks = ["10.9.0.0/16"]
description = "Allow ssh outbound traffic."
},
{
rule_count = 2
from_port = 27017
protocol = "tcp"
to_port = 27017
cidr_blocks = ["10.9.0.0/16"]
description = "Allow Mongodb outbound traffic."
}]
existing_sg_egress_rules_with_self = [{
rule_count = 1
from_port = 22
protocol = "tcp"
to_port = 22
description = "Allow ssh outbound traffic."
},
{
rule_count = 2
from_port = 27017
protocol = "tcp"
to_port = 27017
description = "Allow Mongodb outbound traffic."
}]
existing_sg_egress_rules_with_source_sg_id = [{
rule_count = 1
from_port = 22
protocol = "tcp"
to_port = 22
source_security_group_id = "sg-xxxxxxxxx"
description = "Allow ssh outbound traffic."
},
{
rule_count = 2
from_port = 27017
protocol = "tcp"
to_port = 27017
source_security_group_id = "sg-xxxxxxxxx"
description = "Allow Mongodb outbound traffic."
}]
}
```
### PREFIX LIST
```hcl
module "security_group" {
source = "clouddrove/security-group/aws"
version = "2.0.0"
name = "app"
environment = "test"
vpc_id = module.vpc.vpc_id
prefix_list_enabled = true
entry = [{
cidr = "10.19.0.0/16"
}]
## INGRESS Rules
new_sg_ingress_rules_with_prefix_list = [{
rule_count = 1
from_port = 22
protocol = "tcp"
to_port = 22
description = "Allow ssh traffic."
}
]
## EGRESS Rules
new_sg_egress_rules_with_prefix_list = [{
rule_count = 1
from_port = 3306
protocol = "tcp"
to_port = 3306
description = "Allow mysql/aurora outbound traffic."
}
]
}
```