-
-
Notifications
You must be signed in to change notification settings - Fork 557
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
docs: Fix description of how autoscaling min and max are set in services #137
Conversation
@@ -3,7 +3,8 @@ | |||
Configuration in this directory creates an Amazon ECS Service and associated resources. | |||
|
|||
Some notable configurations to be aware of when using this module: | |||
1. `desired_count`/`scale` is always ignored; the module is designed to utilize autoscaling by default (though it can be disabled) | |||
1. `desired_count`/`scale` are not the intended way of setting the number of tasks to run. Instead, use `autoscaling_min_capacity`/`autoscaling_max_capacity` to set the number of tasks to run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct - what issue are you running into?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be that I'm doing something wrong with the way I'm configuring things, but it is unfortunately not true that desired_count
is always ignored. See here: https://github.com/terraform-aws-modules/terraform-aws-ecs/blob/master/modules/service/main.tf#L1199-L1200
The min and max autoscaling targets are set to the min and max of their respective variables vs desired_count
. If you set the autoscaling_min_capacity
variable to 2, and desired_count
remains at 1, then the value of autoscaling_min_capacity
in the aws_appautoscaling_target
resource will be set to 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe instead the autoscaling_min_capacity
attribute in aws_appautoscaling_target
should be the max
of desired_count
and var.autoscaling_min_capacity
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you set the autoscaling_min_capacity variable to 2, and desired_count remains at 1, then the value of autoscaling_min_capacity in the aws_appautoscaling_target resource will be set to 1.
Conversely, if you set this on create, it will fail. While I agree its not a perfect scenario, there are always rough edges when two points of modification are interacting - the intent is still the same. The desired value must stay within the bounds of min and mix such that min >= desired >= max
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conversely, if you set this on create, it will fail.
I am not sure I understand specifically what you mean by this. If you set what on create, what will fail?
Explaining the requirement that desired is between min and max was the objective of the documentation changes I made, though my changes could be worded better. I wasn't able to find this requirement in the existing documentation and had to go into the source code to discover this requirement. The docs currently state that the desired value is always ignored, which is misleading. Do you have ideas on how the docs should instead be modified to make this requirement more clear? Would love for others to benefit from my suffering, haha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I could update an example to include the min, max, and desired? And update the docs to say what you said about desired count being bound by min and max rather than saying desired count is ignored?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any thoughts on this? It seems like it should be a relatively easy bit of detail to add
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear what problem we are trying to solve, if there is even a problem. It seems like we're just trying to get a commit added, but I could be wrong
this confused me, changing desired_count to 2 did nothing and adding autoscaling_{min|max}_capacity it was taking a minimum of 1 anyway, had to do all 3 to get what I wanted
|
Can you elaborate a bit more - what did you initially have, what did you want to change and how did you try changing it, etc |
sounds like what @new-guy described. I set
but nothing happend Then I set
and nothing happened, only when all 3 were set did it go to 2 |
But thats the intended behavior we've described in the docs https://github.com/terraform-aws-modules/terraform-aws-ecs/tree/master/docs#service-1
So it sounds like just lack of understanding - not sure how else we can make this behavior clear in the docs but its all detailed there |
Nice that the docs also mention ignore_task_definition_changes 👍 (that's just what I am coming up to now) |
closing this out for now since I believe everything is covered in the current documentation |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Description
This PR updates the docs to accurately reflect how the
desired_count
variable affects the autoscaling definition in the services module. I am not sure of the ramifications of changing the functionality to reflect the docs, so I instead changed the docs to reflect the functionality.Motivation and Context
I was trying to get the task count configured in some stuff I'm working on, and I found that the docs state that
desired_count
is ignored, however that variable is used when setting themin_capacity
andmax_capacity
values in theaws_appautoscaling_target
resource. I spent a good chunk of time trying to figure out what I was doing wrong before I dug through the source code and found the issue.Breaking Changes
None
How Has This Been Tested?
No functional changes - just documentation