Skip to content

Commit

Permalink
Modified Code
Browse files Browse the repository at this point in the history
  • Loading branch information
nitin-das committed Mar 17, 2020
1 parent dc703ea commit 31dce6e
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,70 @@ _To use this module, add the following call to your code:_
module "security_group" {
source = "git::https://github.com/nitinda/terraform-module-aws-security-group.git?ref=master"
name_prefix = "ec2-sg-"
description = "EC2 Security Group that allows traffic from whitelisted ips"
vpc_id = var.vpc_id
revoke_rules_on_delete = true
ingress_rules = [
{
from_port = 0
to_port = 0
protocol = -1
description = "Ingress rule that allows traffic from whitelisted ips"
cidr_blocks = [ module.network.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"
}
]
}
```


```tf
module "security_group" {
source = "git::https://github.com/nitinda/terraform-module-aws-security-group.git?ref=master"
name = "ec2-sg-"
description = "EC2 Security Group that allows traffic from whitelisted ips"
vpc_id = var.vpc_id
revoke_rules_on_delete = true
ingress_rules = [
{
from_port = 0
to_port = 0
protocol = -1
description = "Ingress rule that allows traffic from whitelisted ips"
cidr_blocks = [ module.network.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"
}
]
}
```


```tf
module "security_group" {
source = "git::https://github.com/nitinda/terraform-module-aws-security-group.git?ref=master"
name = "ec2-sg-"
description = "EC2 Security Group that allows traffic from whitelisted ips"
vpc_id = var.vpc_id
revoke_rules_on_delete = true
}
```
---
Expand All @@ -62,6 +125,14 @@ _The variables required in order for the module to be successfully called from t

|**_Variable_** | **_Description_** | **_Type_** | **_Argument Status_** |
|:----|:----|-----:|:---:|
| **_name\_prefix_** | _Creates a unique name beginning with the specified prefix_ | _string_ | **_Optional <br/> (Default - null)_** |
| **_name_** | _The name of the security group_ | _string_ | **_Optional <br/> (Default - null)_** |
| **_description_** | _The security group description_ | _string_ | **_Optional <br/> (Default - null)_** |
| **_ingress_** | _Ingress rules for security group_ | _any_ | **_Optional <br/> (Default - [])_** |
| **_egress_** | _Egress rules for security group_ | _any_ | **_Optional <br/> (Default - [])_** |
| **_revoke\_rules\_on\_delete_** | _Instruct Terraform to revoke all of <br/> the Security Groups attached ingress and <br/> egress rules before deleting the rule itself_ | _bool_ | **_Optional <br/> (Default - false)_** |
| **_vpc\_id_** | _The VPC ID_ | _any_ | **_Optional <br/> (Default - null)_** |
| **_tags_** | _A mapping of tags to assign to the resource_ | _map(string)_ | **_Optional <br/> (Default - {})_** |



Expand Down
1 change: 1 addition & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ variable "revoke_rules_on_delete" {

variable "vpc_id" {
description = "The VPC ID"
default = null
}

variable "tags" {
Expand Down

0 comments on commit 31dce6e

Please sign in to comment.