Skip to content

Commit

Permalink
resource cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
revmischa committed Jul 2, 2024
1 parent 6e3b0ce commit a3171c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions stacks/auth.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Cognito, StackContext, use } from 'sst/constructs'
import { Duration } from 'aws-cdk-lib'
import { Duration, RemovalPolicy } from 'aws-cdk-lib'
import { StringAttribute, UserPoolClientIdentityProvider } from 'aws-cdk-lib/aws-cognito'
import { AaaaRecord, ARecord, RecordTarget } from 'aws-cdk-lib/aws-route53'
import { UserPoolDomainTarget } from 'aws-cdk-lib/aws-route53-targets'
import { Dns } from './dns'
import { WEB_DOMAIN } from './config'
import { IS_PRODUCTION, WEB_DOMAIN } from './config'
import { HttpUserPoolAuthorizer } from 'aws-cdk-lib/aws-apigatewayv2-authorizers'

const ALLOWED_HOSTS = [
Expand All @@ -30,6 +30,7 @@ export function Auth({ stack, app }: StackContext) {
cdk: {
userPoolClient: {},
userPool: {
removalPolicy: IS_PRODUCTION ? RemovalPolicy.RETAIN : RemovalPolicy.DESTROY,
// what users can sign in with
// ⚠️ The Cognito service prevents changing the signInAlias property for an existing user pool.
signInAliases: { email: true, phone: false },
Expand Down
2 changes: 2 additions & 0 deletions stacks/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ export function Database({ stack, app }: StackContext) {
credentials: Credentials.fromSecret(dbSecret),
writer: ClusterInstance.serverlessV2('writer'),
securityGroups: [dbAccessSecurityGroup],
removalPolicy: IS_PRODUCTION ? RemovalPolicy.RETAIN : RemovalPolicy.SNAPSHOT,
deletionProtection: IS_PRODUCTION,
})
}

Expand Down

0 comments on commit a3171c4

Please sign in to comment.