terraform-aws-ecs
terraform-aws-ecs copied to clipboard
customized_metric_specification metrics is missing
Description
While trying to add a custom metric for one of my project, I was not able to find how to specify... well the metrics.
It looks like this field is not handle. Here the definition of customized_metric_specification, and here where this module build it. If Iβm not wrong the metrics attribute is missing.
- [x] β I have searched the open/closed issues and my issue is not listed.
Versions
-
Module version [Required]:
-
Terraform version: 1.5
-
Provider version(s): v5.63.1
Reproduction Code [Required]
module "web_service" {
source = "terraform-aws-modules/ecs/aws//modules/service"
version = "5.11.4"
name = "api"
...
autoscaling_min_capacity = var.autoscaling_min_capacity
autoscaling_max_capacity = var.autoscaling_max_capacity
autoscaling_policies = {
cpu = {
policy_type = "TargetTrackingScaling"
target_tracking_scaling_policy_configuration = {
target_value = 60
customized_metric_specification = {
metric_name = "AdjustedCpuUtilization"
namespace = "ECS/Custom"
statistic = "Average"
unit = "Percent"
dimensions = [
{
name = "ClusterName"
value = local.cluster_name
},
{
name = "ServiceName"
value = local.service_name
}
]
metrics = [
{
id = "m1"
label = "CpuUtilized"
metric_name = "CpuUtilized"
namespace = "ECS/ContainerInsights"
stat = "Average"
dimensions = [
{
name = "ClusterName"
value = local.cluster_name
},
{
name = "ServiceName"
value = local.service_name
}
]
return_data = false
},
{
id = "m2"
label = "CpuReserved"
metric_name = "CpuReserved"
namespace = "ECS/ContainerInsights"
stat = "Average"
dimensions = [
{
name = "ClusterName"
value = local.cluster_name
},
{
name = "ServiceName"
value = local.service_name
}
]
return_data = false
},
{
id = "m3"
label = "Running Task Count"
metric_name = "RunningTaskCount"
namespace = "ECS/ContainerInsights"
stat = "Average"
dimensions = [
{
name = "ClusterName"
value = local.cluster_name
},
{
name = "ServiceName"
value = local.service_name
}
]
return_data = false
},
{
id = "m4"
label = "Mitigated Host Count"
metric_name = "MitigatedHostCount"
namespace = "AWS/ApplicationELB"
stat = "Average"
dimensions = [
{
name = "LoadBalancer"
value = data.aws_alb.external[0].arn_suffix
},
{
name = "TargetGroup"
value = aws_lb_target_group.web[0].arn_suffix
}
]
return_data = false
},
# Expression 1: CpuUtilization = (100 * CpuUtilized) / CpuReserved
{
id = "e1"
expression = "(100 * m1) / m2"
label = "CpuUtilization"
return_data = false
},
# Expression 2: AdjustedCpuUtilization = (CpuUtilization * NumberOfTasks) / (NumberOfTasks - MitigatedHostCount)
{
id = "e2"
expression = "(e1 * m3) / (m3 - m4)"
label = "AdjustedCpuUtilization"
return_data = true
}
]
}
scale_in_cooldown = 300
scale_out_cooldown = 60
}
}
}
Expected behavior
Be able to create an autoscalling policy based on a custom metrics.
Actual behavior
metrics is not handle.
This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days
Still relevant
This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days
This issue was automatically closed because of stale in 10 days
I'm going to lock this issue 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 similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
This issue has been resolved in version 6.0.0 :tada: