Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECS Task is not counted correctly. #49

Open
hiroinfinity opened this issue Mar 6, 2023 · 0 comments
Open

ECS Task is not counted correctly. #49

hiroinfinity opened this issue Mar 6, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@hiroinfinity
Copy link

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

  **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))**

Steps to reproduce

./resource-count-aws.sh cwp

@hiroinfinity hiroinfinity added the bug Something isn't working label Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant