Skip to content

v39.0.0

Compare
Choose a tag to compare
@github-actions github-actions released this 28 Mar 19:29
· 1923 commits to main since this release
bad02b1

39.0.0 (2022-03-28)

  • feat!: Remove Stage CFN Parameter in favour of property (#1134) (bad02b1), closes #1134

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),
      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;
  domainName: string;
  scaling: GuAsgCapacity;
}

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

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

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

    new GuPlayApp(this, {
      app: CdkPlayground.app,
      instanceType: InstanceType.of(InstanceClass.T4G, InstanceSize.MICRO),
      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",
  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",
  domainName: "cdk-playground.prod.gutools.co.uk",
  scaling: { minimumInstances: 3 },
});

Also see guardian/riff-raff#681.