Skip to content

Commit

Permalink
fix: add import for removal policy in gen2 codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
rjabhi committed Dec 11, 2024
1 parent 9e383cd commit 300d169
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/amplify-gen2-codegen/src/backend/synthesizer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ describe('BackendRenderer', () => {
});
const output = printNodeArray(rendered);
assert(output.includes('s3Bucket.applyRemovalPolicy'));
assert(output.includes('import { RemovalPolicy } from "aws-cdk-lib";'));
});
});
describe('UserPoolClient Configuration using render()', () => {
Expand Down Expand Up @@ -471,6 +472,7 @@ describe('BackendRenderer', () => {
const output = printNodeArray(rendered);
assert(output.includes('cfnUserPool.applyRemovalPolicy'));
assert(output.includes('cfnIdentityPool.applyRemovalPolicy'));
assert(output.includes('import { RemovalPolicy } from "aws-cdk-lib";'));
});
});
});
1 change: 1 addition & 0 deletions packages/amplify-gen2-codegen/src/backend/synthesizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ export class BackendSynthesizer {

if (renderArgs.auth) {
imports.push(this.createImportStatement([authFunctionIdentifier], renderArgs.auth.importFrom));
imports.push(this.createImportStatement([factory.createIdentifier('RemovalPolicy')], 'aws-cdk-lib'));
const auth = factory.createShorthandPropertyAssignment(authFunctionIdentifier);
defineBackendProperties.push(auth);
}
Expand Down

0 comments on commit 300d169

Please sign in to comment.