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
288 stars 552 forks source link

scaling_policies doesn't allow for multiple step_adjustments #236

Closed emoshaya closed 10 months ago

emoshaya commented 1 year ago

I'm trying to import the follow resource into this module but it seems I'm unable to pass in multiple step_adjustment blocks as in the example below:

`resource "aws_autoscaling_policy" "this" {
  name = "scale-out"

  adjustment_type           = "ExactCapacity"
  policy_type               = "StepScaling"
  estimated_instance_warmup = 60

  step_adjustment {
    scaling_adjustment          = 1
    metric_interval_lower_bound = 1.0
    metric_interval_upper_bound = 10.0
  }
  step_adjustment {
    scaling_adjustment          = 2
    metric_interval_lower_bound = 10.0
    metric_interval_upper_bound = 20.0
  }
  step_adjustment {
    scaling_adjustment          = 3
    metric_interval_lower_bound = 20.0
    metric_interval_upper_bound = 30.0
  }
  step_adjustment {
    scaling_adjustment          = 4
    metric_interval_lower_bound = 30.0
    metric_interval_upper_bound = 50.0
  }
  step_adjustment {
    scaling_adjustment          = 5
    metric_interval_lower_bound = 50.0
    metric_interval_upper_bound = 75.0
  }
  step_adjustment {
    scaling_adjustment          = 6
    metric_interval_lower_bound = 75.0
    metric_interval_upper_bound = 100.0
  }
  step_adjustment {
    scaling_adjustment          = 7
    metric_interval_lower_bound = 100.0
    metric_interval_upper_bound = 150.0
  }
  step_adjustment {
    scaling_adjustment          = 8
    metric_interval_lower_bound = 150.0
    metric_interval_upper_bound = 200.0
  }
  step_adjustment {
    scaling_adjustment          = 9
    metric_interval_lower_bound = 200.0
    metric_interval_upper_bound = 300.0
  }
  step_adjustment {
    scaling_adjustment          = 10
    metric_interval_lower_bound = 300.0
  }

  autoscaling_group_name = aws_autoscaling_group.this.name
}`

When I try the following config:

scaling_policies = {
  scale_up = {
    name             = "scale-up"
    adjustment_type         = "ExactCapacity"
    policy_type                  = "StepScaling"
    estimated_instance_warmup = 60
    step_adjustment = [
      {
          scaling_adjustment          = 1
          metric_interval_lower_bound = 1.0
          metric_interval_upper_bound = 10.0
      },
      {
          scaling_adjustment          = 2
          metric_interval_lower_bound = 10.0
          metric_interval_upper_bound = 20.0
      }
    ]
  }
}

I get the following error:

β”‚ Error: Unsupported attribute β”‚ β”‚ on .terraform/modules/aws.autoscaling/main.tf line 915, in resource "aws_autoscaling_policy" "this": β”‚ 915: scaling_adjustment = step_adjustment.value.scaling_adjustment β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β”‚ step_adjustment.value is tuple with 2 elements β”‚ β”‚ This value does not have any attributes.

github-actions[bot] commented 11 months ago

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

github-actions[bot] commented 10 months ago

This issue was automatically closed because of stale in 10 days

github-actions[bot] commented 9 months 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.

antonbabenko commented 9 months ago

This issue has been resolved in version 7.0.0 :tada: