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

Behavior of "desired_count" variable is misleading in service module #257

Open
darcuri opened this issue Feb 13, 2025 · 2 comments
Open

Comments

@darcuri
Copy link

darcuri commented Feb 13, 2025

Description

In the service module, the README states "desired_count" is ignored, but it is actually used with the "autoscaling_[min|max]_capacity" variable to set upper or lower limits for aws_autoscaling_target.

This is misleading without reading the module code. The documentation could be clearer to specify what "desired_count" actually does, especially that it defaults to "1" which would affect anyone trying to set limits on autoscaling targets.

@bryantbiggs
Copy link
Member

@francisctan
Copy link

Or you could read the docs https://github.com/terraform-aws-modules/terraform-aws-ecs/blob/master/docs/README.md

I think the confusion stems from the sentence: "desired_count is always ignored by the service module" in the docs. Not always, the module's desired_count input is still needed at the start.

To be specific, it is always ignored after creation to avoid conflicts with autoscaling, but it is not ignored on creation. The desired_count value is still needed at the start, e.g. if you set the autoscaling minimum to 2, you should set the desired_count to 2 (since the default is 1).

The docs do mention this part:

In addition, users have the ability to disable auto scaling if it does not suit their workload. In this case, the desired_count would be initially set by Terraform, and any further changes would need to be managed separately (outside of the service module).

However, this is in the design docs, and it might not be immediately clear to users reading the service module README. So, I was thinking, maybe it would be a good idea to update the README instead?

Something like:

Some notable configurations to be aware of when using this module:
1. `desired_count`/`scale` is always ignored after creation, but the module still uses `desired_count` to set the initial task count; it is also designed to utilize autoscaling by default (though it can be disabled)
2. The default configuration is intended for `FARGATE` use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants