Skip to content

Commit e08e123

Browse files
authored
[NDR-19] EC2 Default Security Group Hardening (#282)
* [NDR-19] default vpc and sg * [NDR-19] add change to default sg in module
1 parent bc7b256 commit e08e123

File tree

5 files changed

+22
-1
lines changed

5 files changed

+22
-1
lines changed

bootstrap/README.md

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

1010
| Name | Version |
1111
|------|---------|
12-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.70.0 |
12+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.0 |
1313

1414
## Modules
1515

infrastructure/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@
224224
| [aws_cloudwatch_metric_alarm.stitching_dlq_new_messages](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_metric_alarm) | resource |
225225
| [aws_cognito_identity_pool.cloudwatch_rum](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cognito_identity_pool) | resource |
226226
| [aws_cognito_identity_pool_roles_attachment.cloudwatch_rum](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cognito_identity_pool_roles_attachment) | resource |
227+
| [aws_default_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_security_group) | resource |
228+
| [aws_default_vpc.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_vpc) | resource |
227229
| [aws_iam_policy.cloudwatch_log_query_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
228230
| [aws_iam_policy.cloudwatch_rum_cognito_access](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
229231
| [aws_iam_policy.copy_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |

infrastructure/modules/vpc/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ No modules.
1616

1717
| Name | Type |
1818
|------|------|
19+
| [aws_default_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_security_group) | resource |
1920
| [aws_eip.eip](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip) | resource |
2021
| [aws_internet_gateway.ig](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/internet_gateway) | resource |
2122
| [aws_nat_gateway.public](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/nat_gateway) | resource |

infrastructure/modules/vpc/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ resource "aws_vpc" "vpc" {
1818
}
1919
}
2020

21+
resource "aws_default_security_group" "default" {
22+
vpc_id = local.is_production ? aws_vpc.vpc[0].id : data.aws_vpc.vpc[0].id
23+
ingress = []
24+
egress = []
25+
}
26+
2127
data "aws_internet_gateway" "ig" {
2228
count = local.is_production ? 0 : 1
2329
tags = {

infrastructure/vpc.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,15 @@ module "ndr-vpc-ui" {
2020
environment = var.environment
2121
owner = var.owner
2222
}
23+
24+
resource "aws_default_vpc" "default" {
25+
tags = {
26+
Name = "Default VPC"
27+
}
28+
}
29+
30+
resource "aws_default_security_group" "default" {
31+
vpc_id = aws_default_vpc.default.id
32+
ingress = []
33+
egress = []
34+
}

0 commit comments

Comments
 (0)