Skip to content

Commit

Permalink
Prepare for prod-stage deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswilty committed Jul 3, 2024
1 parent 18c2655 commit b8b1fdb
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cloud/bin/cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const tags = {

/* Stack constructs */

const hostedZoneStack = new HostedZoneStack(app, generateStackName('hosted-zone'), {
const hostedZoneStack = new HostedZoneStack(app, generateStackName('hostedzone'), {
description: generateDescription('Hosted Zone stack'),
env,
tags,
Expand Down
5 changes: 3 additions & 2 deletions cloud/lib/api-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib/core';
import { Construct } from 'constructs';
import { join } from 'node:path';

import { appName, resourceId } from './resourceNamingUtils';
import { appName, resourceId, stageName } from './resourceNamingUtils';

type ApiStackProps = StackProps & {
apiDomainName: string;
Expand All @@ -46,6 +46,7 @@ export class ApiStack extends Stack {
super(scope, id, props);

const generateResourceId = resourceId(scope);
const stage = stageName(scope);

const {
apiDomainName,
Expand Down Expand Up @@ -76,7 +77,7 @@ export class ApiStack extends Stack {
const apiKeySecret = Secret.fromSecretNameV2(
this,
generateResourceId('apikey'),
'dev/SpyLogic/ApiKey'
`${stage}/SpyLogic/ApiKey`
);

/*
Expand Down
2 changes: 1 addition & 1 deletion cloud/lib/hostedzone-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class HostedZoneStack extends Stack {
throw new Error('HOSTED_ZONE_ID not found in env vars');
}

this.hostedZone = HostedZone.fromHostedZoneAttributes(this, resourceId(scope)('hosted-zone'), {
this.hostedZone = HostedZone.fromHostedZoneAttributes(this, resourceId(scope)('hostedzone'), {
hostedZoneId: HOSTED_ZONE_ID,
zoneName: DOMAIN_NAME,
});
Expand Down
3 changes: 2 additions & 1 deletion cloud/lib/ui-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { Duration, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib/core';
import { Construct } from 'constructs';
import { join } from 'node:path';

import { appName, resourceId } from './resourceNamingUtils';
import { appName, resourceId, stackName } from './resourceNamingUtils';

type UiStackProps = StackProps & {
apiDomainName: string;
Expand Down Expand Up @@ -94,6 +94,7 @@ export class UiStack extends Stack {
generateResourceId('api-gatekeeper'),
{
functionName: 'edge-api-gatekeeper',
stackId: stackName(scope)('edge-lambda'),
handler: 'index.handler',
runtime: Runtime.NODEJS_18_X,
code: new TypeScriptCode(join(__dirname, 'lambdas/verifyAuth/index.ts'), {
Expand Down
1 change: 1 addition & 0 deletions cloud/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"scripts": {
"cdk:synth": "cdk synth -q \"*\"",
"cdk:synth:prod": "cdk synth --context STAGE=prod -q \"*\"",
"cdk:diff": "cdk diff --app cdk.out",
"cdk:deploy": "cdk deploy --app cdk.out",
"cdk:deploy:all": "cdk deploy --app cdk.out --all",
Expand Down

0 comments on commit b8b1fdb

Please sign in to comment.