[v15] use Update rather than ConditionCheck in dynamodbbk AtomicWrite #41133
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.
The
AtomicWrite
operation in dynamodbbk requiresdynamodb:ConditionCheckItem
IAM permissions on the table, which wasn't documented but hasn't been noticed until #40851, which actually used abackend.KindNop
conditional action. We're going to update the documentation for v16 and note the required changes in the release notes for v16, but we can use a workaround for v15 that doesn't require permission changes, which this PR implements.This PR makes it so that any
KindNop
atomic write in dynamodbbk uses anUpdate
TransactWriteItem
that removes a nonexistent top-level field, which makes it so that the operation requiresdynamodb:UpdateItem
permissions even though the result is the same.The
lib/backend/dynamo
tests fail inmaster
andbranch/v15
with a role that only has the documented permissions, with an error likeunexpected error during atomic write: AccessDeniedException: User: <user arn> is not authorized to perform: dynamodb:ConditionCheckItem on resource: arn:aws:dynamodb:<region>:<account id>:table/<table name> because no identity-based policy allows the dynamodb:ConditionCheckItem action
and succeed after this change.As a workaround for errors like that, adding
dynamodb:ConditionCheckItem
to the IAM permissions used by the Teleport auth server should solve the errors.changelog: fix
AccessDeniedException
fordynamodb:ConditionCheckItem
operations when using AWS DynamoDB for cluster state storage