aws-stepfunctions-tasks: SNSPublish KMS permissions #32303
Labels
@aws-cdk/aws-stepfunctions-tasks
effort/medium
Medium work item – several days of effort
feature-request
A feature should be added or improved.
p2
Describe the feature
When using SnsPublish, it would be good if the task included granting the permissions needed for publishing to topics using a CMK.
Use Case
Convenience, furthermore this can sometimes get in the way of creating abstractions, for example needing to create and pass in the StateMachine role where tasks are created, or surface the SNS topic until the role is created.
Proposed Solution
I see there is a place where permissions (in policies) are determined:
aws-cdk/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sns/publish.ts
Lines 186 to 192 in 6877c6a
I understand the complication would be that the topic does not have its masterKey exposed.
This doesn't seem to be unusual, for example the SQS queue exposes the key used for encryption:
aws-cdk/packages/aws-cdk-lib/aws-sqs/lib/queue.ts
Lines 362 to 363 in 6877c6a
So my proposal would be to expose the key in the Topic, and use it to define the
taskPolicies
.Having said that, maybe other Tasks such as SendToQueue should also include the relevant EncryptDecrypt permissions.
aws-cdk/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sqs/send-to-queue.ts
Lines 88 to 91 in 6877c6a
Other Information
No response
Acknowledgements
CDK version used
2.167.1
Environment details (OS name and version, etc.)
macOS Sonoma 14.7.1
The text was updated successfully, but these errors were encountered: