We have ECS tasks that pop messages off SQS queues, each task having its own queue. We’re managing our collection of tasks and their attributes with list type variables, like:
variable "tasks" {
type = "list"
default = [
"task1",
"task2"
...
then referencing individual items in the list like:
resource "aws_appautoscaling_policy" "scale_up" {
count = "${length(var.tasks)}"
resource_id = "service/tasks/service-${element(var.tasks, count.index)}"
...
We have lists of scheduled tasks, EC2 launch-type tasks, Fargate launch-type tasks, tasks for specific clusters, outliers that require non-default memory, scaling minima, etc.
It’s a bear to manage all those lists. I’m sure there’s a better way.
Are you managing a similar ECS/SQS setup? How are you doing it?
Thanks!