aws-amplify / aws-amplify/amplify-cli

(gen2-migration) `generate` command should handle function custom policies

Open
#14,565 1 comment 0 reactions 1 assignee Claimed by @svidgen View on GitHub
gen2-migration p2
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### Is this feature request related to a new or existing Amplify category?

_No response_

### Is this related to another service?

_No response_

### Describe the feature you'd like to request

We need to support the `custom-policies.json` file that allows functions to access existing AWS resources that are managed outside of the amplify environment.

> See https://docs.amplify.aws/gen1/javascript/build-a-backend/functions/set-up-function/#access-existing-aws-resource-from-lambda-function

For multi environment support, we also need to convert `${env}` to `${branchName}`

> See https://docs.amplify.aws/gen1/javascript/build-a-backend/functions/set-up-function/#multi-environment-workflow

### Describe the solution you'd like

The solution should use CDK code to explicitly add the policies to the appropriate functions.

```ts
backend.myfunction.resources.lambda.addToPrincipalPolicy(...)`
```

### Describe alternatives you've considered

None. I'm not sure if there is a native way to support this in Gen2, if there is we should use that one.

### Additional context

_No response_

### Is this something that you'd be interested in working on?

- [ ] 👋 I may be able to implement this feature request

### Would this feature include a breaking change?

- [ ] ⚠️ This feature might incur a breaking change

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.