hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.88k stars 9.22k forks source link

[Enhancement]: aws_autoscaling_policy customized_metric_specification is missing period attribute #40391

Closed SushiFu closed 2 days ago

SushiFu commented 2 days ago

Description

On a aws_autoscaling_policy when using a target_tracking_configuration with a customized_metric_specification you cannot specified a custom Period attribute as per defined on the AWS documentation. I've tried successfully to update my policy with the UI and set a 300 seconds custom Period.

Period The period of the metric in seconds. The default value is 60. Accepted values are 10, 30, and 60. For high resolution metric, set the value to less than 60. For more information, see Create a target tracking policy using high-resolution metrics for faster response. Type: Integer Valid Range: Minimum value of 1. Required: No

Affected Resource(s) and/or Data Source(s)

Potential Terraform Configuration

resource "aws_autoscaling_policy" "tracking-policy-cpu" {
  name  = "MY_POLICY"

  autoscaling_group_name = "MY_ASG"
  policy_type            = "TargetTrackingScaling"

  target_tracking_configuration {
    target_value = 70
    customized_metric_specification {
      metrics {
        id = "m1"
        metric_stat {
          metric {
            namespace   = "AWS/EC2"
            metric_name = "CPUUtilization"
            dimensions {
              name  = "AutoScalingGroupName"
              value = "MY_ASG"
            }
          }
          period = 300
          stat   = "Average"
        }
        return_data = true
      }
    }
  }
}

References

https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_CustomizedMetricSpecification.html

Would you like to implement a fix?

None

github-actions[bot] commented 2 days ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

ewbankkit commented 2 days ago

@SushiFu Thanks for raising this issue. It has already been noticed in #40298. I'm going to close this one as a duplicate so that we can concentrate discussion in the linked issue. Please add any additional comments there.

github-actions[bot] commented 2 days ago

[!WARNING] This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.