Skip to content

v38.0.0-beta.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 07 Mar 10:41
· 1829 commits to beta since this release

38.0.0-beta.1 (2022-03-07)

  • feat!: Remove Stage CFN Parameter in favour of property (c419031)

BREAKING CHANGES

  • Removal of explicit stage awareness in favour of users defined properties.

From:

// -- lib/cdk-playground.ts
export class CdkPlayground extends GuStack {
  private static app = "cdk-playground";

  constructor(scope: App, id: string, props: GuStackProps) {
    super(scope, id, props);

    new GuPlayApp(this, {
      app: CdkPlayground.app,
      instanceType: InstanceType.of(InstanceClass.T4G, InstanceSize.MICRO), // cannot be made stage aware
      access: { scope: AccessScope.PUBLIC },
      userData: {
        distributable: {
          fileName: `${CdkPlayground.app}.deb`,
          executionStatement: `dpkg -i /${CdkPlayground.app}/${CdkPlayground.app}.deb`,
        },
      },
      certificateProps: {
        [Stage.CODE]: {
          domainName: "cdk-playground.code.dev-gutools.co.uk",
        },
        [Stage.PROD]: {
          domainName: "cdk-playground.prod.gutools.co.uk",
        },
      },
      monitoringConfiguration: { noMonitoring: true },
      scaling: {
        [Stage.CODE]: {
          minimumInstances: 1,
        },
        [Stage.PROD]: {
          minimumInstances: 3,
        },
      },
    });
  }
}

// -- bin/cdk.ts
const app = new App();

// produces one output file `cdk.out/CdkPlayground.template.json` with `Mappings` and `FindInMap` intrinsic functions
new CdkPlayground(app, "CdkPlayground", { stack: "deploy" });

To:

// -- lib/cdk-playground.ts
export interface CdkPlaygroundProps {
  stage: string;
  instanceType: InstanceType;
  domainName: string;
  scaling: GuAsgCapacity;
}

export class CdkPlayground extends GuStack {
  private static app = "cdk-playground";

  constructor(scope: App, id: string, props: CdkPlaygroundProps) {
    const { stage, instanceType, domainName, scaling } = props;

    super(scope, id, {
      stack: "deploy",
      stage,
    });

    new GuPlayApp(this, {
      app: CdkPlayground.app,
      instanceType,
      access: { scope: AccessScope.PUBLIC },
      userData: {
        distributable: {
          fileName: `${CdkPlayground.app}.deb`,
          executionStatement: `dpkg -i /${CdkPlayground.app}/${CdkPlayground.app}.deb`,
        },
      },
      certificateProps: {
        domainName,
      },
      monitoringConfiguration: { noMonitoring: true },
      scaling,
    });
  }
}

// -- bin/cdk.ts
const app = new App();

// produces output file `cdk.out/CdkPlayground-CODE.template.json`
new CdkPlayground(app, "CdkPlayground-CODE", {
  stage: "CODE",
  instanceType: : InstanceType.of(InstanceClass.T4G, InstanceSize.MICRO),
  domainName: "cdk-playground.code.dev-gutools.co.uk",
  scaling: { minimumInstances: 1 },
});

// produces output file `cdk.out/CdkPlayground-PROD.template.json`
new CdkPlayground(app, "CdkPlayground-PROD", {
  stage: "PROD",
  instanceType: : InstanceType.of(InstanceClass.T4G, InstanceSize.MEDIUM),
  domainName: "cdk-playground.prod.gutools.co.uk",
  scaling: { minimumInstances: 3 },
});