aws-cloudformation / aws-cloudformation/cloudformation-coverage-roadmap

AWS::AutoScaling::AutoScalingGroup - False-positive drift if DefaultInstanceWarmup is set

Open
#1,466 1 comment 5 reactions 0 assignees View on GitHub
bug Platform
Dominant language
No language data
Stars
1.1k
Forks
62
PR merge metrics
No merged PRs in 30d

Description

### Name of the resource

AWS::AutoScaling::AutoScalingGroup

### Resource Name

_No response_

### Issue Description

Once you create a stack containing a `AWS::AutoScaling::AutoScalingGroup` and the property `DefaultInstanceWarmup` is set in CloudFormation template, the CloudFormation drift detection reporting such stack as drifted - Even the DefaultInstanceWarmup is set correctly on the created ASG (details see "Observed Behavior").

### Expected Behavior

Stack is in state IN_SYNC, since template and resource have the same, correct setting.

### Observed Behavior

Following [CloudFormation documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-defaultinstancewarmup) the setting `DefaultInstanceWarmup` is supported. Furthermore CDK also added support for this property recently https://github.com/aws/aws-cdk/pull/23285 + https://github.com/aws/aws-cdk/issues/23180.

If you set `DefaultInstanceWarmup` in your CFN template (e.g. to `500`), your stack / this resource is in state DRIFTED after running CFN Drift detection - Details see: "Test Case".

### Test Cases

** Create new Stack using following example (please mind to adjust LaunchTemplateId + VPCZoneIdentifier fitting your account) in eu-central-1

```yaml
---
AWSTemplateFormatVersion: '2010-09-09'
Description: CFN Drift detection - ASG - DefaultInstanceWarmup issue - case 11177102011

Resources:
AsgWithDefaultInstanceWarmupSet:
Type: AWS::AutoScaling::AutoScalingGroup
Properties:
AutoScalingGroupName: test-asg-rogo-1
MinSize: 0
MaxSize: 0
LaunchTemplate:
LaunchTemplateId: lt-IdAddedHere
Version: 20
VPCZoneIdentifier:
- subnet-111IdAddedHere
- subnet-222IdAddedHere
- subnet-333IdAddedHere
Tags:
- Key: ReferenceID
Value: 11177102011
PropagateAtLaunch: false
DefaultInstanceWarmup: 500
```

** After stack is created, please check your ASG resource in Console for DefaultInstanceWarmup (EC2 -> Auto Scaling Groups -> Click on your ASG -> Go down to "Advanced configurations" -> "Default instance warmup") - Here in the example it's set to 500 Sec correctly.
![SettingASG](https://user-images.githubusercontent.com/16392819/210129885-39d76a27-4482-49f9-8420-3aa554970f93.PNG)

** Go to CFN Console and run CFN Drift detection via: (in Console using "Stack actions" => "Detect drift". After you triggered this process, please wait for ca. 1 min and check again the Drift status: Stack went in state DRIFTED. Check the Drift-Details - You will the Drift for DefaultInstanceWarmup property.
![DriftOverview](https://user-images.githubusercontent.com/16392819/210129917-ccf16884-bf36-4967-a05b-b0b1e729fc28.PNG)

### Other Details

* It's also an follow-up of #1216
* AWS-News regarding this Property https://aws.amazon.com/about-aws/whats-new/2022/04/ec2-auto-scaling-default-instance-warm-up-replacement-actions/?nc1=h_ls

Contributor guide

Open the contributing guide

Research direction

Start with the YAML test case in the issue and reproduce it in eu-central-1 using an appropriate LaunchTemplateId and VPCZoneIdentifier. Run CloudFormation drift detection and compare the reported DefaultInstanceWarmup value with the Auto Scaling console; done means the stack remains IN_SYNC when the value is set to 500.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.