-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upd: update policy 005 to be supported by open source Cloud Custodian
- Loading branch information
1 parent
377c567
commit 70aed96
Showing
24 changed files
with
851 additions
and
435 deletions.
There are no files selected for viewing
31 changes: 0 additions & 31 deletions
31
...s/ecc-aws-005-rds_not_open_to_large_scope/placebo-green/ec2.DescribeSecurityGroups_1.json
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
...e/tests/ecc-aws-005-rds_not_open_to_large_scope/placebo-green/tagging.GetResources_1.json
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
...sts/ecc-aws-005-rds_not_open_to_large_scope/placebo-red/ec2.DescribeSecurityGroups_1.json
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
...ble/tests/ecc-aws-005-rds_not_open_to_large_scope/placebo-red/tagging.GetResources_1.json
This file was deleted.
Oops, something went wrong.
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
40 changes: 17 additions & 23 deletions
40
terraform/ecc-aws-005-rds_not_open_to_large_scope/green/rds.tf
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,33 +1,27 @@ | ||
resource "aws_security_group" "this" { | ||
name = "005_security_group_green" | ||
description = "Restrict inbound traffic" | ||
|
||
ingress { | ||
from_port = 22 | ||
to_port = 22 | ||
protocol = "tcp" | ||
cidr_blocks = ["89.162.139.30/32"] | ||
} | ||
} | ||
|
||
resource "random_password" "this" { | ||
length = 12 | ||
lower = true | ||
min_lower = 1 | ||
upper = true | ||
min_upper = 1 | ||
special = true | ||
min_special = 1 | ||
numeric = true | ||
min_numeric = 1 | ||
override_special = "!#$%*()-_=+[]{}:?" | ||
} | ||
|
||
resource "aws_db_instance" "this" { | ||
identifier = "database-005-green" | ||
engine = "mysql" | ||
engine_version = "5.7" | ||
instance_class = "db.t2.micro" | ||
allocated_storage = 20 | ||
storage_type = "gp2" | ||
db_name = "database005green" | ||
username = "root" | ||
password = random_password.this.result | ||
parameter_group_name = "default.mysql5.7" | ||
skip_final_snapshot = true | ||
vpc_security_group_ids = ["${aws_security_group.this.id}"] | ||
identifier = "database-005-green" | ||
engine = "mysql" | ||
instance_class = "db.t4g.micro" | ||
allocated_storage = 20 | ||
storage_type = "gp2" | ||
username = "root" | ||
password = random_password.this.result | ||
skip_final_snapshot = true | ||
backup_retention_period = 0 | ||
engine_lifecycle_support = "open-source-rds-extended-support-disabled" | ||
vpc_security_group_ids = ["${aws_security_group.this.id}"] | ||
} |
90 changes: 90 additions & 0 deletions
90
terraform/ecc-aws-005-rds_not_open_to_large_scope/green/vpc.tf
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 |
---|---|---|
@@ -0,0 +1,90 @@ | ||
data "aws_vpc" "default" { | ||
default = true | ||
} | ||
|
||
data "aws_availability_zones" "this" { | ||
state = "available" | ||
} | ||
|
||
data "aws_subnets" "this" { | ||
filter { | ||
name = "vpc-id" | ||
values = [data.aws_vpc.default.id] | ||
} | ||
filter { | ||
name = "availability-zone" | ||
values = data.aws_availability_zones.this.names | ||
} | ||
filter { | ||
name = "map-public-ip-on-launch" | ||
values = ["true"] | ||
} | ||
} | ||
|
||
data "aws_security_group" "this" { | ||
filter { | ||
name = "vpc-id" | ||
values = [data.aws_vpc.default.id] | ||
} | ||
|
||
filter { | ||
name = "group-name" | ||
values = ["default"] | ||
} | ||
} | ||
|
||
resource "aws_security_group" "this" { | ||
name = "005_security_group_green" | ||
description = "Allow all inbound traffic" | ||
|
||
tags = { | ||
Name = "005_security_group_green" | ||
} | ||
} | ||
|
||
resource "aws_vpc_security_group_ingress_rule" "this1" { | ||
security_group_id = aws_security_group.this.id | ||
cidr_ipv4 = data.aws_vpc.default.cidr_block | ||
from_port = 443 | ||
ip_protocol = "tcp" | ||
to_port = 443 | ||
} | ||
|
||
resource "aws_vpc_security_group_egress_rule" "this2" { | ||
security_group_id = aws_security_group.this.id | ||
cidr_ipv4 = "0.0.0.0/0" | ||
ip_protocol = "-1" | ||
} | ||
|
||
resource "aws_vpc_security_group_egress_rule" "this3" { | ||
security_group_id = aws_security_group.this.id | ||
cidr_ipv6 = "::/0" | ||
ip_protocol = "-1" | ||
} | ||
|
||
resource "aws_vpc_security_group_ingress_rule" "this4" { | ||
security_group_id = aws_security_group.this.id | ||
referenced_security_group_id = data.aws_security_group.this.id | ||
from_port = 443 | ||
ip_protocol = "tcp" | ||
to_port = 443 | ||
} | ||
|
||
resource "aws_vpc_security_group_ingress_rule" "this5" { | ||
security_group_id = aws_security_group.this.id | ||
prefix_list_id = aws_ec2_managed_prefix_list.this.id | ||
from_port = 443 | ||
ip_protocol = "tcp" | ||
to_port = 443 | ||
} | ||
|
||
resource "aws_ec2_managed_prefix_list" "this" { | ||
name = "005_prefix_list_green" | ||
address_family = "IPv4" | ||
max_entries = 5 | ||
|
||
entry { | ||
cidr = data.aws_vpc.default.cidr_block | ||
description = "test" | ||
} | ||
} |
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
33 changes: 0 additions & 33 deletions
33
terraform/ecc-aws-005-rds_not_open_to_large_scope/red/rds.tf
This file was deleted.
Oops, something went wrong.
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
40 changes: 17 additions & 23 deletions
40
terraform/ecc-aws-005-rds_not_open_to_large_scope/red1/rds.tf
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,33 +1,27 @@ | ||
resource "aws_security_group" "this" { | ||
name = "005_security_group_red1" | ||
description = "Allow all inbound traffic" | ||
|
||
ingress { | ||
from_port = 22 | ||
to_port = 22 | ||
protocol = "tcp" | ||
cidr_blocks = ["0.0.0.0/0"] | ||
} | ||
} | ||
|
||
resource "random_password" "this" { | ||
length = 12 | ||
lower = true | ||
min_lower = 1 | ||
upper = true | ||
min_upper = 1 | ||
special = true | ||
min_special = 1 | ||
numeric = true | ||
min_numeric = 1 | ||
override_special = "!#$%*()-_=+[]{}:?" | ||
} | ||
|
||
resource "aws_db_instance" "this" { | ||
identifier = "database-005-red1" | ||
engine = "mysql" | ||
engine_version = "5.7" | ||
instance_class = "db.t2.micro" | ||
allocated_storage = 20 | ||
db_name = "database005red1" | ||
storage_type = "gp2" | ||
username = "root" | ||
password = random_password.this.result | ||
parameter_group_name = "default.mysql5.7" | ||
skip_final_snapshot = true | ||
vpc_security_group_ids = ["${aws_security_group.this.id}"] | ||
identifier = "database-005-red1" | ||
engine = "mysql" | ||
instance_class = "db.t4g.micro" | ||
allocated_storage = 20 | ||
storage_type = "gp2" | ||
username = "root" | ||
password = random_password.this.result | ||
skip_final_snapshot = true | ||
backup_retention_period = 0 | ||
engine_lifecycle_support = "open-source-rds-extended-support-disabled" | ||
vpc_security_group_ids = ["${aws_security_group.this.id}"] | ||
} |
Oops, something went wrong.