setup infra for userpool
This commit is contained in:
parent
49946b6546
commit
6bb4081c20
@ -99,17 +99,19 @@ new aws.iam.RolePolicy(`${prefix}-api-role-policy`, {
|
|||||||
|
|
||||||
|
|
||||||
// ---- cognito ----
|
// ---- cognito ----
|
||||||
const userPool = new aws.cognito.UserPool(`${prefix}-cognito-userpool`, {
|
export const userPool = new aws.cognito.UserPool(`${prefix}-cognito-userpool`, {
|
||||||
tags,
|
tags,
|
||||||
autoVerifiedAttributes: ["email"],
|
autoVerifiedAttributes: ["email"],
|
||||||
usernameAttributes: ["email"],
|
usernameAttributes: ["email"],
|
||||||
passwordPolicy: {
|
passwordPolicy: {
|
||||||
minimumLength: 8,
|
minimumLength: 8,
|
||||||
requireSymbols: true,
|
requireLowercase: true,
|
||||||
|
requireUppercase: true,
|
||||||
requireNumbers: true,
|
requireNumbers: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
new aws.cognito.UserPoolClient(`${prefix}-cognito-userpool-cli`, {
|
export const userPoolClient = new aws.cognito.UserPoolClient(`${prefix}-cognito-userpool-cli`, {
|
||||||
userPoolId: userPool.id,
|
userPoolId: userPool.id,
|
||||||
generateSecret: false,
|
generateSecret: false,
|
||||||
|
preventUserExistenceErrors: "ENABLED",
|
||||||
});
|
});
|
||||||
|
@ -91,9 +91,26 @@ const codebuild = new aws.codebuild.Project(`${prefix}-codebuild`, {
|
|||||||
image: "aws/codebuild/standard:7.0",
|
image: "aws/codebuild/standard:7.0",
|
||||||
type: "LINUX_CONTAINER",
|
type: "LINUX_CONTAINER",
|
||||||
environmentVariables: [
|
environmentVariables: [
|
||||||
{ name: "IMBUSY_BE_LAMBDA", value: backend.lambda.name, },
|
{
|
||||||
{ name: "IMBUSY_BE_BUCKET", value: backend.bucket.bucket, },
|
name: "IMBUSY_BE_USERPOOL_CLI",
|
||||||
{ name: "IMBUSY_FE_BUCKET", value: frontend.bucket.bucket, },
|
value: backend.userPoolClient.id,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "IMBUSY_BE_LAMBDA",
|
||||||
|
value: backend.lambda.name,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "IMBUSY_BE_BUCKET",
|
||||||
|
value: backend.bucket.bucket,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "IMBUSY_FE_BUCKET",
|
||||||
|
value: frontend.bucket.bucket,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "IMBUSY_FE_USERPOOL_URL",
|
||||||
|
value: frontend.userPoolUrl,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
serviceRole: role.arn,
|
serviceRole: role.arn,
|
||||||
|
@ -6,6 +6,7 @@ import * as fs from "fs/promises";
|
|||||||
import mime from "mime";
|
import mime from "mime";
|
||||||
|
|
||||||
import * as common from "./common";
|
import * as common from "./common";
|
||||||
|
import * as backend from "./backend";
|
||||||
|
|
||||||
const tags = common.tags;
|
const tags = common.tags;
|
||||||
const prefix = `${common.prefix}-frontend`;
|
const prefix = `${common.prefix}-frontend`;
|
||||||
@ -75,3 +76,12 @@ export const cloudfront = new aws.cloudfront.Distribution(`${prefix}-cloudfront`
|
|||||||
cloudfrontDefaultCertificate: true,
|
cloudfrontDefaultCertificate: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// ---- cognito domain ----
|
||||||
|
const userPoolDomain = new aws.cognito.UserPoolDomain(`${prefix}-userpool-domain`, {
|
||||||
|
domain: "imbusy-auth",
|
||||||
|
userPoolId: backend.userPool.id,
|
||||||
|
});
|
||||||
|
export const userPoolUrl =
|
||||||
|
pulumi.interpolate`https://${userPoolDomain.domain}.auth.${aws.config.region}.amazoncognito.com`;
|
||||||
|
@ -11,3 +11,6 @@ export const feDomain = frontend.cloudfront.domainName;
|
|||||||
export const beBucket = backend.bucket.bucket;
|
export const beBucket = backend.bucket.bucket;
|
||||||
export const beLambda = backend.lambda.name;
|
export const beLambda = backend.lambda.name;
|
||||||
export const beEndpoint = backend.api.apiEndpoint;
|
export const beEndpoint = backend.api.apiEndpoint;
|
||||||
|
|
||||||
|
export const feUserPoolUrl = frontend.userPoolUrl;
|
||||||
|
export const beUserPoolCli = backend.userPoolClient.id;
|
||||||
|
3
setenv
3
setenv
@ -8,4 +8,7 @@ export IMBUSY_BE_BUCKET=$(pulumi stack output beBucket)
|
|||||||
export IMBUSY_BE_LAMBDA=$(pulumi stack output beLambda)
|
export IMBUSY_BE_LAMBDA=$(pulumi stack output beLambda)
|
||||||
export IMBUSY_FE_BUCKET=$(pulumi stack output feBucket)
|
export IMBUSY_FE_BUCKET=$(pulumi stack output feBucket)
|
||||||
|
|
||||||
|
export IMBUSY_BE_USERPOOL_CLI=$(pulumi stack output beUserPoolCli)
|
||||||
|
export IMBUSY_FE_USERPOOL_URL=$(pulumi stack output feUserPoolUrl)
|
||||||
|
|
||||||
cd ../
|
cd ../
|
||||||
|
Loading…
x
Reference in New Issue
Block a user