From 14f959963ea897438e9ddb8c31d0350ae973c2a8 Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Thu, 4 Jul 2024 10:22:34 -0700 Subject: [PATCH] Favor the string method defined in the schema --- .../fargate_cpu_memory.json | 35 ++++++------------- .../fargate_properties.json | 14 ++++---- .../ecs/test_ecs_task_fargate_properties.py | 5 ++- 3 files changed, 22 insertions(+), 32 deletions(-) diff --git a/src/cfnlint/data/schemas/extensions/aws_ecs_taskdefinition/fargate_cpu_memory.json b/src/cfnlint/data/schemas/extensions/aws_ecs_taskdefinition/fargate_cpu_memory.json index cd91577f28..3fc18efad7 100644 --- a/src/cfnlint/data/schemas/extensions/aws_ecs_taskdefinition/fargate_cpu_memory.json +++ b/src/cfnlint/data/schemas/extensions/aws_ecs_taskdefinition/fargate_cpu_memory.json @@ -35,14 +35,14 @@ "properties": { "Cpu": { "enum": [ - 256 + "256" ] }, "Memory": { "enum": [ - 512, - 1024, - 2048 + "512", + "1024", + "2048" ] } } @@ -51,7 +51,7 @@ "properties": { "Cpu": { "enum": [ - 512 + "512" ] }, "Memory": { @@ -65,7 +65,7 @@ "properties": { "Cpu": { "enum": [ - 1024 + "1024" ] }, "Memory": { @@ -79,7 +79,7 @@ "properties": { "Cpu": { "enum": [ - 2048 + "2048" ] }, "Memory": { @@ -93,7 +93,7 @@ "properties": { "Cpu": { "enum": [ - 4096 + "4096" ] }, "Memory": { @@ -107,7 +107,7 @@ "properties": { "Cpu": { "enum": [ - 8192 + "8192" ] }, "Memory": { @@ -121,7 +121,7 @@ "properties": { "Cpu": { "enum": [ - 16384 + "16384" ] }, "Memory": { @@ -131,19 +131,6 @@ } } } - ], - "properties": { - "Cpu": { - "enum": [ - 256, - 512, - 1024, - 2048, - 4096, - 8192, - 16384 - ] - } - } + ] } } diff --git a/src/cfnlint/data/schemas/extensions/aws_ecs_taskdefinition/fargate_properties.json b/src/cfnlint/data/schemas/extensions/aws_ecs_taskdefinition/fargate_properties.json index 5ab80ac842..c590df4986 100644 --- a/src/cfnlint/data/schemas/extensions/aws_ecs_taskdefinition/fargate_properties.json +++ b/src/cfnlint/data/schemas/extensions/aws_ecs_taskdefinition/fargate_properties.json @@ -42,13 +42,13 @@ "properties": { "Cpu": { "enum": [ - 256, - 512, - 1024, - 2048, - 4096, - 8192, - 16384 + "256", + "512", + "1024", + "2048", + "4096", + "8192", + "16384" ] } } diff --git a/test/unit/rules/resources/ecs/test_ecs_task_fargate_properties.py b/test/unit/rules/resources/ecs/test_ecs_task_fargate_properties.py index f68d72a58f..846bd2c023 100644 --- a/test/unit/rules/resources/ecs/test_ecs_task_fargate_properties.py +++ b/test/unit/rules/resources/ecs/test_ecs_task_fargate_properties.py @@ -91,7 +91,10 @@ def rule(): }, [ ValidationError( - "128 is not one of [256, 512, 1024, 2048, 4096, 8192, 16384]", + ( + "128 is not one of ['256', '512', '1024', " + "'2048', '4096', '8192', '16384']" + ), rule=TaskFargateProperties(), path=deque(["Cpu"]), validator="enum",