Terraform v0.11.2
+ provider.aws v1.7.1
+ provider.template v1.0.0
Please list the resources as a list, for example:
resource "aws_appautoscaling_target" "ecs_target" {
max_capacity = 5
min_capacity = 2
resource_id = "service/ecs-cluster/ecs-service"
scalable_dimension = "ecs:service:DesiredCount"
service_namespace = "ecs"
}
resource "aws_appautoscaling_policy" "ecs_targettracking" {
name = "ECSServiceAverageCPUUtilization:${aws_appautoscaling_target.ecs_target.resource_id}"
policy_type = "TargetTrackingScaling"
resource_id = "${aws_appautoscaling_target.ecs_target.resource_id}"
scalable_dimension = "${aws_appautoscaling_target.ecs_target.scalable_dimension}"
service_namespace = "${aws_appautoscaling_target.ecs_target.service_namespace}"
target_tracking_scaling_policy_configuration {
predefined_metric_specification {
predefined_metric_type = "ECSServiceAverageCPUUtilization"
}
target_value = 50
}
}
Create a target tracking scaling policy for the ECS service
Validation error: Error: aws_appautoscaling_policy.ecs_targettracking: "target_tracking_scaling_policy_configuration.0.predefined_metric_specification.0.predefined_metric_type" contains an invalid metric "ECSServiceAverageCPUUtilization". Valid metric are ["DynamoDBReadCapacityUtilization" "DynamoDBWriteCapacityUtilization"].
Please list the steps required to reproduce the issue, for example:
terraform applyaws application-autoscaling put-scaling-policy --cli-input-json file://scale-cli.json
{
"PolicyName": "ECSServiceAverageCPUUtilization:service/ecs-cluster/ecs-service",
"ServiceNamespace": "ecs",
"ResourceId": "service/ecs-cluster/ecs-service",
"ScalableDimension": "ecs:service:DesiredCount",
"PolicyType": "TargetTrackingScaling",
"TargetTrackingScalingPolicyConfiguration": {
"PredefinedMetricSpecification": {
"PredefinedMetricType": "ECSServiceAverageCPUUtilization"
},
"TargetValue": 50
}
}
{
"PolicyARN": "arn:aws:autoscaling:us-east-1:821452665997:scalingPolicy:a0d9cc4b-0f5e-4a4a-88bb-1b549bea1ebb:resource/ecs/service/ecs-cluster/ecs-service:policyName/ECSServiceAverageCPUUtilization:service/ecs-cluster/ecs-service",
"Alarms": [
{
"AlarmName": "TargetTracking-service/ecs-cluster/ecs-service-AlarmHigh-adaa1f5f-bb37-4da6-ae26-0b7829fdb747",
"AlarmARN": "arn:aws:cloudwatch:us-east-1:821452665997:alarm:TargetTracking-service/ecs-cluster/ecs-service-AlarmHigh-adaa1f5f-bb37-4da6-ae26-0b7829fdb747"
},
{
"AlarmName": "TargetTracking-service/ecs-cluster/ecs-service-AlarmLow-88535a41-70d2-4cf6-9a21-37aaa24ba103",
"AlarmARN": "arn:aws:cloudwatch:us-east-1:821452665997:alarm:TargetTracking-service/ecs-cluster/ecs-service-AlarmLow-88535a41-70d2-4cf6-9a21-37aaa24ba103"
}
]
}
Submitted PR #3122 to allow all the latest metrics types.
The validation has been updated to support all the latest supported metrics types in master and this will release in v1.8.0, likely today. We're discussing the possibility of removing this validation in the future to prevent the disconnect between specific Terraform versions and updates to AWS services.
This has been released in terraform-provider-aws version 1.8.0. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!
Most helpful comment
The validation has been updated to support all the latest supported metrics types in master and this will release in v1.8.0, likely today. We're discussing the possibility of removing this validation in the future to prevent the disconnect between specific Terraform versions and updates to AWS services.