aws-amplify / aws-amplify/amplify-cli
(gen2-migration) `generate` command should handle auth overrides
- 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
In Gen1, customers can override the built-in auth resources by running `amplify override auth`. This creates an `overrides.ts` file where customers can override resource properties using the CDK. For example
```ts
import { AmplifyProjectInfo, AmplifyAuthCognitoStackTemplate } from '@aws-amplify/cli-extensibility-helper';
export function override(resources: AmplifyAuthCognitoStackTemplate, amplifyProjectInfo: AmplifyProjectInfo) {
resources.userPool!.deletionProtection = 'ACTIVE';
}
```
Our code-generation should take this `override.ts` file into account and produce the equivalent Gen2 code.
### Describe the solution you'd like
Ideally, we would transform the `override.ts` to look like this:
```ts
export function override(backend: Backend, amplifyProjectInfo: { envName: string, projectName: string }) {
(backend.auth.resources.userPool.node.defaultChild as CfnUserPool).deletionProtection = 'ACTIVE';
}
```
And then invoke this function from `backend.ts`:
```ts
import { override as overrideAuth } from './auth/override.ts`
const branchName = process.env.AWS_BRANCH ?? 'sandbox';
const backend = defineBackend({
...,
auth,
});
overrideAuth(backend, { envName: branchName, projectName: '' });
```
### Describe alternatives you've considered
None
### Additional context
https://github.com/aws-amplify/amplify-cli/blob/664dabc422d81153a3193996a7324d27829ef3b9/packages/amplify-cli-extensibility-helper/src/types/auth/types.ts#L21-L65
https://github.com/aws-amplify/amplify-cli/blob/664dabc422d81153a3193996a7324d27829ef3b9/packages/amplify-cli-extensibility-helper/src/types/auth/types.ts#L70-L76
Each one of them would likely require its own special transformation.
### 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.