fix(cloudformation): apply in-place UpdateStack changes for common resource types (bug-hunt)#2313
Merged
Merged
Conversation
…source types (bug-hunt)
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.
Summary
CloudFormation
UpdateStacksilently discarded property changes for any resource type that had no arm inResourceProvisioner::update_resource. The_ => Nonefallback madeapply_resource_updateskeep the oldStackResourceand still reportUPDATE_COMPLETE, but the change never reached the owning service — soaws cloudformation update-stack/cdk deploy/sam deployreported success while the resource silently retained its pre-update config (template-vs-live drift).This adds in-place UPDATE arms for the common, freely-mutable types that were stuck in the silent bucket. Each arm applies the changed properties to the owning service's live state through the same persistence path the create arm / direct API handler uses, so the update actually persists and is reflected by the service's Get/Describe.
Update arms added (moved out of
_ => None):AWS::SSM::Parameter— Value/Type/Description; rotates the old value into history + bumps version likePutParameteroverwrite (GetParameter now returns the new value).AWS::Logs::LogGroup— RetentionInDays (+ KmsKeyId, LogGroupClass); omitting retention clears it, matchingDeleteRetentionPolicy.AWS::Kinesis::Stream— RetentionPeriodHours, StreamMode, ShardCount (reshapes to the target uniform partition).AWS::Events::Rule— ScheduleExpression/State/Targets/EventPattern/Description/RoleArn.AWS::DynamoDB::Table— BillingMode/ProvisionedThroughput/GSI/OnDemandThroughput/DeletionProtection/TableClass/SSE.AWS::SNS::Subscription— FilterPolicy/FilterPolicyScope/RawMessageDelivery/RedrivePolicy/DeliveryPolicy/SubscriptionRoleArn.AWS::SecretsManager::Secret— Description/KmsKeyId; a changed SecretString stages a new AWSCURRENT version (demoting the old to AWSPREVIOUS) likePutSecretValue.AWS::Cognito::UserPool/AWS::Cognito::UserPoolClient— the update-without-replacement config subset.AWS::RDS::DBInstance— theModifyDBInstance-mutable subset (class, storage, engine version, master password, backup retention, multi-AZ, deletion protection, IOPS, storage type, etc.).Scope notes (no stubs — every arm really applies + persists):
_ => Nonefallback is preserved for types not yet handled.ShardCountreproduces the resulting open-shard partition, not the fine-grained closed-shard lineage the nativeUpdateShardCountcommon-refinement produces (noted in-code).Docs:
website/content/docs/services/cloudformation.mdhad no per-type update-support list (only a create-time backing list), so a paragraph documenting in-placeUpdateStackfidelity was added next to the provisioner description. A one-line export (SsmParameterVersion) was added tofakecloud-ssm's public API so the CFN crate can construct a history entry.Test plan
cargo test -p fakecloud-cloudformation— 280 passed (10 newupdate_stack_applies_*tests, one per newly-handled type: create resource -> update-stack changing a supported property -> assert the owning service's live state reflects the new value).cargo build -p fakecloud --tests— clean.cargo clippy -p fakecloud-cloudformation -p fakecloud-ssm --all-targets -- -D warnings— clean.cargo fmt— applied./code-review(medium) — no correctness bugs; only documented-intent fidelity trade-offs (desired-state handling of omitted Cognito props, SSM history growth, Kinesis reshard data redistribution).Summary by cubic
Fixes UpdateStack silently ignoring property changes by applying in-place updates for common CFN resource types. Updates now persist to each service so their Get/Describe APIs reflect the new config.
AWS::SSM::Parameter,AWS::Logs::LogGroup,AWS::Kinesis::Stream,AWS::Events::Rule,AWS::DynamoDB::Table,AWS::SNS::Subscription,AWS::SecretsManager::Secret,AWS::Cognito::UserPool,AWS::Cognito::UserPoolClient,AWS::RDS::DBInstance(KinesisShardCountreshapes to target open shards).SsmParameterVersionfromfakecloud-ssm; added focused UpdateStack tests per type.Written for commit 1c73a95. Summary will update on new commits.