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

Drift detection false positive on MixedInstancesPolicy.LaunchTemplate.Overrides.LaunchTemplateSpecification

Open
#1,785 1 comment 0 reactions 0 assignees View on GitHub
bug
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

Mixed instance policies that use launch template specifications in overrides, such as to use a different AMI in the override, trigger false drifts.

The `LaunchTemplateSpecification` in the override is absent from the drift's detected "Actual".

Consider this gently abridged example:

```
{
"Type": "AWS::AutoScaling::AutoScalingGroup",
"Properties": {
"AutoScalingGroupName": "name",
"MaxSize": "0",
"MinSize": "0",
"MixedInstancesPolicy": {
"InstancesDistribution": {
"OnDemandPercentageAboveBaseCapacity": "0",
"SpotAllocationStrategy": "price-capacity-optimized"
},
"LaunchTemplate": {
"LaunchTemplateSpecification": {
"LaunchTemplateId": {
"Ref": "NodeLaunchTemplateX8664"
},
"Version": {
"Fn::GetAtt": [
"NodeLaunchTemplateX8664",
"LatestVersionNumber"
]
}
},
"Overrides": [
{
"InstanceType": "m6g.medium",
"LaunchTemplateSpecification": {
"LaunchTemplateId": {
"Ref": "NodeLaunchTemplateArm64"
},
"Version": {
"Fn::GetAtt": [
"NodeLaunchTemplateArm64",
"LatestVersionNumber"
]
}
},
"WeightedCapacity": "1"
}
]
}
},
"VPCZoneIdentifier": { "Fn::Split": [",", { "Fn::ImportValue": "SubnetIds" }] }
}
}
```

After applying the stack and detecting drift, the drift reports that the override launch template (here referencing `NodeLaunchTemplateArm64`) is spurious and should be removed.

### Expected Behavior

The auto scaling group, using mixed instance policy that involved overriding the launch template, should pass drift detection after being applied.

### Observed Behavior

The launch template within the overrides of the mixed instance policy are not observed by drift detection in the stack template, causing it to report drift when it sees them in the live resources.

### Test Cases

Apply a `AWS::AutoScaling::AutoScalingGroup` similar to the one above, which includes overridden launch templates (for example to change AMI and cater to different processor architectures.) Then trigger drift detection.

### Other Details

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing drift detection for the AWS::AutoScaling::AutoScalingGroup example with MixedInstancesPolicy overrides and compare the reported Actual value with the template. Done means an override LaunchTemplateSpecification is recognized as present and the applied stack reports no false drift; the payload names no repository files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.