Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r/aws_appautoscaling_policy: ValidationException when creating target_tracking_scaling_policy_configuration #3520

Closed
vladholubiev opened this issue Feb 25, 2018 · 5 comments · Fixed by #12695
Labels
documentation Introduces or discusses updates to documentation.
Milestone

Comments

@vladholubiev
Copy link
Contributor

Terraform Version

Terraform v0.11.3
+ provider.aws v1.10.0

Affected Resource(s)

  • aws_appautoscaling_target
  • aws_appautoscaling_policy

Terraform Configuration Files

resource "aws_appautoscaling_target" "main" {
  max_capacity       = 4
  min_capacity       = 1
  resource_id        = "service/${data.aws_ecs_cluster.services.cluster_name}/${aws_ecs_service.main.name}"
  role_arn           = "${data.aws_iam_role.ecs_autoscale.arn}"
  scalable_dimension = "ecs:service:DesiredCount"
  service_namespace  = "ecs"
}

resource "aws_appautoscaling_policy" "scale_up_cpu" {
  name               = "scale-up-cpu"
  resource_id        = "service/${data.aws_ecs_cluster.services.cluster_name}/${aws_ecs_service.main.name}"
  scalable_dimension = "${aws_appautoscaling_target.main.scalable_dimension}"
  service_namespace  = "${aws_appautoscaling_target.main.service_namespace}"

  target_tracking_scaling_policy_configuration {
    target_value       = 75
    scale_in_cooldown  = 30
    scale_out_cooldown = 30

    predefined_metric_specification {
      predefined_metric_type = "ECSServiceAverageCPUUtilization"
    }
  }

  depends_on = ["aws_appautoscaling_target.main"]
}

Debug Output

It contains sensitive information, hoping this issue is simple enough so it doesn't need a debug output

Expected Behavior

I should be able to create a target tracking scaling policy which was released in 1.10.0 yesterday.

Actual Behavior

It says ValidationException: StepScaling policy configuration must be specified, but it should not be needed if I have a target tracking scaling.

Error: Error applying plan:

1 error(s) occurred:

* aws_appautoscaling_policy.scale_up_cpu: 1 error(s) occurred:

* aws_appautoscaling_policy.scale_up_cpu: Failed to create scaling policy: Error putting scaling policy: ValidationException: StepScaling policy configuration must be specified
	status code: 400, request id: c6845418-1a10-11e8-8225-e3c23222d845

Steps to Reproduce

  1. terraform apply

Important Factoids

References

@tomelliff
Copy link
Contributor

Just ran into this myself and not entirely sure why. Debug output from trying to apply it looks fine and the ECS step scaling test and the DDB target tracking acceptance tests both pass but I've managed to create a failing test for ECS target tracking scaling policies that fails with the validation exception.

I've raised an AWS support ticket in case they know what's up with that but definitely feels like something is wonky on the AWS side.

@bflad bflad added service/applicationautoscaling upstream Addresses functionality related to the cloud provider. bug Addresses a defect in current functionality. labels Feb 27, 2018
@tomelliff
Copy link
Contributor

Just seen the issue now: you need to set policy_type to TargetTrackingScaling otherwise it gets defaulted to StepScaling.

I feel like that should just be set by the type of policy configuration you set so I'm going to try to make that change now plus flesh out the acceptance test in the WIP'd PR and update the docs which are a bit contradictory.

@vladholubiev
Copy link
Contributor Author

vladholubiev commented Feb 27, 2018

@tomelliff thanks, that did help! I'd close the issue, but leaving it open as definitely something to improve in the docs, as now it says:

(Optional) For DynamoDB, only TargetTrackingScaling is supported. For any other service, only StepScaling is supported.

+ I like your suggestion to set a proper policy_type based on policy configuration 👍

@nywilken nywilken added the documentation Introduces or discusses updates to documentation. label Apr 19, 2019
@bflad bflad removed bug Addresses a defect in current functionality. upstream Addresses functionality related to the cloud provider. labels Apr 6, 2020
@bflad bflad added this to the v2.60.0 milestone Apr 28, 2020
@ghost
Copy link

ghost commented May 1, 2020

This has been released in version 2.60.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

adamdecaf pushed a commit to adamdecaf/terraform-provider-aws that referenced this issue May 28, 2020
@ghost
Copy link

ghost commented May 29, 2020

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!

@ghost ghost locked and limited conversation to collaborators May 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation.
Projects
None yet
4 participants