通过terraform逐步扩展ASG策略

通过terraform逐步扩展ASG策略,terraform,terraform-provider-aws,aws-auto-scaling,Terraform,Terraform Provider Aws,Aws Auto Scaling,下面是TF文档中目标跟踪ASG策略的示例: resource "aws_autoscaling_policy" "example" { # ... other configuration ... target_tracking_configuration { predefined_metric_specification { predefined_metric_type = "ASGAverageCPUUtiliza

下面是TF文档中目标跟踪ASG策略的示例:

resource "aws_autoscaling_policy" "example" {
  # ... other configuration ...

  target_tracking_configuration {
    predefined_metric_specification {
      predefined_metric_type = "ASGAverageCPUUtilization"
    }

    target_value = 40.0
  }

  target_tracking_configuration {
    customized_metric_specification {
      metric_dimension {
        name  = "fuga"
        value = "fuga"
      }

      metric_name = "hoge"
      namespace   = "hoge"
      statistic   = "Average"
    }

    target_value = 40.0
  }
}
我想创建一个步骤缩放策略,它也有自定义度量的定义,就像在这个块中一样,我正在使用下面的代码,但是错误地说这个块不存在


resource "aws_autoscaling_policy" "contentworker_inbound_step_scaling_policy" {
  name                      = "${var.host_group}-${var.stack}-step-scaling-policy"
  policy_type               = "StepScaling"
  autoscaling_group_name    = aws_autoscaling_group.contentworker_inbound_asg.name
  estimated_instance_warmup = 300

  step_configuration {
    customized_metric_specification  {
      metric_dimension {
        name  = "test"
        value = “Size”
      }
      metric_name = "anything"
      namespace   = "test"
      statistic   = "Average"
      unit        = "None"
    }
    step_adjustment {
    adjustment_type              = "PercentChangeInCapacity"
    scaling_adjustment           = 10
    metric_interval_lower_bound = 10
    metric_interval_upper_bound = 25
    }

  }
}
我的自定义度量与目标跟踪策略配合得很好,但与步长缩放无关

有什么建议如何为我的自定义指标设置步长缩放策略

您阅读了吗?步骤缩放策略的结构非常不同,相反,您需要使用
步骤调整
块,它们链接到Cloudwatch metrics警报,该警报在调整ASG大小而不是直接在配置中指定度量时触发。中有关于非目标跟踪策略的更多详细信息