Skip to content

Instantly share code, notes, and snippets.

@leegilmorecode
Created February 10, 2023 04:48
Show Gist options
  • Save leegilmorecode/fd6d3601055e1394d6735f6a54c23d8f to your computer and use it in GitHub Desktop.
Save leegilmorecode/fd6d3601055e1394d6735f6a54c23d8f to your computer and use it in GitHub Desktop.
import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { EnvironmentConfig } from '../pipeline-types/pipeline-types';
import { StatefulStack } from '../../app/stateful/stateful-stack';
import { StatelessStack } from '../../app/stateless/stateless-stack';
// this is our stage made up of multiple stacks which will be deployed to various environments
// based on config i.e. feature-dev, staging, prod, which also includes our application config
export class PipelineStage extends cdk.Stage {
public readonly apiEndpointUrl: cdk.CfnOutput;
public readonly healthCheckUrl: cdk.CfnOutput;
constructor(scope: Construct, id: string, props: EnvironmentConfig) {
super(scope, id, props);
const statefulStack = new StatefulStack(this, 'StatefulStack', {
bucketName: props.stateful.bucketName,
});
const statelessStack = new StatelessStack(this, 'StatelessStack', {
env: {
account: props.env.account,
region: props.env.region,
},
table: statefulStack.table,
bucket: statefulStack.bucket,
lambdaMemorySize: props.stateless.lambdaMemorySize,
stageName: props.stageName,
});
this.apiEndpointUrl = statelessStack.apiEndpointUrl;
this.healthCheckUrl = statelessStack.healthCheckUrl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment