terraform-aws-modules / terraform-aws-autoscaling

Terraform module to create AWS Auto Scaling resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/autoscaling/aws
Apache License 2.0
289 stars 553 forks source link

Creating SimpleScaling Autoscaling policy for ASG failed #181

Closed vishwa-trulioo closed 2 years ago

vishwa-trulioo commented 2 years ago

Description

I wanted to create an ASG with SimpleScaling policy. I used the example provided in module with only changing scaling polilcy to the following,

scaling_policies = {
  cpu-util-simple-up = {
    policy_type              = "SimpleScaling"
    adjustment_type          = "ChangeInCapacity"
    cooldown                 = 300
    min_adjustment_magnitude = 1
  },
}

Versions

Reproduction

Steps to reproduce the behavior:

Code Snippet to Reproduce

Expected behavior

Create an Autoscaling policy of type "Simple scaling" without failing.

Actual behavior

Terminal Output Screenshot(s)

module.asg.aws_autoscaling_policy.this["cpu-util-simple-up"]: Creating...
╷
│ Error: scaling_adjustment is required for policy type SimpleScaling
│ 
│   with module.asg.aws_autoscaling_policy.this["cpu-util-simple-up"],
│   on .terraform/modules/asg/main.tf line 537, in resource "aws_autoscaling_policy" "this":
│  537: resource "aws_autoscaling_policy" "this" {
│ 
╵
make: *** [apply] Error 1

Additional context

Terraform is looking for scaling_adjustment to be set. I can also see that it's available in the Docs autoscaling_policy. But, this module does not offer setting it. If I'm doing it wring, please tell me how to define the scaling policy variable appropriately.

bryantbiggs commented 2 years ago

https://github.com/terraform-aws-modules/terraform-aws-autoscaling/blob/eb45551be5b43fec682ea643ac1bb7bd498b4433/main.tf#L553

vishwa-trulioo commented 2 years ago

Can you provide me an example how the scaling policy variable should look like? Is it like this,

  cpu-util-simple-up = {
    policy_type             = "SimpleScaling"
    adjustment_type         = "ChangeInCapacity"
    cooldown                = 300
    metric_aggregation_type = "Average"
    step_adjustment = {
      scale-up = {
        scaling_adjustment = 1
      }
    }
ofinto commented 2 years ago

@vishwa-trulioo I think it should look like this

cpu-util-simple-up = {
  policy_type             = "SimpleScaling"
  adjustment_type         = "ChangeInCapacity"
  cooldown                = 300
  metric_aggregation_type = "Average"
  step_adjustment = {
    scaling_adjustment = 1
  }
}
bryantbiggs commented 2 years ago

thanks for the example @ofinto , closing issue for now

github-actions[bot] commented 1 year ago

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.