Skip to content

Commit 351b6a1

Browse files
author
Sohan Yadav
committed
update protocol
1 parent 8350381 commit 351b6a1

File tree

5 files changed

+42
-6
lines changed

5 files changed

+42
-6
lines changed

README.md

+31-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<!-- This file was automatically generated by the `geine`. Make all changes to `README.yaml` and run `make readme` to rebuild this file. -->
22

3+
<p align="center"> <img src="https://user-images.githubusercontent.com/50652676/62349836-882fef80-b51e-11e9-99e3-7b974309c7e3.png" width="100" height="100"></p>
4+
35

46
<h1 align="center">
57
Terraform AWS Security Group
68
</h1>
79

8-
<p align="center" style="font-size: 1.2rem;">
10+
<p align="center" style="font-size: 1.2rem;">
911
This terraform module creates set of Security Group and Security Group Rules resources in various combinations.
1012
</p>
1113

@@ -36,12 +38,24 @@
3638
<hr>
3739

3840

41+
We eat, drink, sleep and most importantly love **DevOps**. We are working towards stratergies for standardizing architecture while ensuring security for the infrastructure. We are strong believer of the philosophy <b>Bigger problems are always solved by breaking them into smaller manageable problems</b>. Resonating with microservices architecture, it is considered best-practice to run database, cluster, storage in smaller <b>connected yet manageable pieces</b> within the infrastructure.
42+
43+
This module is basically combination of [Terraform open source](https://www.terraform.io/) and includes automatation tests and examples. It also helps to create and improve your infrastructure with minimalistic code instead of maintaining the whole infrastructure code yourself.
44+
45+
We have [*fifty plus terraform modules*][terraform_modules]. A few of them are comepleted and are available for open source usage while a few others are in progress.
46+
3947

4048

4149

4250
## Prerequisites
4351

44-
This module has a few dependencies:
52+
This module has a few dependencies:
53+
54+
- [Terraform 0.12](https://learn.hashicorp.com/terraform/getting-started/install.html)
55+
- [Go](https://golang.org/doc/install)
56+
- [github.com/stretchr/testify/assert](https://github.com/stretchr/testify)
57+
- [github.com/gruntwork-io/terratest/modules/terraform](https://github.com/gruntwork-io/terratest)
58+
4559

4660

4761

@@ -50,6 +64,7 @@ This module has a few dependencies:
5064

5165
## Examples
5266

67+
5368
**IMPORTANT:** Since the `master` branch used in `source` varies based on new modifications, we suggest that you use the release versions [here](https://github.com/clouddrove/terraform-aws-security-group/releases).
5469

5570

@@ -61,6 +76,7 @@ Here is an example of how you can use this module in your inventory structure:
6176
name = "security-group"
6277
application = "clouddrove"
6378
environment = "test"
79+
protocol = "tcp"
6480
label_order = ["environment", "name", "application"]
6581
vpc_id = "vpc-xxxxxxxxx"
6682
allowed_ip = ["172.16.0.0/16", "10.0.0.0/16"]
@@ -70,6 +86,9 @@ Here is an example of how you can use this module in your inventory structure:
7086

7187

7288

89+
90+
91+
7392
## Inputs
7493

7594
| Name | Description | Type | Default | Required |
@@ -82,6 +101,7 @@ Here is an example of how you can use this module in your inventory structure:
82101
| environment | Environment (e.g. `prod`, `dev`, `staging`). | string | `` | no |
83102
| label_order | Label order, e.g. `name`,`application`. | list | `<list>` | no |
84103
| name | Name (e.g. `app` or `cluster`). | string | `` | no |
104+
| protocol | The protocol. If not icmp, tcp, udp, or all use the. | string | `tcp` | no |
85105
| security_groups | List of Security Group IDs allowed to connect to the instance. | list | `<list>` | no |
86106
| tags | Additional tags (e.g. map(`BusinessUnit`,`XYZ`). | map(string) | `<map>` | no |
87107
| vpc_id | The ID of the VPC that the instance security group belongs to. | string | `` | no |
@@ -95,14 +115,21 @@ Here is an example of how you can use this module in your inventory structure:
95115

96116

97117

118+
98119
## Testing
120+
In this module testing is performed with [terratest](https://github.com/gruntwork-io/terratest) and it creates a small piece of infrastructure, matches the output like ARN, ID and Tags name etc and destroy infrastructure in your AWS account. This testing is written in GO, so you need a [GO environment](https://golang.org/doc/install) in your system.
121+
122+
You need to run the following command in the testing folder:
123+
```hcl
124+
go test -run Test
125+
```
99126

100127

101128

102-
## Feedback
129+
## Feedback
103130
If you come accross a bug or have any feedback, please log it in our [issue tracker](https://github.com/clouddrove/terraform-aws-security-group/issues), or feel free to drop us an email at [[email protected]](mailto:[email protected]).
104131

105-
If you have found it worth your time, go ahead and give us a * on [our GitHub](https://github.com/clouddrove/terraform-aws-security-group)!
132+
If you have found it worth your time, go ahead and give us a on [our GitHub](https://github.com/clouddrove/terraform-aws-security-group)!
106133

107134
## About us
108135

README.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ usage : |-
4040
name = "security-group"
4141
application = "clouddrove"
4242
environment = "test"
43+
protocol = "tcp"
4344
label_order = ["environment", "name", "application"]
4445
vpc_id = "vpc-xxxxxxxxx"
4546
allowed_ip = ["172.16.0.0/16", "10.0.0.0/16"]

_example/example.tf

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
provider "aws" {
22
region = "eu-west-1"
3+
profile = "cd"
34
}
45

56
module "vpc" {
@@ -14,14 +15,15 @@ module "vpc" {
1415
}
1516

1617
module "security_group" {
17-
source = "git::https://github.com/clouddrove/terraform-aws-security-group.git?ref=tags/0.12.1"
18+
source = "git::https://github.com/clouddrove/terraform-aws-security-group.git?ref=tags/0.12.2"
1819

1920
name = "security-group"
2021
application = "clouddrove"
2122
environment = "test"
2223
label_order = ["environment", "name", "application"]
2324

2425
vpc_id = module.vpc.vpc_id
26+
protocol = "tcp"
2527
description = "Instance default security group (only egress access is allowed)."
2628
allowed_ip = ["172.16.0.0/16", "10.0.0.0/16"]
2729
allowed_ports = [22, 27017]

main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ resource "aws_security_group_rule" "ingress" {
5757
type = "ingress"
5858
from_port = element(var.allowed_ports, count.index)
5959
to_port = element(var.allowed_ports, count.index)
60-
protocol = "tcp"
60+
protocol = var.protocol
6161
cidr_blocks = var.allowed_ip
6262
security_group_id = aws_security_group.default[0].id
6363
}

variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,10 @@ variable "security_groups" {
6666
type = list
6767
default = []
6868
description = "List of Security Group IDs allowed to connect to the instance."
69+
}
70+
71+
variable "protocol" {
72+
type = string
73+
default = "tcp"
74+
description = "The protocol. If not icmp, tcp, udp, or all use the."
6975
}

0 commit comments

Comments
 (0)