-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Open
Labels
enhancementRequests to existing resources that expand the functionality or scope.Requests to existing resources that expand the functionality or scope.service/appautoscalingIssues and PRs that pertain to the appautoscaling service.Issues and PRs that pertain to the appautoscaling service.
Description
Description
aws_appautoscaling_policy
has required parameters resource_id
, scalable_dimension
, and service_namespace
. When using an aws_appautoscaling_target
, all of those parameters will be copied from the target, e.g.
resource_id = aws_appautoscaling_target.test.resource_id
scalable_dimension = aws_appautoscaling_target.test.scalable_dimension
service_namespace = aws_appautoscaling_target.test.service_namespace
CFN simplifies this by providing a ScalingTargetId
property for the auto scaling policy, which replaces all three of the other parameters. I think this shorthand would improve the readability of equivalent HCL.
Affected Resource(s) and/or Data Source(s)
aws_appautoscaling_policy
aws_appautoscaling_target
Potential Terraform Configuration
resource "aws_appautoscaling_policy" "test" {
name = "foo"
policy_type = "TargetTrackingScaling"
# # old
# resource_id = aws_appautoscaling_target.test.resource_id
# scalable_dimension = aws_appautoscaling_target.test.scalable_dimension
# service_namespace = aws_appautoscaling_target.test.service_namespace
# new
scaling_target_id = aws_appautoscaling_target.test.id
target_tracking_scaling_policy_configuration {
predefined_metric_specification {
predefined_metric_type = "ECSServiceAverageCPUUtilitzation"
}
target_value = 50 #% cpu utilization
scale_in_cooldown = 10
scale_out_cooldown = 10
}
}
References
Would you like to implement a fix?
Yes
Metadata
Metadata
Assignees
Labels
enhancementRequests to existing resources that expand the functionality or scope.Requests to existing resources that expand the functionality or scope.service/appautoscalingIssues and PRs that pertain to the appautoscaling service.Issues and PRs that pertain to the appautoscaling service.