Skip to content

Commit

Permalink
CMDCT-4184 - gets all conditional retention straightened out for impo…
Browse files Browse the repository at this point in the history
…rting
  • Loading branch information
peoplespete committed Jan 16, 2025
1 parent f21390c commit 098fdfa
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions deployment/stacks/ui-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import {
Aws,
Duration,
custom_resources as cr,
RemovalPolicy,
} from "aws-cdk-lib";
import { WafConstruct } from "../constructs/waf";
import { IManagedPolicy } from "aws-cdk-lib/aws-iam";

interface CreateUiAuthComponentsProps {
scope: Construct;
stage: string;
isDev: boolean;
oktaMetadataUrl: string;
applicationEndpointUrl: string;
restApiId: string;
Expand All @@ -29,6 +31,7 @@ export function createUiAuthComponents(props: CreateUiAuthComponentsProps) {
const {
scope,
stage,
isDev,
oktaMetadataUrl,
applicationEndpointUrl,
restApiId,
Expand Down Expand Up @@ -64,6 +67,7 @@ export function createUiAuthComponents(props: CreateUiAuthComponentsProps) {
ismemberof: new cognito.StringAttribute({ mutable: true }),
},
advancedSecurityMode: cognito.AdvancedSecurityMode.ENFORCED,
removalPolicy: isDev ? RemovalPolicy.DESTROY : RemovalPolicy.RETAIN
});

let supportedIdentityProviders:
Expand Down
10 changes: 9 additions & 1 deletion deployment/stacks/with_imports/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import { DynamoDBTable } from "../../constructs/dynamodb-table";
interface CreateDataComponentsProps {
scope: Construct;
stage: string;
isDev: boolean;
}

export function createDataComponents(props: CreateDataComponentsProps) {
const { scope, stage } = props;
const { scope, stage, isDev } = props;

new DynamoDBTable(scope, "FormAnswers", {
stage,
isDev,
name: "form-answers",
partitionKey: {
name: "answer_entry",
Expand All @@ -27,21 +29,25 @@ export function createDataComponents(props: CreateDataComponentsProps) {
})
new DynamoDBTable(scope, "FormQuestions", {
stage,
isDev,
name: "form-questions",
partitionKey: { name: "question", type: dynamodb.AttributeType.STRING },
})
new DynamoDBTable(scope, "FormTemplates", {
stage,
isDev,
name: "form-templates",
partitionKey: { name: "year", type: dynamodb.AttributeType.NUMBER },
})
new DynamoDBTable(scope, "Forms", {
stage,
isDev,
name: "forms",
partitionKey: { name: "form", type: dynamodb.AttributeType.STRING },
})
new DynamoDBTable(scope, "StateForms", {
stage,
isDev,
name: "state-forms",
partitionKey: {
name: "state_form",
Expand All @@ -50,11 +56,13 @@ export function createDataComponents(props: CreateDataComponentsProps) {
})
new DynamoDBTable(scope, "States", {
stage,
isDev,
name: "states",
partitionKey: { name: "state_id", type: dynamodb.AttributeType.STRING },
})
new DynamoDBTable(scope, "AuthUser", {
stage,
isDev,
name: "auth-user",
partitionKey: { name: "userId", type: dynamodb.AttributeType.STRING },
})
Expand Down
3 changes: 3 additions & 0 deletions deployment/stacks/with_imports/parent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,19 @@ export class WithImportsParentStack extends Stack {

const {
stage,
isDev,
} = props;

createDataComponents({
scope: this,
stage,
isDev,
});
createUiComponents({scope: this});
createUiAuthComponents({
scope: this,
stage,
isDev,
});
}
}
4 changes: 4 additions & 0 deletions deployment/stacks/with_imports/ui-auth.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import { Construct } from "constructs";
import {
aws_cognito as cognito,
RemovalPolicy,
} from "aws-cdk-lib";

interface CreateUiAuthComponentsProps {
scope: Construct;
stage: string;
isDev: boolean;
}

export function createUiAuthComponents(props: CreateUiAuthComponentsProps) {
const {
scope,
stage,
isDev,
} = props;

new cognito.UserPool(scope, "UserPool", {
Expand Down Expand Up @@ -41,5 +44,6 @@ export function createUiAuthComponents(props: CreateUiAuthComponentsProps) {
ismemberof: new cognito.StringAttribute({ mutable: true }),
},
advancedSecurityMode: cognito.AdvancedSecurityMode.ENFORCED,
removalPolicy: isDev ? RemovalPolicy.DESTROY : RemovalPolicy.RETAIN
});
}

0 comments on commit 098fdfa

Please sign in to comment.