Skip to content

Commit cc72f4e

Browse files
authored
vpc module fixes (#3)
vpc module fixes and add CIS checks
1 parent 4859e81 commit cc72f4e

File tree

13 files changed

+74
-15
lines changed

13 files changed

+74
-15
lines changed

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,17 @@ To configure Pritunl VPN:
104104

105105
Security scanning is graciously provided by Prowler. Prowler is the leading fully hosted, cloud-native solution providing continuous cluster security and compliance.
106106

107-
| Benchmark | Description |
108-
|--------|---------------|
109-
| Ensure no security groups allow ingress from 0.0.0.0/0 or ::/0 to port 3389 | No Security Groups open to 0.0.0.0/0 |
110-
| Ensure the default security group of every VPC restricts all traffic | No Default Security Groups open to 0.0.0.0/0 |
107+
In this module, we have implemented the following CIS Compliance checks for VPC:
108+
109+
| Benchmark | Description | Status |
110+
|-----------|-------------|--------|
111+
| Ensure no security groups allow ingress from 0.0.0.0/0 or ::/0 to port 3389 | No Security Groups open to 0.0.0.0/0 | ✔ |
112+
| Ensure no Network ACLs allow ingress from 0.0.0.0/0 to remote server administration ports | For all VPCs created using this module | ✔ |
113+
| Ensure the default security group of every VPC restricts all traffic | For all VPCs created using this module | ✔ |
114+
| Ensure VPC flow logging is enabled in all VPCs | No Default Security Groups open to 0.0.0.0/0 | ✔ |
115+
| Ensure IAM instance roles are used for AWS resource access from instances |For VPN server created using this module | ✓ |
116+
| Ensure EBS volume encryption is enabled | For VPN server created using this module | ✓ |
117+
111118

112119

113120
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/simple-vpc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Configuration in this directory creates set of VPC resources which may be sufficient for development environment.
44

5-
There is a public and private subnet created per availability zone in addition to single NAT Gateway shared between all availability zones.
5+
There is a public subnet created per availability zone with Internet Gateway and route tables.
66

77
[Read more about AWS regions, availability zones and local zones](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-regions-availability-zones).
88

examples/simple-vpc/main.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ locals {
1010
vpc_cidr = "10.10.0.0/16"
1111
}
1212

13-
data "aws_availability_zones" "available" {}
14-
1513
module "vpc" {
1614
source = "squareops/vpc/aws"
1715
name = local.name

examples/peering/README.md renamed to examples/vpc-with-peering/README.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,25 @@ Configuration in this directory creates a VPC peering connection between two VPC
44

55
## Usage
66

7-
To run this example you need to execute:
7+
To run this example you need to execute this module in two parts :
88

9-
```bash
10-
$ terraform init
11-
$ terraform plan
12-
$ terraform apply
13-
```
9+
1. Execute the below command to deploy accepter and requester VPC:
10+
11+
```bash
12+
$ cd vpc-requester-accepter
13+
$ terraform init
14+
$ terraform plan
15+
$ terraform apply
16+
```
17+
2. Copy the VPC id from the output and update in root (peering) main.tf locals block.
18+
19+
3. Execute the below command for peering of created VPC:
20+
21+
```bash
22+
$ terraform init
23+
$ terraform plan
24+
$ terraform apply
25+
```
1426

1527
Note that this example may create resources which can cost money (AWS Elastic IP, for example). Run `terraform destroy` when you don't need these resources.
1628
File renamed without changes.
File renamed without changes.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
locals {
2+
region = "us-east-2"
3+
additional_aws_tags = {
4+
Owner = "SquareOps"
5+
Expires = "Never"
6+
Department = "Engineering"
7+
}
8+
}
9+
10+
module "vpc_accepter" {
11+
source = "squareops/vpc/aws"
12+
name = "accepter"
13+
vpc_cidr = "10.10.0.0/16"
14+
environment = "dev"
15+
availability_zones = 2
16+
public_subnet_enabled = true
17+
}
18+
19+
module "vpc_requester" {
20+
source = "squareops/vpc/aws"
21+
name = "requester"
22+
vpc_cidr = "172.10.0.0/16"
23+
environment = "uat"
24+
availability_zones = 2
25+
public_subnet_enabled = true
26+
}
27+
28+
output "vpc_id_accepter" {
29+
description = "The ID of the accepter VPC"
30+
value = module.vpc_accepter.vpc_id
31+
}
32+
33+
output "vpc_id_requester" {
34+
description = "The ID of the requester VPC"
35+
value = module.vpc_requester.vpc_id
36+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
provider "aws" {
2+
region = local.region
3+
default_tags {
4+
tags = local.additional_aws_tags
5+
}
6+
}

examples/vpc-with-private-sub/main.tf renamed to examples/vpc-with-private-subnet/main.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ locals {
1010
vpc_cidr = "10.10.0.0/16"
1111
}
1212

13-
data "aws_availability_zones" "available" {}
14-
1513
module "vpc" {
1614
source = "squareops/vpc/aws"
1715
name = local.name

modules/vpc_peering/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ resource "aws_vpc_peering_connection" "this" {
4242
provider = aws.peer
4343
tags = {
4444
Name = var.name
45+
Side = "Requester"
4546
}
4647
}
4748

@@ -53,6 +54,7 @@ resource "aws_vpc_peering_connection_accepter" "this" {
5354
auto_accept = true
5455
tags = {
5556
Name = var.name
57+
Side = "Accepter"
5658
}
5759
}
5860

0 commit comments

Comments
 (0)