diff --git a/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-green/ec2.DescribeVolumes_1.json b/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-green/ec2.DescribeVolumes_1.json deleted file mode 100644 index fd18e2bb5..000000000 --- a/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-green/ec2.DescribeVolumes_1.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "status_code": 200, - "data": { - "Volumes": [ - { - "Attachments": [ - { - "AttachTime": { - "__class__": "datetime", - "year": 2021, - "month": 10, - "day": 6, - "hour": 11, - "minute": 56, - "second": 8, - "microsecond": 0 - }, - "Device": "/dev/xvda", - "InstanceId": "i-07028fc32d50d31d3", - "State": "attached", - "VolumeId": "vol-050e930cdd8e359e8", - "DeleteOnTermination": true - } - ], - "AvailabilityZone": "us-east-1a", - "CreateTime": { - "__class__": "datetime", - "year": 2021, - "month": 10, - "day": 6, - "hour": 11, - "minute": 56, - "second": 8, - "microsecond": 839000 - }, - "Encrypted": true, - "KmsKeyId": "arn:aws:kms:us-east-1:644160558196:key/d790d044-f208-4947-a2d3-8622db8d40b4", - "Size": 30, - "SnapshotId": "snap-077bd5ecac9ecd22f", - "State": "in-use", - "VolumeId": "vol-050e930cdd8e359e8", - "VolumeType": "standard", - "MultiAttachEnabled": false - } - ], - "ResponseMetadata": {} - } -} \ No newline at end of file diff --git a/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-green/ecs.DescribeClusters_1.json b/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-green/ecs.DescribeClusters_1.json deleted file mode 100644 index c7dad4dba..000000000 --- a/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-green/ecs.DescribeClusters_1.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "status_code": 200, - "data": { - "clusters": [ - { - "clusterArn": "arn:aws:ecs:us-east-1:644160558196:cluster/110_ecs_cluster_green", - "clusterName": "110_ecs_cluster_green", - "status": "ACTIVE", - "registeredContainerInstancesCount": 1, - "runningTasksCount": 0, - "pendingTasksCount": 0, - "activeServicesCount": 0, - "statistics": [], - "tags": [], - "settings": [], - "capacityProviders": [], - "defaultCapacityProviderStrategy": [] - } - ], - "failures": [], - "ResponseMetadata": {} - } -} \ No newline at end of file diff --git a/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-green/ecs.DescribeContainerInstances_1.json b/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-green/ecs.DescribeContainerInstances_1.json deleted file mode 100644 index 1f4feaab8..000000000 --- a/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-green/ecs.DescribeContainerInstances_1.json +++ /dev/null @@ -1,314 +0,0 @@ -{ - "status_code": 200, - "data": { - "containerInstances": [ - { - "containerInstanceArn": "arn:aws:ecs:us-east-1:644160558196:container-instance/110_ecs_cluster_green/ef6d637d5e444e12aba2931f28c1d3eb", - "ec2InstanceId": "i-07028fc32d50d31d3", - "version": 10, - "versionInfo": { - "agentVersion": "1.55.3", - "agentHash": "67d8b9ab", - "dockerVersion": "DockerVersion: 20.10.7" - }, - "remainingResources": [ - { - "name": "CPU", - "type": "INTEGER", - "doubleValue": 0.0, - "longValue": 0, - "integerValue": 1024 - }, - { - "name": "MEMORY", - "type": "INTEGER", - "doubleValue": 0.0, - "longValue": 0, - "integerValue": 983 - }, - { - "name": "PORTS", - "type": "STRINGSET", - "doubleValue": 0.0, - "longValue": 0, - "integerValue": 0, - "stringSetValue": [ - "22", - "2376", - "2375", - "51678", - "51679" - ] - }, - { - "name": "PORTS_UDP", - "type": "STRINGSET", - "doubleValue": 0.0, - "longValue": 0, - "integerValue": 0, - "stringSetValue": [] - } - ], - "registeredResources": [ - { - "name": "CPU", - "type": "INTEGER", - "doubleValue": 0.0, - "longValue": 0, - "integerValue": 1024 - }, - { - "name": "MEMORY", - "type": "INTEGER", - "doubleValue": 0.0, - "longValue": 0, - "integerValue": 983 - }, - { - "name": "PORTS", - "type": "STRINGSET", - "doubleValue": 0.0, - "longValue": 0, - "integerValue": 0, - "stringSetValue": [ - "22", - "2376", - "2375", - "51678", - "51679" - ] - }, - { - "name": "PORTS_UDP", - "type": "STRINGSET", - "doubleValue": 0.0, - "longValue": 0, - "integerValue": 0, - "stringSetValue": [] - } - ], - "status": "ACTIVE", - "agentConnected": false, - "runningTasksCount": 0, - "pendingTasksCount": 0, - "attributes": [ - { - "name": "ecs.capability.secrets.asm.environment-variables" - }, - { - "name": "ecs.capability.branch-cni-plugin-version", - "value": "199bfc65-" - }, - { - "name": "ecs.ami-id", - "value": "ami-004bf28d7e5cfae00" - }, - { - "name": "ecs.capability.secrets.asm.bootstrap.log-driver" - }, - { - "name": "ecs.capability.task-eia.optimized-cpu" - }, - { - "name": "com.amazonaws.ecs.capability.logging-driver.none" - }, - { - "name": "ecs.capability.ecr-endpoint" - }, - { - "name": "ecs.capability.docker-plugin.local" - }, - { - "name": "ecs.capability.task-cpu-mem-limit" - }, - { - "name": "ecs.capability.secrets.ssm.bootstrap.log-driver" - }, - { - "name": "ecs.capability.efsAuth" - }, - { - "name": "ecs.capability.full-sync" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.30" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.31" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.32" - }, - { - "name": "com.amazonaws.ecs.capability.logging-driver.fluentd" - }, - { - "name": "ecs.capability.firelens.options.config.file" - }, - { - "name": "ecs.availability-zone", - "value": "us-east-1a" - }, - { - "name": "ecs.capability.aws-appmesh" - }, - { - "name": "com.amazonaws.ecs.capability.logging-driver.awslogs" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.24" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.25" - }, - { - "name": "ecs.capability.task-eni-trunking" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.26" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.27" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.28" - }, - { - "name": "com.amazonaws.ecs.capability.privileged-container" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.29" - }, - { - "name": "ecs.cpu-architecture", - "value": "x86_64" - }, - { - "name": "com.amazonaws.ecs.capability.ecr-auth" - }, - { - "name": "ecs.capability.firelens.fluentbit" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.20" - }, - { - "name": "ecs.os-type", - "value": "linux" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.21" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.22" - }, - { - "name": "ecs.capability.task-eia" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.23" - }, - { - "name": "ecs.capability.private-registry-authentication.secretsmanager" - }, - { - "name": "com.amazonaws.ecs.capability.logging-driver.syslog" - }, - { - "name": "com.amazonaws.ecs.capability.logging-driver.awsfirelens" - }, - { - "name": "ecs.capability.firelens.options.config.s3" - }, - { - "name": "com.amazonaws.ecs.capability.logging-driver.json-file" - }, - { - "name": "ecs.capability.execution-role-awslogs" - }, - { - "name": "ecs.vpc-id", - "value": "vpc-034c6ca7fddd1f0e4" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.17" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19" - }, - { - "name": "ecs.capability.docker-plugin.amazon-ecs-volume-plugin" - }, - { - "name": "ecs.capability.task-eni" - }, - { - "name": "ecs.capability.firelens.fluentd" - }, - { - "name": "ecs.capability.efs" - }, - { - "name": "ecs.capability.execution-role-ecr-pull" - }, - { - "name": "ecs.capability.task-eni.ipv6" - }, - { - "name": "ecs.capability.container-health-check" - }, - { - "name": "ecs.capability.execute-command" - }, - { - "name": "ecs.subnet-id", - "value": "subnet-07b9e16ef922b19f2" - }, - { - "name": "ecs.instance-type", - "value": "t2.micro" - }, - { - "name": "com.amazonaws.ecs.capability.task-iam-role-network-host" - }, - { - "name": "ecs.capability.container-ordering" - }, - { - "name": "ecs.capability.cni-plugin-version", - "value": "55b2ae77-2020.09.0" - }, - { - "name": "ecs.capability.env-files.s3" - }, - { - "name": "ecs.capability.pid-ipc-namespace-sharing" - }, - { - "name": "ecs.capability.secrets.ssm.environment-variables" - }, - { - "name": "com.amazonaws.ecs.capability.task-iam-role" - } - ], - "registeredAt": { - "__class__": "datetime", - "year": 2021, - "month": 10, - "day": 6, - "hour": 11, - "minute": 58, - "second": 17, - "microsecond": 974000 - }, - "attachments": [], - "tags": [] - } - ], - "failures": [], - "ResponseMetadata": {} - } -} \ No newline at end of file diff --git a/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-green/ecs.ListContainerInstances_1.json b/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-green/ecs.ListContainerInstances_1.json deleted file mode 100644 index 1eb820330..000000000 --- a/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-green/ecs.ListContainerInstances_1.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "status_code": 200, - "data": { - "containerInstanceArns": [ - "arn:aws:ecs:us-east-1:644160558196:container-instance/110_ecs_cluster_green/ef6d637d5e444e12aba2931f28c1d3eb" - ], - "ResponseMetadata": {} - } -} \ No newline at end of file diff --git a/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-red/ec2.DescribeVolumes_1.json b/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-red/ec2.DescribeVolumes_1.json deleted file mode 100644 index 5b089bdf0..000000000 --- a/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-red/ec2.DescribeVolumes_1.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "status_code": 200, - "data": { - "Volumes": [ - { - "Attachments": [ - { - "AttachTime": { - "__class__": "datetime", - "year": 2021, - "month": 10, - "day": 6, - "hour": 10, - "minute": 39, - "second": 19, - "microsecond": 0 - }, - "Device": "/dev/xvda", - "InstanceId": "i-0013be46659940d18", - "State": "attached", - "VolumeId": "vol-0d3016024cc52a36d", - "DeleteOnTermination": true - } - ], - "AvailabilityZone": "us-east-1a", - "CreateTime": { - "__class__": "datetime", - "year": 2021, - "month": 10, - "day": 6, - "hour": 10, - "minute": 39, - "second": 19, - "microsecond": 566000 - }, - "Encrypted": false, - "Size": 30, - "SnapshotId": "snap-077bd5ecac9ecd22f", - "State": "in-use", - "VolumeId": "vol-0d3016024cc52a36d", - "VolumeType": "standard", - "MultiAttachEnabled": false - } - ], - "ResponseMetadata": {} - } -} \ No newline at end of file diff --git a/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-red/ecs.DescribeClusters_1.json b/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-red/ecs.DescribeClusters_1.json deleted file mode 100644 index ec82bacce..000000000 --- a/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-red/ecs.DescribeClusters_1.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "status_code": 200, - "data": { - "clusters": [ - { - "clusterArn": "arn:aws:ecs:us-east-1:this:cluster/110_ecs_cluster_red", - "clusterName": "110_ecs_cluster_red", - "status": "ACTIVE", - "registeredContainerInstancesCount": 1, - "runningTasksCount": 0, - "pendingTasksCount": 0, - "activeServicesCount": 0, - "statistics": [], - "tags": [], - "settings": [], - "capacityProviders": [], - "defaultCapacityProviderStrategy": [] - } - ], - "failures": [], - "ResponseMetadata": {} - } -} \ No newline at end of file diff --git a/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-red/ecs.DescribeContainerInstances_1.json b/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-red/ecs.DescribeContainerInstances_1.json deleted file mode 100644 index 2e9565642..000000000 --- a/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-red/ecs.DescribeContainerInstances_1.json +++ /dev/null @@ -1,314 +0,0 @@ -{ - "status_code": 200, - "data": { - "containerInstances": [ - { - "containerInstanceArn": "arn:aws:ecs:us-east-1:this:container-instance/110_ecs_cluster_red/fdf2e5e02ef0495b8a1242f25fb0292a", - "ec2InstanceId": "i-0013be46659940d18", - "version": 8, - "versionInfo": { - "agentVersion": "1.55.3", - "agentHash": "67d8b9ab", - "dockerVersion": "DockerVersion: 20.10.7" - }, - "remainingResources": [ - { - "name": "CPU", - "type": "INTEGER", - "doubleValue": 0.0, - "longValue": 0, - "integerValue": 1024 - }, - { - "name": "MEMORY", - "type": "INTEGER", - "doubleValue": 0.0, - "longValue": 0, - "integerValue": 983 - }, - { - "name": "PORTS", - "type": "STRINGSET", - "doubleValue": 0.0, - "longValue": 0, - "integerValue": 0, - "stringSetValue": [ - "22", - "2376", - "2375", - "51678", - "51679" - ] - }, - { - "name": "PORTS_UDP", - "type": "STRINGSET", - "doubleValue": 0.0, - "longValue": 0, - "integerValue": 0, - "stringSetValue": [] - } - ], - "registeredResources": [ - { - "name": "CPU", - "type": "INTEGER", - "doubleValue": 0.0, - "longValue": 0, - "integerValue": 1024 - }, - { - "name": "MEMORY", - "type": "INTEGER", - "doubleValue": 0.0, - "longValue": 0, - "integerValue": 983 - }, - { - "name": "PORTS", - "type": "STRINGSET", - "doubleValue": 0.0, - "longValue": 0, - "integerValue": 0, - "stringSetValue": [ - "22", - "2376", - "2375", - "51678", - "51679" - ] - }, - { - "name": "PORTS_UDP", - "type": "STRINGSET", - "doubleValue": 0.0, - "longValue": 0, - "integerValue": 0, - "stringSetValue": [] - } - ], - "status": "ACTIVE", - "agentConnected": false, - "runningTasksCount": 0, - "pendingTasksCount": 0, - "attributes": [ - { - "name": "ecs.capability.secrets.asm.environment-variables" - }, - { - "name": "ecs.capability.branch-cni-plugin-version", - "value": "199bfc65-" - }, - { - "name": "ecs.ami-id", - "value": "ami-004bf28d7e5cfae00" - }, - { - "name": "ecs.capability.secrets.asm.bootstrap.log-driver" - }, - { - "name": "ecs.capability.task-eia.optimized-cpu" - }, - { - "name": "com.amazonaws.ecs.capability.logging-driver.none" - }, - { - "name": "ecs.capability.ecr-endpoint" - }, - { - "name": "ecs.capability.docker-plugin.local" - }, - { - "name": "ecs.capability.task-cpu-mem-limit" - }, - { - "name": "ecs.capability.secrets.ssm.bootstrap.log-driver" - }, - { - "name": "ecs.capability.efsAuth" - }, - { - "name": "ecs.capability.full-sync" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.30" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.31" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.32" - }, - { - "name": "com.amazonaws.ecs.capability.logging-driver.fluentd" - }, - { - "name": "ecs.capability.firelens.options.config.file" - }, - { - "name": "ecs.availability-zone", - "value": "us-east-1a" - }, - { - "name": "ecs.capability.aws-appmesh" - }, - { - "name": "com.amazonaws.ecs.capability.logging-driver.awslogs" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.24" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.25" - }, - { - "name": "ecs.capability.task-eni-trunking" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.26" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.27" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.28" - }, - { - "name": "com.amazonaws.ecs.capability.privileged-container" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.29" - }, - { - "name": "ecs.cpu-architecture", - "value": "x86_64" - }, - { - "name": "com.amazonaws.ecs.capability.ecr-auth" - }, - { - "name": "ecs.capability.firelens.fluentbit" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.20" - }, - { - "name": "ecs.os-type", - "value": "linux" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.21" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.22" - }, - { - "name": "ecs.capability.task-eia" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.23" - }, - { - "name": "ecs.capability.private-registry-authentication.secretsmanager" - }, - { - "name": "com.amazonaws.ecs.capability.logging-driver.syslog" - }, - { - "name": "com.amazonaws.ecs.capability.logging-driver.awsfirelens" - }, - { - "name": "ecs.capability.firelens.options.config.s3" - }, - { - "name": "com.amazonaws.ecs.capability.logging-driver.json-file" - }, - { - "name": "ecs.capability.execution-role-awslogs" - }, - { - "name": "ecs.vpc-id", - "value": "vpc-013fb4cef3fd4b4fb" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.17" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18" - }, - { - "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19" - }, - { - "name": "ecs.capability.docker-plugin.amazon-ecs-volume-plugin" - }, - { - "name": "ecs.capability.task-eni" - }, - { - "name": "ecs.capability.firelens.fluentd" - }, - { - "name": "ecs.capability.efs" - }, - { - "name": "ecs.capability.execution-role-ecr-pull" - }, - { - "name": "ecs.capability.task-eni.ipv6" - }, - { - "name": "ecs.capability.container-health-check" - }, - { - "name": "ecs.capability.execute-command" - }, - { - "name": "ecs.subnet-id", - "value": "subnet-0198d7dcfc9d29c1f" - }, - { - "name": "ecs.instance-type", - "value": "t2.micro" - }, - { - "name": "com.amazonaws.ecs.capability.task-iam-role-network-host" - }, - { - "name": "ecs.capability.container-ordering" - }, - { - "name": "ecs.capability.cni-plugin-version", - "value": "55b2ae77-2020.09.0" - }, - { - "name": "ecs.capability.env-files.s3" - }, - { - "name": "ecs.capability.pid-ipc-namespace-sharing" - }, - { - "name": "ecs.capability.secrets.ssm.environment-variables" - }, - { - "name": "com.amazonaws.ecs.capability.task-iam-role" - } - ], - "registeredAt": { - "__class__": "datetime", - "year": 2021, - "month": 10, - "day": 6, - "hour": 10, - "minute": 42, - "second": 6, - "microsecond": 420000 - }, - "attachments": [], - "tags": [] - } - ], - "failures": [], - "ResponseMetadata": {} - } -} \ No newline at end of file diff --git a/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-red/ecs.ListContainerInstances_1.json b/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-red/ecs.ListContainerInstances_1.json deleted file mode 100644 index 95cd30f77..000000000 --- a/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/placebo-red/ecs.ListContainerInstances_1.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "status_code": 200, - "data": { - "containerInstanceArns": [ - "arn:aws:ecs:us-east-1:644160558196:container-instance/110_ecs_cluster_red/fdf2e5e02ef0495b8a1242f25fb0292a" - ], - "ResponseMetadata": {} - } -} \ No newline at end of file diff --git a/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/red_policy_test.py b/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/red_policy_test.py deleted file mode 100644 index d7ec25c22..000000000 --- a/non-compatible/tests/ecc-aws-110-ecs_cluster_at_rest_encryption/red_policy_test.py +++ /dev/null @@ -1,11 +0,0 @@ -class PolicyTest(object): - - def test_resources_with_client(self, base_test, resources, local_session): - base_test.assertEqual(len(resources), 1) - encryption = local_session.client('ec2').describe_volumes()['Volumes'][0] - volumeInstance = encryption['Attachments'][0]['InstanceId'] - container = local_session.client('ecs').describe_container_instances(containerInstances = volumeInstance.split()) - containerInstance = container['containerInstances'][0]['ec2InstanceId'] - base_test.assertNotEqual(resources[0]['registeredContainerInstancesCount'], 0) - base_test.assertEqual(containerInstance, volumeInstance) - base_test.assertFalse(encryption['Encrypted']) \ No newline at end of file diff --git a/non-compatible/policies/ecc-aws-110-ecs_cluster_at_rest_encryption.yml b/policies/ecc-aws-110-ecs_cluster_at_rest_encryption.yml similarity index 53% rename from non-compatible/policies/ecc-aws-110-ecs_cluster_at_rest_encryption.yml rename to policies/ecc-aws-110-ecs_cluster_at_rest_encryption.yml index 1b981b32f..93a2c6d07 100644 --- a/non-compatible/policies/ecc-aws-110-ecs_cluster_at_rest_encryption.yml +++ b/policies/ecc-aws-110-ecs_cluster_at_rest_encryption.yml @@ -8,10 +8,13 @@ policies: - name: ecc-aws-110-ecs_cluster_at_rest_encryption comment: '010043082000' description: | - ECS Cluster At-Rest Encryption is disabled + ECS cluster with disabled encryption for managed storage or ephemeral storage for Fargate resource: ecs filters: - - type: encryption-instance-id-ecs-filter - key: Encrypted - op: eq - value: false + - or: + - type: value + key: configuration.managedStorageConfiguration.kmsKeyId + value: empty + - type: value + key: configuration.managedStorageConfiguration.fargateEphemeralStorageKmsKeyId + value: empty diff --git a/terraform/ecc-aws-110-ecs_cluster_at_rest_encryption/green/ecs.tf b/terraform/ecc-aws-110-ecs_cluster_at_rest_encryption/green/ecs.tf deleted file mode 100644 index 502683a29..000000000 --- a/terraform/ecc-aws-110-ecs_cluster_at_rest_encryption/green/ecs.tf +++ /dev/null @@ -1,123 +0,0 @@ -resource "aws_ecs_cluster" "this" { - name = "110_ecs_cluster_green" -} - -resource "aws_iam_role" "this" { - name = "110_role_green" - path = "/" - assume_role_policy = data.aws_iam_policy_document.this.json -} - -data "aws_iam_policy_document" "this" { - statement { - actions = ["sts:AssumeRole"] - - principals { - type = "Service" - identifiers = ["ec2.amazonaws.com"] - } - } -} - -resource "aws_iam_role_policy_attachment" "this" { - role = aws_iam_role.this.name - policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role" -} - -resource "aws_iam_instance_profile" "this" { - name = "110_ecs-instance_profile_green" - path = "/" - role = aws_iam_role.this.id -} - -resource "aws_vpc" "this" { - cidr_block = "10.0.0.0/16" - instance_tenancy = "default" - enable_dns_hostnames = true -} - -resource "aws_subnet" "this" { - vpc_id = aws_vpc.this.id - cidr_block = "10.0.1.0/24" - availability_zone = "us-east-1a" -} - -resource "aws_security_group" "this" { - name = "110_security_group_green" - vpc_id = aws_vpc.this.id - - ingress { - description = "SSH from VPC" - from_port = 22 - to_port = 22 - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } - - egress { - from_port = 0 - to_port = 0 - protocol = "-1" - cidr_blocks = ["0.0.0.0/0"] - } -} - -resource "aws_internet_gateway" "this" { - vpc_id = aws_vpc.this.id -} - -resource "aws_route_table" "this" { - vpc_id = aws_vpc.this.id - - route { - cidr_block = "0.0.0.0/0" - gateway_id = aws_internet_gateway.this.id - } -} - -resource "aws_route_table_association" "this" { - subnet_id = aws_subnet.this.id - route_table_id = aws_route_table.this.id -} - -resource "aws_instance" "this" { - ami = data.aws_ami.this.id - instance_type = "t2.micro" - associate_public_ip_address = true - security_groups = [aws_security_group.this.id] - subnet_id = aws_subnet.this.id - iam_instance_profile = aws_iam_instance_profile.this.name - user_data = <> /etc/ecs/ecs.config - EOF - - root_block_device { - volume_type = "standard" - volume_size = 30 - delete_on_termination = true - encrypted = true - } - - tags = { - Name = "110_ec2_instance_green" - } -} - -data "aws_ami" "this" { - most_recent = true - - filter { - name = "name" - values = ["amzn2-ami-ecs-*"] # ECS optimized image - } - - filter { - name = "virtualization-type" - values = ["hvm"] - } - - owners = [ - "amazon" - ] -} diff --git a/terraform/ecc-aws-110-ecs_cluster_at_rest_encryption/green1/ec2.tf b/terraform/ecc-aws-110-ecs_cluster_at_rest_encryption/green1/ec2.tf new file mode 100644 index 000000000..f7e0c5b95 --- /dev/null +++ b/terraform/ecc-aws-110-ecs_cluster_at_rest_encryption/green1/ec2.tf @@ -0,0 +1,75 @@ +resource "aws_launch_template" "this" { + name = "110_launch-template_green1" + image_id = data.aws_ami.this.id + instance_type = "t3.nano" + instance_initiated_shutdown_behavior = "terminate" + user_data = base64encode("#!/bin/bash\necho ECS_CLUSTER=${local.cluster_name} >> /etc/ecs/ecs.config") + iam_instance_profile { + name = aws_iam_instance_profile.ecs_agent.name + } + network_interfaces { + associate_public_ip_address = true + device_index = 0 + security_groups = [data.aws_security_group.this.id] + delete_on_termination = true + } + placement { + availability_zone = data.aws_availability_zones.this.names[0] + } + tag_specifications { + resource_type = "instance" + tags = { + Name = "110_ec2_instance_green1" + } + } +} + +resource "aws_autoscaling_group" "this" { + name = "110_autoscaling-group_green1" + availability_zones = [data.aws_availability_zones.this.names[0]] + launch_template { + id = aws_launch_template.this.id + version = "$Latest" + } + lifecycle { + create_before_destroy = true + } + desired_capacity = 1 + min_size = 1 + max_size = 1 + health_check_grace_period = 300 + health_check_type = "EC2" + force_delete = true + tag { + key = "AmazonECSManaged" + value = true + propagate_at_launch = true + } + tag { + key = "CustodianRule" + value = "ecc-aws-110-ecs_cluster_at_rest_encryption" + propagate_at_launch = true + } + tag { + key = "ComplianceStatus" + value = "Green1" + propagate_at_launch = true + } +} + +data "aws_ami" "this" { + most_recent = true + owners = ["amazon"] + filter { + name = "name" + values = ["amzn2-ami-ecs-hvm-*-x86_64-ebs"] + } + filter { + name = "architecture" + values = ["x86_64"] + } + filter { + name = "virtualization-type" + values = ["hvm"] + } +} diff --git a/terraform/ecc-aws-110-ecs_cluster_at_rest_encryption/green1/ecs.tf b/terraform/ecc-aws-110-ecs_cluster_at_rest_encryption/green1/ecs.tf new file mode 100644 index 000000000..69b5ec273 --- /dev/null +++ b/terraform/ecc-aws-110-ecs_cluster_at_rest_encryption/green1/ecs.tf @@ -0,0 +1,125 @@ +resource "aws_ecs_cluster" "this" { + name = local.cluster_name + configuration { + managed_storage_configuration { + kms_key_id = data.aws_kms_key.this.id + } + } +} + +data "aws_kms_key" "this" { + key_id = "alias/aws/ebs" +} + +resource "aws_cloudwatch_log_group" "this" { + name = "/ecs/110_ecs-logs_green1" +} + +resource "aws_ecs_task_definition" "this" { + family = "110_task_green1" + requires_compatibilities = ["EC2"] + runtime_platform { + operating_system_family = "LINUX" + cpu_architecture = "X86_64" + } + volume { + name = local.volume_name + configure_at_launch = true + } + cpu = 128 + memory = 256 + execution_role_arn = aws_iam_role.this.arn + task_role_arn = aws_iam_role.this.arn + + container_definitions = <> /etc/ecs/ecs.config - EOF - - root_block_device { - volume_type = "standard" - volume_size = 30 - delete_on_termination = true + ephemeral_storage { + size_in_gib = 21 } - tags = { - Name = "110_ec2_instance_red" + cpu = 256 + memory = 512 + task_role_arn = aws_iam_role.this.arn + execution_role_arn = aws_iam_role.this.arn + + container_definitions = <