Skip to content

fix(secretsmanager): update the resource policy document atomically - #168

Merged
JeroenSoeters merged 1 commit into
mainfrom
jeroensoeters/secretsmanager-atomic-resourcepolicy
Aug 10, 2026
Merged

fix(secretsmanager): update the resource policy document atomically#168
JeroenSoeters merged 1 commit into
mainfrom
jeroensoeters/secretsmanager-atomic-resourcepolicy

Conversation

@JeroenSoeters

Copy link
Copy Markdown
Contributor

Summary

A resource policy is one document applied wholesale (PutResourcePolicy), but resourcePolicy carried no updateMethod hint, so its Statement array diffed with default set semantics. A patch-mode update that modifies a statement then ensures the new statement exists without removing the old one: the live policy ends up with both. Marking the field Atomic (same as iam/managedpolicy.policyDocument and the CloudTrail event-selector fields) makes any change replace the whole document.

This was previously masked: the conformance update phase for this fixture used to execute a hidden delete+create (the createOnly secretId reference diffed against the provider echo, planning a replacement on every update), which rebuilt the policy exactly. With the reference-vs-echo diff fixed in formae core (platform-engineering-labs/formae#617), the update runs in place for the first time and exposed the missing hint. Verified with a debug-conformance run against that formae branch.

A resource policy is a single document applied wholesale; diffing its
Statement array with set semantics lets a patch-mode update add a changed
statement alongside the old one instead of replacing the document.
@JeroenSoeters
JeroenSoeters merged commit 747b294 into main Aug 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant