Set enable_ecs_service_role to false when there is no load balancer #121
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
what
Set enable_ecs_service_role to false when there is no load balancer configured for the ECS service.
why
When there is no load balancer defined for the ECS service(length(var.ecs_load_balancers==0), its service role is not needed. The argument 'iam_role' should be set to null.
In the current logic, the local variable 'enable_ecs_service_role' will be set to true even there is no load balancer defined. Correcting this by changing the condition to
length(var.ecs_load_balancers) == 1references
With this bug, upgrading from <=0.25 from a config without load balancer will cause a replacement of resource aws_ecs_service.ignore_changes_task_definition, which will reset its 'task_definition' to the earliest version. There will be downtime.