Skip to content

Commit 2d0aad8

Browse files
committed
feat: supports for creating security groups and rules
1 parent bb0279f commit 2d0aad8

30 files changed

+499
-56
lines changed

examples/complete/README.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

examples/complete/provider.tf

Whitespace-only changes.

examples/complete/variables.tf

Whitespace-only changes.

examples/complete/versions.tf

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/egress-rule/.header.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Example to create a egress rule for security group
2+
3+
## Example tf.vars
4+
```
5+
region = "ap-south-1"
6+
7+
rules = [
8+
{
9+
from_port = 0
10+
to_port = 0
11+
protocol = "-1"
12+
cidr_blocks = ["0.0.0.0/0"]
13+
ipv6_cidr_blocks = []
14+
}
15+
]
16+
17+
security_group_id = "sg-adsfasdfasdfa"
18+
```

examples/egress-rule/README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Example to create a egress rule for security group
2+
3+
## Example tf.vars
4+
```
5+
region = "ap-south-1"
6+
7+
rules = [
8+
{
9+
from_port = 0
10+
to_port = 0
11+
protocol = "-1"
12+
cidr_blocks = ["0.0.0.0/0"]
13+
ipv6_cidr_blocks = []
14+
}
15+
]
16+
17+
security_group_id = "sg-adsfasdfasdfa"
18+
19+
```
20+
21+
<!-- BEGIN_TF_DOCS -->
22+
# Example to create a egress rule for security group
23+
24+
## Example tf.vars
25+
```
26+
region = "ap-south-1"
27+
28+
rules = [
29+
{
30+
from_port = 0
31+
to_port = 0
32+
protocol = "-1"
33+
cidr_blocks = ["0.0.0.0/0"]
34+
ipv6_cidr_blocks = []
35+
}
36+
]
37+
38+
security_group_id = "sg-adsfasdfasdfa"
39+
```
40+
41+
## Requirements
42+
43+
| Name | Version |
44+
|------|---------|
45+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.8.4 |
46+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.51.0 |
47+
48+
## Providers
49+
50+
No providers.
51+
52+
## Modules
53+
54+
| Name | Source | Version |
55+
|------|--------|---------|
56+
| <a name="module_egress"></a> [egress](#module\_egress) | ../../modules/rule | n/a |
57+
58+
## Resources
59+
60+
No resources.
61+
62+
## Inputs
63+
64+
| Name | Description | Type | Default | Required |
65+
|------|-------------|------|---------|:--------:|
66+
| <a name="input_region"></a> [region](#input\_region) | AWS Region where the Rule to be created | `string` | n/a | yes |
67+
| <a name="input_rules"></a> [rules](#input\_rules) | List of egress rules | <pre>list(object({<br> from_port = number<br> to_port = number<br> protocol = string<br> cidr_blocks = optional(list(string), [])<br> ipv6_cidr_blocks = optional(list(string), [])<br> }))</pre> | `[]` | no |
68+
| <a name="input_security_group_id"></a> [security\_group\_id](#input\_security\_group\_id) | ID of the Security Group | `any` | n/a | yes |
69+
70+
## Outputs
71+
72+
No outputs.
73+
<!-- END_TF_DOCS -->

examples/egress-rule/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module "egress" {
2+
source = "../../modules/rule"
3+
type = "egress"
4+
security_group_id = var.security_group_id
5+
rules = var.rules
6+
}

examples/egress-rule/provider.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
provider "aws" {
2+
region = var.region
3+
}

examples/egress-rule/variables.tf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
variable "security_group_id" {
2+
description = "ID of the Security Group"
3+
type = string
4+
}
5+
6+
variable "rules" {
7+
description = "List of egress rules"
8+
type = list(object({
9+
from_port = number
10+
to_port = number
11+
protocol = string
12+
cidr_blocks = optional(list(string), [])
13+
ipv6_cidr_blocks = optional(list(string), [])
14+
}))
15+
default = []
16+
}
17+
18+
variable "region" {
19+
description = "AWS Region where the Rule to be created"
20+
type = string
21+
}

0 commit comments

Comments
 (0)