aws / aws/aws-cdk

(iam): provide constants for actions and conditions

Open
#22,714 4 comments 9 reactions 0 assignees View on GitHub
@aws-cdk/aws-iam effort/medium feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

Include constants for AWS actions (e.g. `sqs:SendMessage`), used when defining policy documents for IAM. [This 3rd-party library provides them](https://github.com/Spacerat/cdk-iam-actions), but it'd make sense to have them included in the `aws-cdk-lib` package.

### Use Case

```js
new IAM.Role(this, 'MyRole', {
roleName: 'my-role',
inlinePolicies: {
'queue_send-message': new IAM.PolicyDocument({
statements: [new IAM.PolicyStatement({
effect:IAM.Effect.ALLOW,
actions:['sqs:SendMessage'], // <---- hard-coded action here
resources:['some-resource-arn'],
})],
})
},
});
```

### Proposed Solution

It'd be great to not have to hard-code `sqs.SendMessage` and instead have a constant to reference, something like `IAM.Actions.SQS.SendMessage`, or perahaps IAM actions within each sub-library, like `SQS.Actions.SendMessage` -- or similar.

### Other Information

_No response_

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

2.49.0 (build 793dd76)

### Environment details (OS name and version, etc.)

Manjaro Linux 22

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the IAM.PolicyDocument and IAM.PolicyStatement usage shown in the issue, then compare the proposed constants with the linked cdk-iam-actions library. The scope of supported AWS actions and conditions still needs definition; done would mean a decided, usable constants API for policy documents.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
authorization, cloud
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.