Skip to content

Commit

Permalink
fix: Fixed examples and default variables
Browse files Browse the repository at this point in the history
  • Loading branch information
13archit committed Aug 3, 2023
1 parent 0f19f55 commit 581b9e2
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 219 deletions.
134 changes: 54 additions & 80 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,85 +44,75 @@ usage: |-
```hcl
# use this
module "security_group" {
source = "clouddrove/security-group/aws"
version = "2.0.0"
name = local.name
environment = local.environment
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 = 20
protocol = "udp"
to_port = 22
cidr_blocks = [module.vpc.vpc_cidr_block, "172.16.0.0/16"]
},
{
rule_count = 2
from_port = 27017
protocol = "tcp"
to_port = 27017
cidr_blocks = ["172.16.0.0/16"]
}
]
## 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 traffic."
},
{
rule_count = 2
from_port = 27017
protocol = "tcp"
to_port = 27017
cidr_blocks = ["172.16.0.0/16"]
}]
description = "Allow Mongodb traffic."
}
]
}
```
### ONLY RULES
module "security_group_rules" {
source = "clouddrove/security-group/aws"
version = "2.0.0"
name = local.name
environment = local.environment
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 = 20
protocol = "udp"
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 = 20
protocol = "tcp"
to_port = 22
rule_count = 1
from_port = 22
protocol = "tcp"
to_port = 22
description = "Allow ssh traffic."
},
{
rule_count = 2
from_port = 270
protocol = "tcp"
to_port = 270
rule_count = 2
from_port = 27017
protocol = "tcp"
to_port = 27017
description = "Allow Mongodb traffic."
}
]
Expand All @@ -132,21 +122,16 @@ usage: |-
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"
},
{
rule_count = 3
from_port = 22
protocol = "tcp"
to_port = 22
source_security_group_id = "sg-xxxxxxxxx"
}]
description = "Allow Mongodb traffic."
}]
## EGRESS Rules
existing_sg_egress_rules_with_cidr_blocks = [{
Expand All @@ -155,26 +140,30 @@ usage: |-
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 = 20
protocol = "tcp"
to_port = 22
rule_count = 1
from_port = 22
protocol = "tcp"
to_port = 22
description = "Allow ssh outbound traffic."
},
{
rule_count = 2
from_port = 270
protocol = "tcp"
to_port = 270
rule_count = 2
from_port = 27017
protocol = "tcp"
to_port = 27017
description = "Allow Mongodb outbound traffic."
}]
existing_sg_egress_rules_with_source_sg_id = [{
Expand All @@ -183,30 +172,25 @@ usage: |-
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"
},
{
rule_count = 3
from_port = 22
protocol = "tcp"
to_port = 22
source_security_group_id = "sg-xxxxxxxxx"
}]
description = "Allow Mongodb outbound traffic."
}]
}
```
### PREFIX LIST
module "security_group" {
source = "clouddrove/security-group/aws"
version = "2.0.0"
name = local.name
environment = local.environment
name = "app"
environment = "test"
vpc_id = module.vpc.vpc_id
prefix_list_enabled = true
entry = [{
Expand All @@ -215,30 +199,20 @@ usage: |-
## INGRESS Rules
new_sg_ingress_rules_with_prefix_list = [{
rule_count = 1
from_port = 22
protocol = "tcp"
to_port = 22
},
{
rule_count = 2
from_port = 20
protocol = "tcp"
to_port = 21
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 = 22
protocol = "tcp"
to_port = 22
},
{
rule_count = 2
from_port = 20
protocol = "tcp"
to_port = 21
rule_count = 1
from_port = 0
protocol = "-1"
to_port = 0
description = "Allow all outbound traffic."
}
]
}
Expand Down
25 changes: 6 additions & 19 deletions _example/basic/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,28 @@ module "vpc" {
## Security Group Module Call.
##-----------------------------------------------------------------------------
module "security_group" {
source = "./../../"
source = "clouddrove/security-group/aws"
version = "2.0.0"
name = local.name
environment = local.environment
vpc_id = module.vpc.vpc_id

## INGRESS Rules
new_sg_ingress_rules_with_cidr_blocks = [{
rule_count = 1
from_port = 20
protocol = "udp"
to_port = 22
cidr_blocks = [module.vpc.vpc_cidr_block, "172.16.0.0/16"]
},
{
rule_count = 2
from_port = 27017
protocol = "tcp"
to_port = 27017
cidr_blocks = ["172.16.0.0/16"]
}
]

## 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 traffic."
},
{
rule_count = 2
from_port = 27017
protocol = "tcp"
to_port = 27017
cidr_blocks = ["172.16.0.0/16"]
}]
description = "Allow Mongodb traffic."
}
]
}
Loading

0 comments on commit 581b9e2

Please sign in to comment.