Open hiroinfinity opened 1 year ago
In cwp mode, ECS Task is not counted correctly. The number of ECS Fargate Tasks cannot be obtained correctly in aws-resource-count.sh with cwp option.
To obtain the correct ECS cluster name and count the number of individual Fargate tasks.
FargateTask per cluster is not get correctly.
Modify the script function "get_ecs_fargate_task_count()". For example, how about modifying the following?
https://github.com/PaloAltoNetworks/pcs-sizing-scripts/blob/main/aws/resource-count-aws.sh#L241-L253
**ECS_FARGATE_CLUSTERS=($(aws_ecs_list_clusters "${REGION}" | jq -r '.clusterArns[]' 2>/dev/null))** XIFS=$IFS # shellcheck disable=SC2206 **IFS=$'\n' ECS_FARGATE_CLUSTERS_LIST=(${ECS_FARGATE_CLUSTERS[@]})** IFS=$XIFS ECS_FARGATE_TASK_LIST_COUNT=0 RESULT=0 for CLUSTER in "${ECS_FARGATE_CLUSTERS_LIST[@]}" do **ECS_FARGATE_TASK_LIST_COUNT=($(aws_ecs_list_tasks "${REGION}" "${CLUSTER}" | jq -r '[.taskArns[]] | length' 2>/dev/null))**
./resource-count-aws.sh cwp
Describe the bug
In cwp mode, ECS Task is not counted correctly. The number of ECS Fargate Tasks cannot be obtained correctly in aws-resource-count.sh with cwp option.
Expected behavior
To obtain the correct ECS cluster name and count the number of individual Fargate tasks.
Current behavior
FargateTask per cluster is not get correctly.
Possible solution
Modify the script function "get_ecs_fargate_task_count()". For example, how about modifying the following?
https://github.com/PaloAltoNetworks/pcs-sizing-scripts/blob/main/aws/resource-count-aws.sh#L241-L253
Steps to reproduce
./resource-count-aws.sh cwp