Repository navigation
feat: property-level CFN drift MODIFIED for all drift-checkable types (#290) - #302
Merged
Merged
Conversation
…#290) Extends cfnDriftComparators with comparators for DynamoDB (BillingMode, ProvisionedThroughput), Lambda (Runtime/Handler/Timeout/MemorySize), IAM Role (AssumeRolePolicyDocument via order-insensitive policyDocumentsEqual, plus Description/Path), SQS (queue attributes), and SNS (DisplayName) — completing S3 versioning shipped earlier. Comparison is template-declared-only so deploy defaults never produce false drift; S3 comparator aligned to the same rule. To make SQS/SNS comparable: deploySQSQueue/deploySNSTopic forward declared properties; SNS CreateTopic persists initial DisplayName. Fixes latent bugs found en route: - SQS/SNS/Lambda existence drift-checkers used wrong state keys (spurious region component / ARN-vs-name). - deployLambdaFunction sent Timeout/MemorySize as strings → CreateFunction rejected the body (CFN Lambda Timeout/MemorySize never worked). New: iam_policy_compare.go (policyDocumentsEqual). Tests: one MODIFIED case per type + reordered-policy IN_SYNC + declared-only IN_SYNC. make test (race)+lint clean. Closes #290
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Completes #290 — faithful property-level
MODIFIEDdrift detection across all six drift-checkable CloudFormation resource types (S3 versioning shipped earlier; this adds the rest).New comparators (
cfnDriftComparators)BillingMode,ProvisionedThroughput.{Read,Write}CapacityUnitsRuntime,Handler,Timeout,MemorySizeAssumeRolePolicyDocument(order-insensitive),Description,PathVisibilityTimeout,MessageRetentionPeriod,DelaySeconds,ReceiveMessageWaitTimeSeconds,MaximumMessageSizeDisplayNameDesign
BillingMode→PROVISIONED) never produce false drift. The existing S3 versioning comparator was aligned to this rule (it previously emitted anADDdiff when the template omitted versioning).compareS3BucketDriftpattern via a sharedcfnDriftResourcePropshelper (re-parse template → resolve intrinsics/params → read live state).policyDocumentsEqual(iam_policy_compare.go) compares trust policies independent of statement order (canonical per-statement JSON, sorted), so a reordered-but-equivalent policy does not register as drift.deploySQSQueue/deploySNSTopicnow forward declared properties, and SNSCreateTopicpersists an initialDisplayName(AWS-faithful).Latent bugs fixed en route
/region/component; SNS used the ARN where the key is name-based) — so those checkers were silently broken.deployLambdaFunctionsentTimeout/MemorySizeas strings, whichCreateFunction(int fields) rejected with "invalid request body" — CFN Lambda with these properties never deployed. Now converted to int.Tests
One
MODIFIEDcase per type (mutate live state outside CFN → assert MODIFIED + PropertyDifferences), plus a reordered-trust-policy IN_SYNC case (no false positive) and a declared-only IN_SYNC case (undeclared property diverging in state → not drift). Test harness extended to register DynamoDB/Lambda/SQS.make test(race) +make lintclean; main-pkg coverage steady at ~79.5%. AWS property names/shapes verified against the CloudFormation resource references.Closes #290