aws-amplify / aws-amplify/amplify-cli
Control of Function modules
- 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?
function
### Is this related to another service?
Lambda
### Describe the feature you'd like to request
When adding a new function to your amplify stack, it would be great to be able to have the ability to add and remove modules from the function.
Currently, when a function is created, it creates the index.js which calls all of the modules off the `process.env.MODULES` environment variable, but you are not actually able to add/remove from that list without customising the parameters file manually, and this also gets removed when updating things such as auth which causes manual work every time you want to push.
### Describe the solution you'd like
Add a new CLI option when running `amplify update function` after selecting the function you want to update, called **Module configuration**
Currently the list is as follows:
1. Resource access permissions
2. Scheduled recurring invocation
3. Lambda layers configuration
4. Environment variables configuration
5. Secret values configuration
I would suggest adding
6. Module configuration
This would allow the user, in a very similar fashion to **Environment variables configuration**, to add or remove modules, which would just take a module name which maps to a function file (In the case of javascript, you would have modules `custom.js, function1.js` and that would mean you had modules `custom` and `function1` in the list)
### Describe alternatives you've considered
Currently, the CLI does not allow for overriding of the `modules` environment variable and creates an error when trying to push the resources.
An alternative would be having the Environment variable for MODULES take presidence over the list in the function parameters.json and function-patemeters.json
### 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
Assessment
This issue has not been assessed yet.