-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
nitin-das
committed
Mar 17, 2020
1 parent
4086128
commit 143b2ac
Showing
1 changed file
with
68 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +1,122 @@ | ||
# _Terraform Module Name: terraform-module-aws-security-group_ | ||
_Terraform module for_ **_AWS Security Group_** | ||
# Terraform Module Name: terraform-module-aws-security-group | ||
|
||
|
||
<!--BEGIN STABILITY BANNER--> | ||
--- | ||
|
||
 | ||
|
||
> **_This is a stable example. It should successfully build out of the box_** | ||
> | ||
> _This examples does is built on Construct Libraries marked "Stable" and does not have any infrastructure prerequisites to build._ | ||
--- | ||
<!--END STABILITY BANNER--> | ||
|
||
## General | ||
|
||
## _General_ | ||
|
||
_This module may be used to create_ **_Security Group_** _resources in AWS Cloud provider......._ | ||
_This module may be used to create_ **_Security Group_** _resources in AWS cloud provider...._ | ||
|
||
--- | ||
|
||
|
||
## _Prerequisites_ | ||
## Prerequisites | ||
|
||
_This module needs Terraform 0.12.23 or newer._ | ||
_You can download the latest Terraform version from_ [_here_](https://www.terraform.io/downloads.html). | ||
_This module needs_ **_Terraform 0.12.18_** _or newer._ | ||
_You can download the latest Terraform version from [here](https://www.terraform.io/downloads.html)._ | ||
|
||
_This module deploys aws services details are in respective feature branches._ | ||
|
||
--- | ||
|
||
## _Features_ | ||
|
||
## Below are the resources that are launched by this module | ||
|
||
_Below we are able to check the resources that are being created as part of this module call:_ | ||
|
||
|
||
- **_Security Group_** | ||
|
||
|
||
--- | ||
|
||
## _Usage_ | ||
## Usage | ||
|
||
## _Using this repo_ | ||
## Using this repo | ||
|
||
_To use this module, add the following call to your code:_ | ||
|
||
```tf | ||
module "security_group" { | ||
source = "git::https://github.com/nitinda/terraform-module-aws-security-group.git?ref=master" | ||
module "<layer>-security-group-<AccountID>" { | ||
source = "git::https://github.com/nitinda/terraform-module-aws-security-group.git?ref=terraform-12/master" | ||
providers = { | ||
aws = aws.services | ||
} | ||
# Tags | ||
tags = merge( | ||
var.common_tags, | ||
{ | ||
"Name" = "service-sg" | ||
"ManagedBy" = "Terraform" | ||
}, | ||
) | ||
# Security Groups | ||
name_prefix = "service-sg-" | ||
description = "Code Build EC2 Instance security group that allows traffic from whitelisted ips" | ||
vpc_id = var.vpc_id | ||
revoke_rules_on_delete = true | ||
ingress_rules = [ | ||
{ | ||
from_port = 22 | ||
to_port = 22 | ||
protocol = "tcp" | ||
description = "Ingress rule that allows traffic from subnets" | ||
cidr_blocks = [ var.vpc_cidr ] | ||
} | ||
] | ||
egress_rules = [ | ||
{ | ||
from_port = 0 | ||
to_port = 0 | ||
protocol = "-1" | ||
cidr_blocks = ["0.0.0.0/0"] | ||
description = "The egress rule allows all ports" | ||
} | ||
] | ||
} | ||
``` | ||
--- | ||
|
||
## _Inputs_ | ||
## Inputs | ||
|
||
_The variables required in order for the module to be successfully called from the deployment repository are the following:_ | ||
|
||
|**_Variable_** | **_Description_** | **_Type_** | **_Argument Status_** | | ||
|:----|:----|-----:|:---:| | ||
|
||
|
||
|
||
--- | ||
|
||
|**_Variable_** | **_Description_** | **_Type_** | **_Argument Status_** | | ||
|:----|:----|-----:|-----:| | ||
| **_name\_prefix_** | Name prefix | _string_ | **_Required_** | | ||
| **_description_** | description | _string_ | **_Required_** | | ||
| **_vpc\_id_** | VPC ID | _string_ | **_Required_** | | ||
| **_tags_** | Resource Tag | _map(string)_ | **_Required_** | | ||
| **_revoke\_rules\_on\_delete_** | Instruct Terraform to revoke | _string_ | **_Optional_** *(Default - **false**)* | | ||
| **_ingress\_rules_** | Ingress Rules | _any_ | **_Optional_** *(Default - **[]**)* | | ||
| **_egress\_rules_** | Egress Rules | _any_ | **_Optional_** *(Default - **[]**)* | | ||
|
||
# _Outputs_ | ||
|
||
### _General_ | ||
|
||
_This module has the following outputs:_ | ||
## Outputs | ||
|
||
- **_id_** | ||
- **_arn_** | ||
- **_name_** | ||
|
||
|
||
--- | ||
|
||
### _Usage_ | ||
|
||
_In order for the variables to be accessed at module level please use the syntax below:_ | ||
### Usage | ||
_In order for the variables to be accessed on module level please use the syntax below:_ | ||
|
||
```tf | ||
module.<module_name>.<output_variable_name> | ||
``` | ||
|
||
|
||
_The output variable is able to be accessed through terraform state file using the syntax below:_ | ||
|
||
```tf | ||
data.terraform_remote_state.<layer_name>.<output_variable_name> | ||
"${data.terraform_remote_state.<module_name>.<output_variable_name>}" | ||
``` | ||
|
||
--- | ||
|
||
|
||
|
||
## _Authors_ | ||
|
||
_Module maintained by Module maintained by the -_ **_Nitin Das_** | ||
## Authors | ||
_Module maintained by Module maintained by the -_**_Nitin Das_** |