Add AutoScalingInstanceRefresh to the UpdatePolicy schema - #4656
Open
ktrysmt wants to merge 1 commit into
Open
Conversation
E3016 rejects the documented AutoScalingInstanceRefresh update policy because AutoScalingGroupUpdatePolicy sets additionalProperties to false and only enumerates the three older policies. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available: None found (searched open/closed issues and PRs for
AutoScalingInstanceRefresh— no hits)Description of changes:
E3016reports an error on templates that use the documentedAutoScalingInstanceRefreshupdate policy:The template is valid.
AutoScalingInstanceRefreshis documented as anUpdatePolicyattribute forAWS::AutoScaling::AutoScalingGroup, andaws cloudformation validate-templateaccepts the template(exit 0).
The cause is that
AutoScalingGroupUpdatePolicyinsrc/cfnlint/data/schemas/other/resources/update_policy.jsonsetsadditionalProperties: falseandenumerates only
AutoScalingReplacingUpdate,AutoScalingRollingUpdateandAutoScalingScheduledAction, so the newer policy falls through to the "unknown key" branch.UpdatePolicyis a template attribute rather than a resource property, so it is not supplied by theCloudFormation provider schemas (
AutoScalingInstanceRefreshandAutoScalingRollingUpdatebothappear 0 times under
data/schemas/providers/) — this file is hand-maintained, and the key wassimply never added.
This change adds
AutoScalingInstanceRefreshtoAutoScalingGroupUpdatePolicyplus three newdefinitions (
AutoScalingInstanceRefresh,AutoScalingInstanceRefreshPreferences,AutoScalingInstanceRefreshAlarmSpecification), transcribed from theAutoScalingInstanceRefresh policysection of theUpdatePolicyattribute reference:Strategy— required,Rolling|ReplaceRootVolumePreferences.BakeTime/CheckpointDelay— integer, 0–172800Preferences.CheckpointPercentages— array of integersPreferences.InstanceWarmup— integerPreferences.MaxHealthyPercentage— integer, 100–200Preferences.MinHealthyPercentage— integer, 0–100Preferences.ScaleInProtectedInstances/StandbyInstances—Refresh/Terminate|Ignore|WaitPreferences.SkipMatching— booleanPreferences.AlarmSpecification.Alarms— array of strings, up to 10 itemsDocs: https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-attribute-updatepolicy.html
Validation
Ran the schema through
CfnTemplateValidatorthe same wayrules/resources/updatepolicy/Configuration.pydoes (
strict_types=False,FUNCTIONSin context):Accepted — the repro above, both examples from the docs page (launch-before-terminate, and
alarm-based rollback with checkpoints and bake time), and
Strategy: ReplaceRootVolume.Still rejected — missing
Strategy;Strategy: Bogus; a misspelled preference(
MinHealtyPercentage, which usefully reportsDid you mean 'MaxHealthyPercentage'?);MinHealthyPercentage: 101;MaxHealthyPercentage: 99; andAutoScalingInstanceRefreshon anon-Auto-Scaling resource.
No regression — the existing "Valid with autoscaling group" combination still passes and
UpdatePolicy: {Foo: Bar}is still rejected.A positive case covering the full
Preferencessurface is added totest/unit/rules/resources/updatepolicy/test_configuration.py.Deliberately not included
The docs state that
AutoScalingInstanceRefreshandAutoScalingRollingUpdatecannot both bespecified on the same Auto Scaling group. That could be expressed as a
not/requiredpair, but Ileft it out to keep this change to the missing definitions. Happy to add it here or in a follow-up
if you would prefer it.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Generated with Claude Code