Skip to content

Commit

Permalink
Add cognito user pool to cdk
Browse files Browse the repository at this point in the history
  • Loading branch information
shanejearley committed Feb 16, 2023
1 parent 7f82950 commit ec36ada
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion infrastructure/cdk/src/providers/auth.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Construct } from 'constructs'
import { Duration, Stack } from 'aws-cdk-lib'
import * as cognito from 'aws-cdk-lib/aws-cognito'
import * as ec2 from 'aws-cdk-lib/aws-ec2'
import * as ecs from 'aws-cdk-lib/aws-ecs'
import * as ecsPatterns from 'aws-cdk-lib/aws-ecs-patterns'
Expand Down Expand Up @@ -37,9 +38,17 @@ export class AuthStack extends Stack {

const { project, stage, domain, dnsRecords, hostedZone } = props

// Use casimir.co for prod and dev.casimir.co for dev
/** Use casimir.co for prod and dev.casimir.co for dev */
const serviceDomain = stage === 'Prod' ? domain : [stage.toLowerCase(), domain].join('.')

/** Create a Cognito pool and use CUSTOM_AUTH provider */
const pool = new cognito.UserPool(this, `${project}${this.service}Pool${stage}`)
pool.addClient(`${project}${this.service}PoolCustomClient${stage}`, {
authFlows: {
custom: true
}
})

/** Create an EC2 VPC and an ECS cluster */
const vpc = new ec2.Vpc(this, `${project}${this.service}Vpc${stage}`)
const cluster = new ecs.Cluster(this, `${project}${this.service}Cluster${stage}`, { vpc })
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/cdk/src/providers/landing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class LandingStack extends Stack {

const { project, stage, domain, dnsRecords, hostedZone } = props

// Use casimir.co for prod and dev.casimir.co for dev
/** Use casimir.co for prod and dev.casimir.co for dev */
const serviceDomain = stage === 'Prod' ? domain : [stage.toLowerCase(), domain].join('.')

const certificate = new certmgr.Certificate(this, `${project}${this.service}Cert${stage}`, {
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/cdk/src/providers/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class NodesStack extends Stack {

const { project, stage, domain, dnsRecords, hostedZone, nodesIp } = props

// Use casimir.co for prod and dev.casimir.co for dev
/** Use casimir.co for prod and dev.casimir.co for dev */
const serviceDomain = stage === 'Prod' ? domain : [stage.toLowerCase(), domain].join('.')

new route53.ARecord(this, `${project}${this.service}DnsARecordApi${stage}`, {
Expand Down

0 comments on commit ec36ada

Please sign in to comment.