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

[Bug]: unexpected update of estimatedInstanceWarmup when terraform apply #32947

Open
tonystaark opened this issue Aug 10, 2023 · 3 comments
Open
Labels
bug Addresses a defect in current functionality. service/autoscaling Issues and PRs that pertain to the autoscaling service.

Comments

@tonystaark
Copy link

tonystaark commented Aug 10, 2023

Terraform Core Version

1.3.5

AWS Provider Version

4.62.0

Affected Resource(s)

aws_autoscaling_group
aws_autoscaling_policy

Expected Behavior

After updated the preconfigured autoscaling policy target tracking value in the console (from old value to new value), another run of terraform plan should show changes to update the target tracking value back to the old value. Terraform apply should perform the intended change. Nothing else should have changed.

Actual Behavior

The new run of terraform plan/update shows changes to update the target tracking value back to the old value. However after terraform apply, the estimatedInstanceWarmup is updated to zero as well. It was confirmed both on the AWS console and from the Cloudtrail.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_autoscaling_group" "this" {
  ...
  default_instance_warmup = var.default_instance_warmup
  ...
}

resource "aws_autoscaling_policy" "target_tracking_scaling" {
  ...
  policy_type            = "TargetTrackingScaling"

  target_tracking_configuration {
    predefined_metric_specification {
      predefined_metric_type = "ASGAverageCPUUtilization"
    }

    target_value = 60
  }
}

Steps to Reproduce

  1. Provision resource "aws_autoscaling_group" with terraform (with the default_instance_warmup config as above) and its target tracking scaling policy.
  2. After provisioned, go to AWS console and update the target tracking value config at the scaling policy level.
  3. Reapply the terraform again.
  4. Observe that the plan shows only change to revert the target tracking value
  5. Go to AWS console and find out that not only the target tracking value was reverted, but the instance warm up was updated to 0.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

Screenshot 2023-08-10 at 5 40 43 PM
@tonystaark tonystaark added the bug Addresses a defect in current functionality. label Aug 10, 2023
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/autoscaling Issues and PRs that pertain to the autoscaling service. label Aug 10, 2023
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Aug 10, 2023
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Aug 10, 2023
@skyfox675
Copy link

skyfox675 commented Nov 10, 2023

Confirmed with the following updates:

Terraform Core Version

1.6.3

AWS Provider Version

5.25.0

Affected Resource(s)

aws_autoscaling_policy

Actual Behavior

If the aws_autoscaling_policy is created without the estimated_instance_warmup and the autoscaling policy still has an empty/default value in the console, The new run of Terraform plan/update shows no changes, Infrastructure up to date. However after updating via the console, Terraform does successfully determine the difference between desired and actual and suggest to update.

@madwolfa
Copy link

madwolfa commented Feb 7, 2024

I'm running into the same issue with Terraform Core Version 1.6.1 and AWS Provider Version 5.35.0. I don't even have to manually change the target value in the console first. It does this every time I'm updating the target value through Terraform vs creating a brand new policy. It has led to some nasty runaway scale-outs in our case.

New policy:

    "requestParameters": {
        "autoScalingGroupName": "atl-gen-use1-ingress-asg",
        "policyType": "TargetTrackingScaling",
        "enabled": true,
        "targetTrackingConfiguration": {
            "targetValue": 5,
            "customizedMetricSpecification": {
                "dimensions": [],
                "namespace": "VMseries-Ingress-NP",
                "metricName": "panSessionSslProxyUtilization",
                "statistic": "Average"
            },
            "disableScaleIn": false
        },
        "policyName": "atl-gen-use1-ingress-dynamic-policy"
    },

Update policy with new Target Value:

    "requestParameters": {
        "autoScalingGroupName": "atl-gen-use1-ingress-asg",
        "policyType": "TargetTrackingScaling",
        "enabled": true,
        "targetTrackingConfiguration": {
            "targetValue": 70,
            "customizedMetricSpecification": {
                "dimensions": [],
                "namespace": "VMseries-Ingress-NP",
                "metricName": "panSessionSslProxyUtilization",
                "statistic": "Average"
            },
            "disableScaleIn": false
        },
        "estimatedInstanceWarmup": 0,
        "policyName": "atl-gen-use1-ingress-dynamic-policy",
        "cooldown": 0
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/autoscaling Issues and PRs that pertain to the autoscaling service.
Projects
None yet
Development

No branches or pull requests

4 participants