@guardian/cdk 49.0.0-beta.1 → 49.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/lib/aspects/cfn-parameter-reporter.d.ts +9 -0
  2. package/lib/aspects/cfn-parameter-reporter.d.ts.map +1 -0
  3. package/lib/aspects/cfn-parameter-reporter.js +21 -0
  4. package/lib/aspects/cfn-parameter-reporter.js.map +1 -0
  5. package/lib/bin/commands/new-project/index.d.ts +1 -1
  6. package/lib/bin/commands/new-project/index.d.ts.map +1 -1
  7. package/lib/constants/metadata-keys.d.ts +0 -1
  8. package/lib/constants/metadata-keys.d.ts.map +1 -1
  9. package/lib/constants/metadata-keys.js +0 -1
  10. package/lib/constants/metadata-keys.js.map +1 -1
  11. package/lib/constructs/acm/certificate.d.ts +1 -1
  12. package/lib/constructs/acm/certificate.d.ts.map +1 -1
  13. package/lib/constructs/autoscaling/user-data.d.ts +1 -1
  14. package/lib/constructs/autoscaling/user-data.d.ts.map +1 -1
  15. package/lib/constructs/autoscaling/user-data.js +8 -8
  16. package/lib/constructs/autoscaling/user-data.js.map +1 -1
  17. package/lib/constructs/core/parameters/base.d.ts +2 -2
  18. package/lib/constructs/core/parameters/base.d.ts.map +1 -1
  19. package/lib/constructs/core/stack.d.ts +7 -1
  20. package/lib/constructs/core/stack.d.ts.map +1 -1
  21. package/lib/constructs/core/stack.js +31 -23
  22. package/lib/constructs/core/stack.js.map +1 -1
  23. package/lib/constructs/dns/dns-records.js +1 -1
  24. package/lib/constructs/dns/dns-records.js.map +1 -1
  25. package/lib/constructs/ec2/vpc.d.ts +1 -1
  26. package/lib/constructs/ec2/vpc.d.ts.map +1 -1
  27. package/lib/constructs/ecs/ecs-task.d.ts +4 -4
  28. package/lib/constructs/ecs/ecs-task.d.ts.map +1 -1
  29. package/lib/constructs/iam/policies/base-policy.d.ts +3 -3
  30. package/lib/constructs/iam/policies/base-policy.d.ts.map +1 -1
  31. package/lib/constructs/iam/roles/instance-role.d.ts +1 -1
  32. package/lib/constructs/iam/roles/instance-role.d.ts.map +1 -1
  33. package/lib/constructs/iam/roles/roles.d.ts +1 -1
  34. package/lib/constructs/iam/roles/roles.d.ts.map +1 -1
  35. package/lib/constructs/kinesis/kinesis-stream.d.ts +1 -1
  36. package/lib/constructs/kinesis/kinesis-stream.d.ts.map +1 -1
  37. package/lib/constructs/vpc/vpc.d.ts +1 -1
  38. package/lib/constructs/vpc/vpc.d.ts.map +1 -1
  39. package/lib/constructs/vpc/vpc.js +1 -1
  40. package/lib/constructs/vpc/vpc.js.map +1 -1
  41. package/lib/experimental/constructs/error-budget-alarm.d.ts +47 -2
  42. package/lib/experimental/constructs/error-budget-alarm.d.ts.map +1 -1
  43. package/lib/experimental/constructs/error-budget-alarm.js +84 -42
  44. package/lib/experimental/constructs/error-budget-alarm.js.map +1 -1
  45. package/lib/experimental/constructs/index.d.ts +3 -0
  46. package/lib/experimental/constructs/index.d.ts.map +1 -0
  47. package/lib/{constructs/sns → experimental/constructs}/index.js +2 -1
  48. package/lib/experimental/constructs/index.js.map +1 -0
  49. package/lib/experimental/patterns/sns-lambda.d.ts.map +1 -1
  50. package/lib/experimental/patterns/sns-lambda.js +1 -2
  51. package/lib/experimental/patterns/sns-lambda.js.map +1 -1
  52. package/lib/experimental/riff-raff-yaml-file/index.js +48 -48
  53. package/lib/experimental/riff-raff-yaml-file/index.js.map +1 -1
  54. package/lib/experimental/riff-raff-yaml-file/types.d.ts +7 -7
  55. package/lib/experimental/riff-raff-yaml-file/types.d.ts.map +1 -1
  56. package/lib/patterns/api-multiple-lambdas.d.ts +5 -1
  57. package/lib/patterns/api-multiple-lambdas.d.ts.map +1 -1
  58. package/lib/patterns/api-multiple-lambdas.js +3 -1
  59. package/lib/patterns/api-multiple-lambdas.js.map +1 -1
  60. package/lib/patterns/ec2-app/base.d.ts.map +1 -1
  61. package/lib/patterns/ec2-app/base.js +0 -5
  62. package/lib/patterns/ec2-app/base.js.map +1 -1
  63. package/lib/patterns/ec2-app/framework.d.ts +1 -1
  64. package/lib/patterns/ec2-app/framework.d.ts.map +1 -1
  65. package/lib/types/access.d.ts +1 -1
  66. package/lib/types/access.d.ts.map +1 -1
  67. package/lib/types/cli.d.ts +1 -1
  68. package/lib/types/cli.d.ts.map +1 -1
  69. package/lib/utils/lambda/event-source.d.ts +4 -4
  70. package/lib/utils/lambda/event-source.d.ts.map +1 -1
  71. package/lib/utils/lambda/event-source.js +4 -4
  72. package/lib/utils/lambda/event-source.js.map +1 -1
  73. package/lib/utils/mixin/types.d.ts +1 -1
  74. package/lib/utils/mixin/types.d.ts.map +1 -1
  75. package/package.json +21 -21
  76. package/lib/constructs/sns/index.d.ts +0 -2
  77. package/lib/constructs/sns/index.d.ts.map +0 -1
  78. package/lib/constructs/sns/index.js.map +0 -1
  79. package/lib/constructs/sns/sns-topic.d.ts +0 -15
  80. package/lib/constructs/sns/sns-topic.d.ts.map +0 -1
  81. package/lib/constructs/sns/sns-topic.js +0 -17
  82. package/lib/constructs/sns/sns-topic.js.map +0 -1
@@ -0,0 +1,9 @@
1
+ import type { IAspect } from "aws-cdk-lib";
2
+ import type { IConstruct } from "constructs";
3
+ /**
4
+ * An Aspect to remind users to check Parameters to ensure Riff-Raff can successfully deploy the stack.
5
+ */
6
+ export declare class CfnParameterReporter implements IAspect {
7
+ visit(node: IConstruct): void;
8
+ }
9
+ //# sourceMappingURL=cfn-parameter-reporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cfn-parameter-reporter.d.ts","sourceRoot":"","sources":["../../src/aspects/cfn-parameter-reporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;GAEG;AACH,qBAAa,oBAAqB,YAAW,OAAO;IAC3C,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;CAarC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CfnParameterReporter = void 0;
4
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
5
+ /**
6
+ * An Aspect to remind users to check Parameters to ensure Riff-Raff can successfully deploy the stack.
7
+ */
8
+ class CfnParameterReporter {
9
+ visit(node) {
10
+ if (node instanceof aws_cdk_lib_1.CfnParameter) {
11
+ const defaultValue = node.default;
12
+ const hasDefault = !!defaultValue;
13
+ const isSsmParameter = node.type.startsWith("AWS::SSM::Parameter::Value");
14
+ if (isSsmParameter && hasDefault) {
15
+ aws_cdk_lib_1.Annotations.of(node.stack).addInfo(`Stack reads the SSM Parameter '${defaultValue}'. Ensure it exists prior to deployment.`);
16
+ }
17
+ }
18
+ }
19
+ }
20
+ exports.CfnParameterReporter = CfnParameterReporter;
21
+ //# sourceMappingURL=cfn-parameter-reporter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cfn-parameter-reporter.js","sourceRoot":"","sources":["../../src/aspects/cfn-parameter-reporter.ts"],"names":[],"mappings":";;;AACA,6CAAwD;AAGxD;;GAEG;AACH,MAAa,oBAAoB;IACxB,KAAK,CAAC,IAAgB;QAC3B,IAAI,IAAI,YAAY,0BAAY,EAAE;YAChC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAiB,CAAC;YAC5C,MAAM,UAAU,GAAG,CAAC,CAAC,YAAY,CAAC;YAClC,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,4BAA4B,CAAC,CAAC;YAE1E,IAAI,cAAc,IAAI,UAAU,EAAE;gBAChC,yBAAW,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAChC,kCAAkC,YAAY,0CAA0C,CACzF,CAAC;aACH;SACF;IACH,CAAC;CACF;AAdD,oDAcC","sourcesContent":["import type { IAspect } from \"aws-cdk-lib\";\nimport { Annotations, CfnParameter } from \"aws-cdk-lib\";\nimport type { IConstruct } from \"constructs\";\n\n/**\n * An Aspect to remind users to check Parameters to ensure Riff-Raff can successfully deploy the stack.\n */\nexport class CfnParameterReporter implements IAspect {\n public visit(node: IConstruct): void {\n if (node instanceof CfnParameter) {\n const defaultValue = node.default as string;\n const hasDefault = !!defaultValue;\n const isSsmParameter = node.type.startsWith(\"AWS::SSM::Parameter::Value\");\n\n if (isSsmParameter && hasDefault) {\n Annotations.of(node.stack).addInfo(\n `Stack reads the SSM Parameter '${defaultValue}'. Ensure it exists prior to deployment.`\n );\n }\n }\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { CliCommandResponse } from "../../../types/cli";
2
- export declare type PackageManager = "npm" | "yarn";
2
+ export type PackageManager = "npm" | "yarn";
3
3
  interface NewProjectProps {
4
4
  init: boolean;
5
5
  app: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bin/commands/new-project/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAW7D,oBAAY,cAAc,GAAG,KAAK,GAAG,MAAM,CAAC;AAE5C,UAAU,eAAe;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,cAAc,CAAC;CAChC;AAsED,eAAO,MAAM,aAAa,UAAiB,eAAe,uBA+EzD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bin/commands/new-project/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAW7D,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,CAAC;AAE5C,UAAU,eAAe;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,cAAc,CAAC;CAChC;AAsED,eAAO,MAAM,aAAa,UAAiB,eAAe,uBA+EzD,CAAC"}
@@ -2,7 +2,6 @@ export declare const MetadataKeys: {
2
2
  VERSION: string;
3
3
  CONSTRUCTS_KEY: string;
4
4
  REPOSITORY_NAME: string;
5
- PATTERN_NAME: string;
6
5
  LOG_KINESIS_STREAM_NAME: string;
7
6
  SYSTEMD_UNIT: string;
8
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"metadata-keys.d.ts","sourceRoot":"","sources":["../../src/constants/metadata-keys.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;;;;CAOxB,CAAC"}
1
+ {"version":3,"file":"metadata-keys.d.ts","sourceRoot":"","sources":["../../src/constants/metadata-keys.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;;;CAMxB,CAAC"}
@@ -5,7 +5,6 @@ exports.MetadataKeys = {
5
5
  VERSION: "gu:cdk:version",
6
6
  CONSTRUCTS_KEY: "gu:cdk:constructs",
7
7
  REPOSITORY_NAME: "gu:repo",
8
- PATTERN_NAME: "gu:cdk:pattern-name",
9
8
  LOG_KINESIS_STREAM_NAME: "LogKinesisStreamName",
10
9
  SYSTEMD_UNIT: "SystemdUnit",
11
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"metadata-keys.js","sourceRoot":"","sources":["../../src/constants/metadata-keys.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,OAAO,EAAE,gBAAgB;IACzB,cAAc,EAAE,mBAAmB;IACnC,eAAe,EAAE,SAAS;IAC1B,YAAY,EAAE,qBAAqB;IACnC,uBAAuB,EAAE,sBAAsB;IAC/C,YAAY,EAAE,aAAa;CAC5B,CAAC","sourcesContent":["export const MetadataKeys = {\n VERSION: \"gu:cdk:version\",\n CONSTRUCTS_KEY: \"gu:cdk:constructs\",\n REPOSITORY_NAME: \"gu:repo\",\n PATTERN_NAME: \"gu:cdk:pattern-name\",\n LOG_KINESIS_STREAM_NAME: \"LogKinesisStreamName\",\n SYSTEMD_UNIT: \"SystemdUnit\",\n};\n"]}
1
+ {"version":3,"file":"metadata-keys.js","sourceRoot":"","sources":["../../src/constants/metadata-keys.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,OAAO,EAAE,gBAAgB;IACzB,cAAc,EAAE,mBAAmB;IACnC,eAAe,EAAE,SAAS;IAC1B,uBAAuB,EAAE,sBAAsB;IAC/C,YAAY,EAAE,aAAa;CAC5B,CAAC","sourcesContent":["export const MetadataKeys = {\n VERSION: \"gu:cdk:version\",\n CONSTRUCTS_KEY: \"gu:cdk:constructs\",\n REPOSITORY_NAME: \"gu:repo\",\n LOG_KINESIS_STREAM_NAME: \"LogKinesisStreamName\",\n SYSTEMD_UNIT: \"SystemdUnit\",\n};\n"]}
@@ -2,7 +2,7 @@ import { Certificate } from "aws-cdk-lib/aws-certificatemanager";
2
2
  import type { GuDomainName } from "../../types";
3
3
  import { AppIdentity } from "../core";
4
4
  import type { GuStack } from "../core";
5
- export declare type GuCertificatePropsWithApp = GuDomainName & AppIdentity;
5
+ export type GuCertificatePropsWithApp = GuDomainName & AppIdentity;
6
6
  declare const GuCertificate_base: {
7
7
  new (...args: any[]): {
8
8
  readonly idWithApp: string;
@@ -1 +1 @@
1
- {"version":3,"file":"certificate.d.ts","sourceRoot":"","sources":["../../../src/constructs/acm/certificate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAyB,MAAM,oCAAoC,CAAC;AAGxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,oBAAY,yBAAyB,GAAG,YAAY,GAAG,WAAW,CAAC;;;;;;AAEnE;;;;;;;;GAQG;AACH,qBAAa,aAAc,SAAQ,kBAAgC;gBACrD,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,yBAAyB;CAe7D"}
1
+ {"version":3,"file":"certificate.d.ts","sourceRoot":"","sources":["../../../src/constructs/acm/certificate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAyB,MAAM,oCAAoC,CAAC;AAGxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,MAAM,yBAAyB,GAAG,YAAY,GAAG,WAAW,CAAC;;;;;;AAEnE;;;;;;;;GAQG;AACH,qBAAa,aAAc,SAAQ,kBAAgC;gBACrD,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,yBAAyB;CAe7D"}
@@ -3,7 +3,7 @@ import type { S3DownloadOptions } from "aws-cdk-lib/aws-ec2";
3
3
  import type { GuDistributableForEc2 } from "../../types";
4
4
  import type { GuPrivateS3ConfigurationProps } from "../../utils/ec2";
5
5
  import type { AppIdentity, GuStack } from "../core";
6
- export declare type GuUserDataPropsWithApp = GuUserDataProps & AppIdentity;
6
+ export type GuUserDataPropsWithApp = GuUserDataProps & AppIdentity;
7
7
  export interface GuUserDataProps {
8
8
  distributable: GuDistributableForEc2;
9
9
  configuration?: GuPrivateS3ConfigurationProps;
@@ -1 +1 @@
1
- {"version":3,"file":"user-data.d.ts","sourceRoot":"","sources":["../../../src/constructs/autoscaling/user-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAG7D,OAAO,KAAK,EAAE,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a,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAW;IAErC,IAAI,QAAQ,IAAI,QAAQ,CAEvB;IAED,OAAO,CAAC,qBAAqB;IAc7B,OAAO,CAAC,qBAAqB;gBAqBjB,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,sBAAsB;IAWzD,WAAW,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,UAAU;IAK9C,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,UAAU;CAI5D"}
@@ -13,14 +13,6 @@ const core_1 = require("../core");
13
13
  * - execute distributable
14
14
  */
15
15
  class GuUserData {
16
- constructor(scope, props) {
17
- this._userData = aws_ec2_1.UserData.forLinux();
18
- if (props.configuration) {
19
- this.downloadConfiguration(scope, props.app, props.configuration);
20
- }
21
- this.downloadDistributable(scope, props, props.distributable);
22
- this.addCommands(props.distributable.executionStatement);
23
- }
24
16
  get userData() {
25
17
  return this._userData;
26
18
  }
@@ -52,6 +44,14 @@ class GuUserData {
52
44
  });
53
45
  });
54
46
  }
47
+ constructor(scope, props) {
48
+ this._userData = aws_ec2_1.UserData.forLinux();
49
+ if (props.configuration) {
50
+ this.downloadConfiguration(scope, props.app, props.configuration);
51
+ }
52
+ this.downloadDistributable(scope, props, props.distributable);
53
+ this.addCommands(props.distributable.executionStatement);
54
+ }
55
55
  addCommands(...commands) {
56
56
  this._userData.addCommands(...commands);
57
57
  return this;
@@ -1 +1 @@
1
- {"version":3,"file":"user-data.js","sourceRoot":"","sources":["../../../src/constructs/autoscaling/user-data.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAE/C,+CAA4C;AAC5C,uCAA8C;AAG9C,kCAAwD;AASxD;;;;;;GAMG;AACH,MAAa,UAAU;IA0CrB,YAAY,KAAc,EAAE,KAA6B;QACvD,IAAI,CAAC,SAAS,GAAG,kBAAQ,CAAC,QAAQ,EAAE,CAAC;QAErC,IAAI,KAAK,CAAC,aAAa,EAAE;YACvB,IAAI,CAAC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AQ,EAAE;gBACb,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;aACvE;YAED,IAAI,CAAC,oBAAoB,CAAC;gBACxB,MAAM;gBACN,SAAS;gBACT,SAAS,EAAE,QAAQ,GAAG,IAAI,QAAQ,EAAE;aACrC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAaD,WAAW,CAAC,GAAG,QAAkB;QAC/B,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,oBAAoB,CAAC,MAAyB;QAC5C,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA9DD,gCA8DC","sourcesContent":["import { UserData } from \"aws-cdk-lib/aws-ec2\";\nimport type { S3DownloadOptions } from \"aws-cdk-lib/aws-ec2\";\nimport { Bucket } from \"aws-cdk-lib/aws-s3\";\nimport { GuDistributable } from \"../../types\";\nimport type { GuDistributableForEc2 } from \"../../types\";\nimport type { GuPrivateS3ConfigurationProps } from \"../../utils/ec2\";\nimport { GuDistributionBucketParameter } from \"../core\";\nimport type { AppIdentity, GuStack } from \"../core\";\n\nexport type GuUserDataPropsWithApp = GuUserDataProps & AppIdentity;\nexport interface GuUserDataProps {\n distributable: GuDistributableForEc2;\n configuration?: GuPrivateS3ConfigurationProps;\n}\n\n/**\n * An abstraction over UserData to simplify its creation.\n * Especially useful for simple user data where we:\n * - (optional) download config\n * - download distributable\n * - execute distributable\n */\nexport class GuUserData {\n private readonly _userData: UserData;\n\n get userData(): UserData {\n return this._userData;\n }\n\n private downloadDistributable(scope: GuStack, app: AppIdentity, props: GuDistributableForEc2) {\n const bucketKey = GuDistributable.getObjectKey(scope, app, props);\n\n const bucket = Bucket.fromBucketAttributes(scope, \"DistributionBucket\", {\n bucketName: GuDistributionBucketParameter.getInstance(scope).valueAsString,\n });\n\n this.addS3DownloadCommand({\n bucket,\n bucketKey,\n localFile: `/${app.app}/${props.fileName}`,\n });\n }\n\n private downloadConfiguration(scope: GuStack, app: string, props: GuPrivateS3ConfigurationProps) {\n const bucket = Bucket.fromBucketAttributes(scope, `${app}ConfigurationBucket`, {\n bucketName: props.bucket.valueAsString,\n });\n\n props.files.forEach((bucketKey) => {\n const fileName = bucketKey.split(\"/\").slice(-1)[0];\n\n // `fileName` is typed as `string | undefined`. Throw if `fileName` is falsy.\n if (!fileName) {\n throw new Error(\"Failed to create configuration section in UserData\");\n }\n\n this.addS3DownloadCommand({\n bucket,\n bucketKey,\n localFile: `/etc/${app}/${fileName}`,\n });\n });\n }\n\n constructor(scope: GuStack, props: GuUserDataPropsWithApp) {\n this._userData = UserData.forLinux();\n\n if (props.configuration) {\n this.downloadConfiguration(scope, props.app, props.configuration);\n }\n\n this.downloadDistributable(scope, props, props.distributable);\n this.addCommands(props.distributable.executionStatement);\n }\n\n addCommands(...commands: string[]): GuUserData {\n this._userData.addCommands(...commands);\n return this;\n }\n\n addS3DownloadCommand(params: S3DownloadOptions): GuUserData {\n this._userData.addS3DownloadCommand(params);\n return this;\n }\n}\n"]}
1
+ {"version":3,"file":"user-data.js","sourceRoot":"","sources":["../../../src/constructs/autoscaling/user-data.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAE/C,+CAA4C;AAC5C,uCAA8C;AAG9C,kCAAwD;AASxD;;;;;;GAMG;AACH,MAAa,UAAU;IAGrB,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEO,qBAAqB,CAAC,KAAc,EAAE,GAAgB,EAAE,KAA4B;QAC1F,MAAM,SAAS,GAAG,uBAAe,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QAElE,MAAM,MAAM,GAAG,eAAM,CAAC,oBAAoB,CAAC,KAAK,EAAE,oBAAoB,EAAE;YACtE,UAAU,EAAE,oCAA6B,CA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K,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;IAC3D,CAAC;IAED,WAAW,CAAC,GAAG,QAAkB;QAC/B,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,oBAAoB,CAAC,MAAyB;QAC5C,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA9DD,gCA8DC","sourcesContent":["import { UserData } from \"aws-cdk-lib/aws-ec2\";\nimport type { S3DownloadOptions } from \"aws-cdk-lib/aws-ec2\";\nimport { Bucket } from \"aws-cdk-lib/aws-s3\";\nimport { GuDistributable } from \"../../types\";\nimport type { GuDistributableForEc2 } from \"../../types\";\nimport type { GuPrivateS3ConfigurationProps } from \"../../utils/ec2\";\nimport { GuDistributionBucketParameter } from \"../core\";\nimport type { AppIdentity, GuStack } from \"../core\";\n\nexport type GuUserDataPropsWithApp = GuUserDataProps & AppIdentity;\nexport interface GuUserDataProps {\n distributable: GuDistributableForEc2;\n configuration?: GuPrivateS3ConfigurationProps;\n}\n\n/**\n * An abstraction over UserData to simplify its creation.\n * Especially useful for simple user data where we:\n * - (optional) download config\n * - download distributable\n * - execute distributable\n */\nexport class GuUserData {\n private readonly _userData: UserData;\n\n get userData(): UserData {\n return this._userData;\n }\n\n private downloadDistributable(scope: GuStack, app: AppIdentity, props: GuDistributableForEc2) {\n const bucketKey = GuDistributable.getObjectKey(scope, app, props);\n\n const bucket = Bucket.fromBucketAttributes(scope, \"DistributionBucket\", {\n bucketName: GuDistributionBucketParameter.getInstance(scope).valueAsString,\n });\n\n this.addS3DownloadCommand({\n bucket,\n bucketKey,\n localFile: `/${app.app}/${props.fileName}`,\n });\n }\n\n private downloadConfiguration(scope: GuStack, app: string, props: GuPrivateS3ConfigurationProps) {\n const bucket = Bucket.fromBucketAttributes(scope, `${app}ConfigurationBucket`, {\n bucketName: props.bucket.valueAsString,\n });\n\n props.files.forEach((bucketKey) => {\n const fileName = bucketKey.split(\"/\").slice(-1)[0];\n\n // `fileName` is typed as `string | undefined`. Throw if `fileName` is falsy.\n if (!fileName) {\n throw new Error(\"Failed to create configuration section in UserData\");\n }\n\n this.addS3DownloadCommand({\n bucket,\n bucketKey,\n localFile: `/etc/${app}/${fileName}`,\n });\n });\n }\n\n constructor(scope: GuStack, props: GuUserDataPropsWithApp) {\n this._userData = UserData.forLinux();\n\n if (props.configuration) {\n this.downloadConfiguration(scope, props.app, props.configuration);\n }\n\n this.downloadDistributable(scope, props, props.distributable);\n this.addCommands(props.distributable.executionStatement);\n }\n\n addCommands(...commands: string[]): GuUserData {\n this._userData.addCommands(...commands);\n return this;\n }\n\n addS3DownloadCommand(params: S3DownloadOptions): GuUserData {\n this._userData.addS3DownloadCommand(params);\n return this;\n }\n}\n"]}
@@ -5,8 +5,8 @@ import type { GuStack } from "../stack";
5
5
  export interface GuParameterProps extends CfnParameterProps {
6
6
  fromSSM?: boolean;
7
7
  }
8
- export declare type GuNoTypeParameterProps = Omit<GuParameterProps, "type">;
9
- export declare type GuNoTypeParameterPropsWithAppIdentity = Omit<GuParameterProps, "type"> & AppIdentity;
8
+ export type GuNoTypeParameterProps = Omit<GuParameterProps, "type">;
9
+ export type GuNoTypeParameterPropsWithAppIdentity = Omit<GuParameterProps, "type"> & AppIdentity;
10
10
  export declare class GuParameter extends CfnParameter {
11
11
  readonly id: string;
12
12
  constructor(scope: GuStack, id: string, props: GuParameterProps);
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/constructs/core/parameters/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,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AAQ,YAAY;IAC3C,SAAgB,EAAE,EAAE,MAAM,CAAC;gBAEf,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB;CAShE;AAED,qBAAa,iBAAkB,SAAQ,WAAW;gBACpC,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB;CAGtE;AAED,qBAAa,cAAe,SAAQ,iBAAiB;gBACvC,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB;CAOtE"}
@@ -10,6 +10,10 @@ export interface GuStackProps extends Omit<StackProps, "stackName"> {
10
10
  */
11
11
  stack: string;
12
12
  stage: string;
13
+ /**
14
+ * Optional name of the app. If defined, all resources will have an App tag.
15
+ */
16
+ app?: string;
13
17
  /**
14
18
  * The AWS CloudFormation stack name (as shown in the AWS CloudFormation UI).
15
19
  * @defaultValue the `GU_CFN_STACK_NAME` environment variable
@@ -57,8 +61,10 @@ export interface GuStackProps extends Omit<StackProps, "stackName"> {
57
61
  export declare class GuStack extends Stack implements StackStageIdentity {
58
62
  private readonly _stack;
59
63
  private readonly _stage;
64
+ private readonly _app?;
60
65
  get stage(): string;
61
66
  get stack(): string;
67
+ get app(): string | undefined;
62
68
  /**
63
69
  * A helper function to add a tag to all resources in a stack.
64
70
  *
@@ -76,7 +82,7 @@ export declare class GuStack extends Stack implements StackStageIdentity {
76
82
  * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html
77
83
  */
78
84
  get parameters(): Record<string, CfnParameter>;
79
- constructor(app: App, id: string, props: GuStackProps);
85
+ constructor(scope: App, id: string, props: GuStackProps);
80
86
  /**
81
87
  * Adds a tag to resources in the stack for the repository name.
82
88
  * The value is retrieved in the following order:
@@ -1 +1 @@
1
- {"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../../src/constructs/core/stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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,IAAI,MAAM,CAElB;IAED,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,GAAG,IAAI,MAAM,GAAG,SAAS,CAE5B;IAED;;;;;;;;;OASG;IACH,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,wBAAwB,GAAE,OAAc,GAAG,IAAI;IAM5F;;;;OAIG;IACH,IAAI,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAK7C;gBAGW,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY;IAmCvD;;;;;;;OAOG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqDG;IACI,iBAAiB,CAAC,SAAS,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,iBAAiB,GAAG,IAAI;CAQhG;AAED;;;;GAIG;AACH,qBAAa,0BAA2B,SAAQ,OAAO;gBAEzC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY;IAI3C,IAAI,OAAO,IAAI,MAAM,CAEpB;CACF"}
@@ -8,6 +8,7 @@ const aws_cdk_lib_1 = require("aws-cdk-lib");
8
8
  const assertions_1 = require("aws-cdk-lib/assertions");
9
9
  const git_url_parse_1 = __importDefault(require("git-url-parse"));
10
10
  const cfn_include_reporter_1 = require("../../aspects/cfn-include-reporter");
11
+ const cfn_parameter_reporter_1 = require("../../aspects/cfn-parameter-reporter");
11
12
  const metadata_1 = require("../../aspects/metadata");
12
13
  const constants_1 = require("../../constants");
13
14
  const git_1 = require("../../utils/git");
@@ -39,35 +40,15 @@ const git_1 = require("../../utils/git");
39
40
  * ```
40
41
  */
41
42
  class GuStack extends aws_cdk_lib_1.Stack {
42
- // eslint-disable-next-line custom-rules/valid-constructors -- GuStack is the exception as it must take an App
43
- constructor(app, id, props) {
44
- const { cloudFormationStackName = process.env.GU_CFN_STACK_NAME, stack, stage, withoutTags } = props;
45
- super(app, id, {
46
- ...props,
47
- stackName: cloudFormationStackName,
48
- // TODO Use `DefaultStackSynthesizer` or create own synthesizer?
49
- // see https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping.html#bootstrapping-custom-synth
50
- synthesizer: new aws_cdk_lib_1.LegacyStackSynthesizer(),
51
- });
52
- this._stack = stack;
53
- this._stage = stage.toUpperCase();
54
- if (!withoutTags) {
55
- this.addTag(constants_1.TrackingTag.Key, constants_1.TrackingTag.Value);
56
- this.addTag("Stack", this.stack);
57
- this.addTag("Stage", this.stage);
58
- this.tryAddRepositoryTag();
59
- }
60
- if (!props.withoutMetadata) {
61
- aws_cdk_lib_1.Aspects.of(this).add(new metadata_1.Metadata(this));
62
- }
63
- aws_cdk_lib_1.Aspects.of(this).add(new cfn_include_reporter_1.CfnIncludeReporter());
64
- }
65
43
  get stage() {
66
44
  return this._stage;
67
45
  }
68
46
  get stack() {
69
47
  return this._stack;
70
48
  }
49
+ get app() {
50
+ return this._app;
51
+ }
71
52
  /**
72
53
  * A helper function to add a tag to all resources in a stack.
73
54
  *
@@ -94,6 +75,33 @@ class GuStack extends aws_cdk_lib_1.Stack {
94
75
  .filter((construct) => construct instanceof aws_cdk_lib_1.CfnParameter)
95
76
  .reduce((acc, param) => ({ ...acc, [param.node.id]: param }), {});
96
77
  }
78
+ // eslint-disable-next-line custom-rules/valid-constructors -- GuStack is the exception as it must take an App
79
+ constructor(scope, id, props) {
80
+ const { cloudFormationStackName = process.env.GU_CFN_STACK_NAME, stack, stage, withoutTags } = props;
81
+ super(scope, id, {
82
+ ...props,
83
+ stackName: cloudFormationStackName,
84
+ // TODO Use `DefaultStackSynthesizer` or create own synthesizer?
85
+ // see https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping.html#bootstrapping-custom-synth
86
+ synthesizer: new aws_cdk_lib_1.LegacyStackSynthesizer(),
87
+ });
88
+ this._stack = stack;
89
+ this._stage = stage.toUpperCase();
90
+ if (!withoutTags) {
91
+ this.addTag(constants_1.TrackingTag.Key, constants_1.TrackingTag.Value);
92
+ this.addTag("Stack", this.stack);
93
+ this.addTag("Stage", this.stage);
94
+ if (this.app) {
95
+ this.addTag("App", this.app);
96
+ }
97
+ this.tryAddRepositoryTag();
98
+ }
99
+ if (!props.withoutMetadata) {
100
+ aws_cdk_lib_1.Aspects.of(this).add(new metadata_1.Metadata(this));
101
+ }
102
+ aws_cdk_lib_1.Aspects.of(this).add(new cfn_include_reporter_1.CfnIncludeReporter());
103
+ aws_cdk_lib_1.Aspects.of(this).add(new cfn_parameter_reporter_1.CfnParameterReporter());
104
+ }
97
105
  /**
98
106
  * Adds a tag to resources in the stack for the repository name.
99
107
  * The value is retrieved in the following order:
@@ -1 +1 @@
1
- {"version":3,"file":"stack.js","sourceRoot":"","sources":["../../../src/constructs/core/stack.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA2G;AAE3G,uDAAkD;AAElD,kEAAwC;AACxC,6EAAwE;AACxE,qDAAkD;AAClD,+CAAyE;AACzE,yCAAqD;AAgCrD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAa,OAAQ,SAAQ,mBAAK;IAwChC,8GAA8G;IAC9G,YAAY,GAAQ,EAAE,EAAU,EAAE,KAAmB;QACnD,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;QAErG,KAAK,CAAC,GAAG,EAAE,EAAE,EAAE;YACb,GAAG,KAAK;YACR,SAAS,EAAE,uBAAuB;YAElC,gEAAgE;YAChE,8FAA8F;YAC9F,WAAW,EAAE,IAAI,oCAAsB,EAAE;SAC1C,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QAElC,IAAI,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CAAC,CAAC;IACpE,CAAC;CACF;AATD,gEASC","sourcesContent":["import { Annotations, App, Aspects, CfnParameter, LegacyStackSynthesizer, Stack, Tags } from \"aws-cdk-lib\";\nimport type { CfnElement, StackProps } from \"aws-cdk-lib\";\nimport { Template } from \"aws-cdk-lib/assertions\";\nimport type { IConstruct } from \"constructs\";\nimport gitUrlParse from \"git-url-parse\";\nimport { CfnIncludeReporter } from \"../../aspects/cfn-include-reporter\";\nimport { Metadata } from \"../../aspects/metadata\";\nimport { ContextKeys, MetadataKeys, TrackingTag } from \"../../constants\";\nimport { gitRemoteOriginUrl } from \"../../utils/git\";\nimport type { StackStageIdentity } from \"./identity\";\nimport type { GuStaticLogicalId } from \"./migrating\";\n\nexport interface GuStackProps extends Omit<StackProps, \"stackName\"> {\n /**\n * The Guardian stack being used (as defined in your riff-raff.yaml).\n * This will be applied as a tag to all of your resources.\n */\n stack: string;\n\n stage: string;\n\n /**\n * The AWS CloudFormation stack name (as shown in the AWS CloudFormation UI).\n * @defaultValue the `GU_CFN_STACK_NAME` environment variable\n */\n cloudFormationStackName?: string;\n /**\n * Set this to true to stop the GuStack from tagging all of your AWS resources.\n * This should only be turned on as part of an initial migration from CloudFormation.\n */\n withoutTags?: boolean;\n\n /**\n * Set to disable CDK metadata. Only for internal use (for disabling for some\n * snapshot tests). We rely on tracking data to prioritise future work so\n * please do not override this.\n */\n withoutMetadata?: boolean;\n}\n\n/**\n * GuStack provides the `stack` and `stage` parameters to a template.\n * It also takes the `app` in the constructor.\n *\n * GuStack will add the Stack, Stage and App tags to all resources.\n *\n * GuStack also adds the tag `X-Gu-CDK-Version`.\n * This tag allows us to measure adoption of this library.\n * It's value is the version of guardian/cdk being used, as defined in `package.json`.\n * As a result, the change sets between version numbers will be fairly noisy,\n * as all resources receive a tag update.\n * It is recommended to upgrade the version of @guardian/cdk being used in two steps:\n * 1. Bump the library, apply the tag updates\n * 2. Make any other stack changes\n *\n * Typical usage is to extend GuStack:\n *\n * ```typescript\n * class MyStack extends GuStack {\n * constructor(scope: App, id: string, props: GuStackProps) {\n * super(scope, id, props)\n * }\n *\n * // add resources here\n * }\n * ```\n */\nexport class GuStack extends Stack implements StackStageIdentity {\n private readonly _stack: string;\n private readonly _stage: string;\n\n get stage(): string {\n return this._stage;\n }\n\n get stack(): string {\n return this._stack;\n }\n\n /**\n * A helper function to add a tag to all resources in a stack.\n *\n * Note: tags will be listed in alphabetical order during synthesis.\n *\n * @param key the tag name\n * @param value the value of the tag\n * @param applyToLaunchedInstances whether or not to apply the tag to instances launched in an ASG.\n * @protected\n */\n protected addTag(key: string, value: string, applyToLaunchedInstances: boolean = true): void {\n // TODO add validation for `key` and `value`\n // see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html\n Tags.of(this).add(key, value, { applyToLaunchedInstances });\n }\n\n /**\n * Returns all the parameters on this stack.\n *\n * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html\n */\n get parameters(): Record<string, CfnParameter> {\n return this.node\n .findAll()\n .filter((construct) => construct instanceof CfnParameter)\n .reduce((acc, param) => ({ ...acc, [param.node.id]: param as CfnParameter }), {});\n }\n\n // eslint-disable-next-line custom-rules/valid-constructors -- GuStack is the exception as it must take an App\n constructor(app: App, id: string, props: GuStackProps) {\n const { cloudFormationStackName = process.env.GU_CFN_STACK_NAME, stack, stage, withoutTags } = props;\n\n super(app, id, {\n ...props,\n stackName: cloudFormationStackName,\n\n // TODO Use `DefaultStackSynthesizer` or create own synthesizer?\n // see https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping.html#bootstrapping-custom-synth\n synthesizer: new LegacyStackSynthesizer(),\n });\n\n this._stack = stack;\n this._stage = stage.toUpperCase();\n\n if (!withoutTags) {\n this.addTag(TrackingTag.Key, TrackingTag.Value);\n\n this.addTag(\"Stack\", this.stack);\n this.addTag(\"Stage\", this.stage);\n\n this.tryAddRepositoryTag();\n }\n\n if (!props.withoutMetadata) {\n Aspects.of(this).add(new Metadata(this));\n }\n\n Aspects.of(this).add(new CfnIncludeReporter());\n }\n\n /**\n * Adds a tag to resources in the stack for the repository name.\n * The value is retrieved in the following order:\n * 1. From the context\n * 2. From git config\n *\n * @private\n */\n private tryAddRepositoryTag(): void {\n try {\n const urlFromContext = this.node.tryGetContext(ContextKeys.REPOSITORY_URL) as string | undefined;\n const repositoryUrl: string = urlFromContext ?? gitRemoteOriginUrl();\n const repositoryName = gitUrlParse(repositoryUrl).full_name;\n this.addTag(MetadataKeys.REPOSITORY_NAME, repositoryName);\n } catch {\n console.info(\n `Unable to find git repository name. Set the ${ContextKeys.REPOSITORY_URL} context value or configure a git remote`\n );\n }\n }\n\n /**\n * Override the auto-generated logical ID for a resource, in the generated CloudFormation template, with a static one.\n *\n * Of particular use when migrating a JSON/YAML CloudFormation template into GuCDK.\n * It's generally advised to retain the logical ID for stateful resources, such as databases or buckets.\n *\n * Let's say we have a YAML template:\n *\n * ```yaml\n * AWSTemplateFormatVersion: '2010-09-09'\n * Resources:\n * UsesTable:\n * Type: AWS::DynamoDB::Table\n * Properties:\n * TableName: !Sub 'users-${stage}'\n * ```\n *\n * When moving to GuCDK we'll have this:\n *\n * class MyStack extends GuStack {\n * constructor(app: App, id: string, props: GuStackProps) {\n * super(app, id, props);\n *\n * const { stage } = this;\n *\n * new Table(this, \"UsersTable\", {\n * name: `users-${stage}`\n * });\n * }\n * }\n *\n * During synthesis, CDK auto-generates logical IDs, so we'll have a stack with a DynamoDB table named 'UsersTable<SOME GUID>', NOT `UsersTable`.\n * That is, the `UsersTable` table will be deleted.\n *\n * In order to retain the original ID from the YAML template, we will do:\n *\n * class MyStack extends GuStack {\n * constructor(app: App, id: string, props: GuStackProps) {\n * super(app, id, props);\n *\n * const { stage } = this;\n *\n * const table = new Table(this, \"UsersTable\", {\n * name: `users-${stage}`\n * });\n *\n * this.overrideLogicalId(table, { logicalId: \"UsersTable\", reason: \"Retaining a stateful resource from the YAML template\" });\n * }\n * }\n *\n * @param construct The (stateful) resource to retain the logical ID of.\n * @param logicalId The logical ID of the resource (as defined in the JSON/YAML template.\n * @param reason A small explanation to keep the logical ID. Mainly used to help future developers.\n */\n public overrideLogicalId(construct: IConstruct, { logicalId, reason }: GuStaticLogicalId): void {\n const {\n node: { id, defaultChild },\n } = construct;\n\n (defaultChild as CfnElement).overrideLogicalId(logicalId);\n Annotations.of(construct).addInfo(`Setting logical ID for ${id} to ${logicalId}. Reason: ${reason}`);\n }\n}\n\n/**\n * A GuStack but designed for Stack Set instances.\n *\n * In a stack set application, `GuStackForStackSetInstance` is used to represent the infrastructure to provision in target AWS accounts.\n */\nexport class GuStackForStackSetInstance extends GuStack {\n // eslint-disable-next-line custom-rules/valid-constructors -- GuStackForStackSet should have a unique `App`\n constructor(id: string, props: GuStackProps) {\n super(new App(), id, props);\n }\n\n get cfnJson(): string {\n return JSON.stringify(Template.fromStack(this).toJSON(), null, 2);\n }\n}\n"]}
1
+ {"version":3,"file":"stack.js","sourceRoot":"","sources":["../../../src/constructs/core/stack.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA2G;AAE3G,uDAAkD;AAElD,kEAAwC;AACxC,6EAAwE;AACxE,iFAA4E;AAC5E,qDAAkD;AAClD,+CAAyE;AACzE,yCAAqD;AAqCrD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAa,OAAQ,SAAQ,mBAAK;IAKhC,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;;;;;;;;OASG;IACO,MAAM,CAAC,GAAW,EAAE,KAAa,EAAE,2BAAoC,IAAI;QACnF,4CAA4C;QAC5C,wGAAwG;QACxG,kBAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,E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AAE,CAAC,CAAC;IACvG,CAAC;CACF;AApKD,0BAoKC;AAED;;;;GAIG;AACH,MAAa,0BAA2B,SAAQ,OAAO;IACrD,4GAA4G;IAC5G,YAAY,EAAU,EAAE,KAAmB;QACzC,KAAK,CAAC,IAAI,iBAAG,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,SAAS,CAAC,qBAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACpE,CAAC;CACF;AATD,gEASC","sourcesContent":["import { Annotations, App, Aspects, CfnParameter, LegacyStackSynthesizer, Stack, Tags } from \"aws-cdk-lib\";\nimport type { CfnElement, StackProps } from \"aws-cdk-lib\";\nimport { Template } from \"aws-cdk-lib/assertions\";\nimport type { IConstruct } from \"constructs\";\nimport gitUrlParse from \"git-url-parse\";\nimport { CfnIncludeReporter } from \"../../aspects/cfn-include-reporter\";\nimport { CfnParameterReporter } from \"../../aspects/cfn-parameter-reporter\";\nimport { Metadata } from \"../../aspects/metadata\";\nimport { ContextKeys, MetadataKeys, TrackingTag } from \"../../constants\";\nimport { gitRemoteOriginUrl } from \"../../utils/git\";\nimport type { StackStageIdentity } from \"./identity\";\nimport type { GuStaticLogicalId } from \"./migrating\";\n\nexport interface GuStackProps extends Omit<StackProps, \"stackName\"> {\n /**\n * The Guardian stack being used (as defined in your riff-raff.yaml).\n * This will be applied as a tag to all of your resources.\n */\n stack: string;\n\n stage: string;\n\n /**\n * Optional name of the app. If defined, all resources will have an App tag.\n */\n app?: string;\n\n /**\n * The AWS CloudFormation stack name (as shown in the AWS CloudFormation UI).\n * @defaultValue the `GU_CFN_STACK_NAME` environment variable\n */\n cloudFormationStackName?: string;\n /**\n * Set this to true to stop the GuStack from tagging all of your AWS resources.\n * This should only be turned on as part of an initial migration from CloudFormation.\n */\n withoutTags?: boolean;\n\n /**\n * Set to disable CDK metadata. Only for internal use (for disabling for some\n * snapshot tests). We rely on tracking data to prioritise future work so\n * please do not override this.\n */\n withoutMetadata?: boolean;\n}\n\n/**\n * GuStack provides the `stack` and `stage` parameters to a template.\n * It also takes the `app` in the constructor.\n *\n * GuStack will add the Stack, Stage and App tags to all resources.\n *\n * GuStack also adds the tag `X-Gu-CDK-Version`.\n * This tag allows us to measure adoption of this library.\n * It's value is the version of guardian/cdk being used, as defined in `package.json`.\n * As a result, the change sets between version numbers will be fairly noisy,\n * as all resources receive a tag update.\n * It is recommended to upgrade the version of @guardian/cdk being used in two steps:\n * 1. Bump the library, apply the tag updates\n * 2. Make any other stack changes\n *\n * Typical usage is to extend GuStack:\n *\n * ```typescript\n * class MyStack extends GuStack {\n * constructor(scope: App, id: string, props: GuStackProps) {\n * super(scope, id, props)\n * }\n *\n * // add resources here\n * }\n * ```\n */\nexport class GuStack extends Stack implements StackStageIdentity {\n private readonly _stack: string;\n private readonly _stage: string;\n private readonly _app?: string;\n\n get stage(): string {\n return this._stage;\n }\n\n get stack(): string {\n return this._stack;\n }\n\n get app(): string | undefined {\n return this._app;\n }\n\n /**\n * A helper function to add a tag to all resources in a stack.\n *\n * Note: tags will be listed in alphabetical order during synthesis.\n *\n * @param key the tag name\n * @param value the value of the tag\n * @param applyToLaunchedInstances whether or not to apply the tag to instances launched in an ASG.\n * @protected\n */\n protected addTag(key: string, value: string, applyToLaunchedInstances: boolean = true): void {\n // TODO add validation for `key` and `value`\n // see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html\n Tags.of(this).add(key, value, { applyToLaunchedInstances });\n }\n\n /**\n * Returns all the parameters on this stack.\n *\n * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html\n */\n get parameters(): Record<string, CfnParameter> {\n return this.node\n .findAll()\n .filter((construct) => construct instanceof CfnParameter)\n .reduce((acc, param) => ({ ...acc, [param.node.id]: param as CfnParameter }), {});\n }\n\n // eslint-disable-next-line custom-rules/valid-constructors -- GuStack is the exception as it must take an App\n constructor(scope: App, id: string, props: GuStackProps) {\n const { cloudFormationStackName = process.env.GU_CFN_STACK_NAME, stack, stage, withoutTags } = props;\n\n super(scope, id, {\n ...props,\n stackName: cloudFormationStackName,\n\n // TODO Use `DefaultStackSynthesizer` or create own synthesizer?\n // see https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping.html#bootstrapping-custom-synth\n synthesizer: new LegacyStackSynthesizer(),\n });\n\n this._stack = stack;\n this._stage = stage.toUpperCase();\n\n if (!withoutTags) {\n this.addTag(TrackingTag.Key, TrackingTag.Value);\n\n this.addTag(\"Stack\", this.stack);\n this.addTag(\"Stage\", this.stage);\n if (this.app) {\n this.addTag(\"App\", this.app);\n }\n\n this.tryAddRepositoryTag();\n }\n\n if (!props.withoutMetadata) {\n Aspects.of(this).add(new Metadata(this));\n }\n\n Aspects.of(this).add(new CfnIncludeReporter());\n Aspects.of(this).add(new CfnParameterReporter());\n }\n\n /**\n * Adds a tag to resources in the stack for the repository name.\n * The value is retrieved in the following order:\n * 1. From the context\n * 2. From git config\n *\n * @private\n */\n private tryAddRepositoryTag(): void {\n try {\n const urlFromContext = this.node.tryGetContext(ContextKeys.REPOSITORY_URL) as string | undefined;\n const repositoryUrl: string = urlFromContext ?? gitRemoteOriginUrl();\n const repositoryName = gitUrlParse(repositoryUrl).full_name;\n this.addTag(MetadataKeys.REPOSITORY_NAME, repositoryName);\n } catch {\n console.info(\n `Unable to find git repository name. Set the ${ContextKeys.REPOSITORY_URL} context value or configure a git remote`\n );\n }\n }\n\n /**\n * Override the auto-generated logical ID for a resource, in the generated CloudFormation template, with a static one.\n *\n * Of particular use when migrating a JSON/YAML CloudFormation template into GuCDK.\n * It's generally advised to retain the logical ID for stateful resources, such as databases or buckets.\n *\n * Let's say we have a YAML template:\n *\n * ```yaml\n * AWSTemplateFormatVersion: '2010-09-09'\n * Resources:\n * UsesTable:\n * Type: AWS::DynamoDB::Table\n * Properties:\n * TableName: !Sub 'users-${stage}'\n * ```\n *\n * When moving to GuCDK we'll have this:\n *\n * class MyStack extends GuStack {\n * constructor(app: App, id: string, props: GuStackProps) {\n * super(app, id, props);\n *\n * const { stage } = this;\n *\n * new Table(this, \"UsersTable\", {\n * name: `users-${stage}`\n * });\n * }\n * }\n *\n * During synthesis, CDK auto-generates logical IDs, so we'll have a stack with a DynamoDB table named 'UsersTable<SOME GUID>', NOT `UsersTable`.\n * That is, the `UsersTable` table will be deleted.\n *\n * In order to retain the original ID from the YAML template, we will do:\n *\n * class MyStack extends GuStack {\n * constructor(app: App, id: string, props: GuStackProps) {\n * super(app, id, props);\n *\n * const { stage } = this;\n *\n * const table = new Table(this, \"UsersTable\", {\n * name: `users-${stage}`\n * });\n *\n * this.overrideLogicalId(table, { logicalId: \"UsersTable\", reason: \"Retaining a stateful resource from the YAML template\" });\n * }\n * }\n *\n * @param construct The (stateful) resource to retain the logical ID of.\n * @param logicalId The logical ID of the resource (as defined in the JSON/YAML template.\n * @param reason A small explanation to keep the logical ID. Mainly used to help future developers.\n */\n public overrideLogicalId(construct: IConstruct, { logicalId, reason }: GuStaticLogicalId): void {\n const {\n node: { id, defaultChild },\n } = construct;\n\n (defaultChild as CfnElement).overrideLogicalId(logicalId);\n Annotations.of(construct).addInfo(`Setting logical ID for ${id} to ${logicalId}. Reason: ${reason}`);\n }\n}\n\n/**\n * A GuStack but designed for Stack Set instances.\n *\n * In a stack set application, `GuStackForStackSetInstance` is used to represent the infrastructure to provision in target AWS accounts.\n */\nexport class GuStackForStackSetInstance extends GuStack {\n // eslint-disable-next-line custom-rules/valid-constructors -- GuStackForStackSet should have a unique `App`\n constructor(id: string, props: GuStackProps) {\n super(new App(), id, props);\n }\n\n get cfnJson(): string {\n return JSON.stringify(Template.fromStack(this).toJSON(), null, 2);\n }\n}\n"]}
@@ -22,7 +22,7 @@ class GuDnsRecordSet extends constructs_1.Construct {
22
22
  `id`, by definition, must be unique. `name` represents a fully qualified domain name, which must also be unique.
23
23
  `id` being given to the level 1 construct means it also becomes the logicalId in the template.
24
24
  */
25
- const level2ConstructId = name;
25
+ const level2ConstructId = `${name}-DnsRecordSet`;
26
26
  const level1ConstructId = id;
27
27
  super(scope, level2ConstructId);
28
28
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- more `RecordType`s will be added soon!
@@ -1 +1 @@
1
- {"version":3,"file":"dns-records.js","sourceRoot":"","sources":["../../../src/constructs/dns/dns-records.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAC1C,2CAAuC;AAIvC,IAAY,UAEX;AAFD,WAAY,UAAU;IACpB,6BAAe,CAAA;AACjB,CAAC,EAFW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAErB;AASD;;;;;GAKG;AACH,MAAa,cAAe,SAAQ,sBAAS;IAC3C,YAAY,KAAc,EAAE,EAAU,EAAE,KAA0B;QAChE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;QACzD,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;QAExB;;;;WAIG;QACH,MAAM,iBAAiB,GAAG,IAAI,CAAC;QAC/B,MAAM,iBAAiB,GAAG,EAAE,CAAC;QAE7B,KAAK,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;QAEhC,iHAAiH;QACjH,IAAI,UAAU,KAAK,UAAU,CAAC,KAAK,EAAE;YACnC;;;;;;;;eAQG;YACH,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE;gBAChC,MAAM,IAAI,KAAK,CACb,qHAAqH,CACtH,CAAC;aACH;SACF;QAED,6DAA6D;QAC7D,gHAAgH;QAChH,IAAI,yBAAW,CAAC,KAAK,EAAE,iBAAiB,EAAE;YACxC,IAAI,EAAE,0BAA0B;YAChC,UAAU,EAAE;gBACV,IAAI,EAAE,IAAI;gBACV,eAAe,EAAE,eAAe;gBAChC,UAAU,EAAE,UAAU;gBACtB,GAAG,EAAE,GAAG,CAAC,SAAS,EAAE;gBACpB,KAAK,EAAE,KAAK;aACb;SACF,CAAC,CAAC;IACL,CAAC;CACF;AA9CD,wCA8CC;AASD;;;;GAIG;AACH,MAAa,OAAQ,SAAQ,cAAc;IACzC,YAAY,KAAc,EAAE,EAAU,EAAE,KAAmB;QACzD,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;QAExD,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE;YACf,IAAI;YACJ,UAAU,EAAE,UAAU,CAAC,KAAK;YAC5B,eAAe,EAAE,CAAC,cAAc,CAAC;YACjC,GAAG;SACJ,CAAC,CAAC;IACL,CAAC;CACF;AAXD,0BAWC","sourcesContent":["import type { Duration } from \"aws-cdk-lib\";\nimport { CfnResource } from \"aws-cdk-lib\";\nimport { Construct } from \"constructs\";\nimport type { GuDomainName } from \"../../types\";\nimport type { AppIdentity, GuStack } from \"../core\";\n\nexport enum RecordType {\n CNAME = \"CNAME\",\n}\n\nexport interface GuDnsRecordSetProps {\n name: string;\n recordType: RecordType;\n resourceRecords: string[];\n ttl: Duration;\n}\n\n/**\n * This construct can be used to create DNS records in NS1.\n *\n * Prefer to use [[`GuCname`]] when creating a CNAME for a load balancer,\n * as this requires less boilerplate.\n */\nexport class GuDnsRecordSet extends Construct {\n constructor(scope: GuStack, id: string, props: GuDnsRecordSetProps) {\n const { name, recordType, resourceRecords, ttl } = props;\n const { stage } = scope;\n\n /*\n Nodes in the CDK tree must have a unique ID. This class adds two nodes to the tree, so we have two IDs.\n `id`, by definition, must be unique. `name` represents a fully qualified domain name, which must also be unique.\n `id` being given to the level 1 construct means it also becomes the logicalId in the template.\n */\n const level2ConstructId = name;\n const level1ConstructId = id;\n\n super(scope, level2ConstructId);\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- more `RecordType`s will be added soon!\n if (recordType === RecordType.CNAME) {\n /*\n If you try to create a CNAME with multiple records within NS1, you are greeted with:\n\n According to RFC, a CNAME record should not return multiple answers.\n Doing so may cause problems during resolution.\n If you want to use multiple answers, you should ensure you have the correct filters in place (such as SELECT_FIRST_N 1) to limit them to a single answer at resolution time.\n\n `Guardian::DNS::RecordSet` does not implement \"correct filters\", so fail fast by throwing.\n */\n if (resourceRecords.length !== 1) {\n throw new Error(\n \"According to RFC, a CNAME record should not return multiple answers. Doing so may cause problems during resolution.\"\n );\n }\n }\n\n // The spec for this private resource type can be found here:\n // https://github.com/guardian/cfn-private-resource-types/tree/main/dns/guardian-dns-record-set-type/docs#syntax\n new CfnResource(scope, level1ConstructId, {\n type: \"Guardian::DNS::RecordSet\",\n properties: {\n Name: name,\n ResourceRecords: resourceRecords,\n RecordType: recordType,\n TTL: ttl.toSeconds(),\n Stage: stage,\n },\n });\n }\n}\n\nexport interface GuCnameProps extends GuDomainName, AppIdentity {\n /** The record your CNAME should point to, for example your Load Balancer DNS name */\n resourceRecord: string;\n /** The time to live for the DNS record */\n ttl: Duration;\n}\n\n/**\n * Construct for creating CNAME records in NS1.\n *\n * See [[`GuCnameProps`]] for configuration options.\n */\nexport class GuCname extends GuDnsRecordSet {\n constructor(scope: GuStack, id: string, props: GuCnameProps) {\n const { domainName: name, resourceRecord, ttl } = props;\n\n super(scope, id, {\n name,\n recordType: RecordType.CNAME,\n resourceRecords: [resourceRecord],\n ttl,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"dns-records.js","sourceRoot":"","sources":["../../../src/constructs/dns/dns-records.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAC1C,2CAAuC;AAIvC,IAAY,UAEX;AAFD,WAAY,UAAU;IACpB,6BAAe,CAAA;AACjB,CAAC,EAFW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAErB;AASD;;;;;GAKG;AACH,MAAa,cAAe,SAAQ,sBAAS;IAC3C,YAAY,KAAc,EAAE,EAAU,EAAE,KAA0B;QAChE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;QACzD,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;QAExB;;;;WAIG;QACH,MAAM,iBAAiB,GAAG,GAAG,IAAI,eAAe,CAAC;QACjD,MAAM,iBAAiB,GAAG,EAAE,CAAC;QAE7B,KAAK,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;QAEhC,iHAAiH;QACjH,IAAI,UAAU,KAAK,UAAU,CAAC,KAAK,EAAE;YACnC;;;;;;;;eAQG;YACH,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE;gBAChC,MAAM,IAAI,KAAK,CACb,qHAAqH,CACtH,CAAC;aACH;SACF;QAED,6DAA6D;QAC7D,gHAAgH;QAChH,IAAI,yBAAW,CAAC,KAAK,EAAE,iBAAiB,EAAE;YACxC,IAAI,EAAE,0BAA0B;YAChC,UAAU,EAAE;gBACV,IAAI,EAAE,IAAI;gBACV,eAAe,EAAE,eAAe;gBAChC,UAAU,EAAE,UAAU;gBACtB,GAAG,EAAE,GAAG,CAAC,SAAS,EAAE;gBACpB,KAAK,EAAE,KAAK;aACb;SACF,CAAC,CAAC;IACL,CAAC;CACF;AA9CD,wCA8CC;AASD;;;;GAIG;AACH,MAAa,OAAQ,SAAQ,cAAc;IACzC,YAAY,KAAc,EAAE,EAAU,EAAE,KAAmB;QACzD,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;QAExD,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE;YACf,IAAI;YACJ,UAAU,EAAE,UAAU,CAAC,KAAK;YAC5B,eAAe,EAAE,CAAC,cAAc,CAAC;YACjC,GAAG;SACJ,CAAC,CAAC;IACL,CAAC;CACF;AAXD,0BAWC","sourcesContent":["import type { Duration } from \"aws-cdk-lib\";\nimport { CfnResource } from \"aws-cdk-lib\";\nimport { Construct } from \"constructs\";\nimport type { GuDomainName } from \"../../types\";\nimport type { AppIdentity, GuStack } from \"../core\";\n\nexport enum RecordType {\n CNAME = \"CNAME\",\n}\n\nexport interface GuDnsRecordSetProps {\n name: string;\n recordType: RecordType;\n resourceRecords: string[];\n ttl: Duration;\n}\n\n/**\n * This construct can be used to create DNS records in NS1.\n *\n * Prefer to use [[`GuCname`]] when creating a CNAME for a load balancer,\n * as this requires less boilerplate.\n */\nexport class GuDnsRecordSet extends Construct {\n constructor(scope: GuStack, id: string, props: GuDnsRecordSetProps) {\n const { name, recordType, resourceRecords, ttl } = props;\n const { stage } = scope;\n\n /*\n Nodes in the CDK tree must have a unique ID. This class adds two nodes to the tree, so we have two IDs.\n `id`, by definition, must be unique. `name` represents a fully qualified domain name, which must also be unique.\n `id` being given to the level 1 construct means it also becomes the logicalId in the template.\n */\n const level2ConstructId = `${name}-DnsRecordSet`;\n const level1ConstructId = id;\n\n super(scope, level2ConstructId);\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- more `RecordType`s will be added soon!\n if (recordType === RecordType.CNAME) {\n /*\n If you try to create a CNAME with multiple records within NS1, you are greeted with:\n\n According to RFC, a CNAME record should not return multiple answers.\n Doing so may cause problems during resolution.\n If you want to use multiple answers, you should ensure you have the correct filters in place (such as SELECT_FIRST_N 1) to limit them to a single answer at resolution time.\n\n `Guardian::DNS::RecordSet` does not implement \"correct filters\", so fail fast by throwing.\n */\n if (resourceRecords.length !== 1) {\n throw new Error(\n \"According to RFC, a CNAME record should not return multiple answers. Doing so may cause problems during resolution.\"\n );\n }\n }\n\n // The spec for this private resource type can be found here:\n // https://github.com/guardian/cfn-private-resource-types/tree/main/dns/guardian-dns-record-set-type/docs#syntax\n new CfnResource(scope, level1ConstructId, {\n type: \"Guardian::DNS::RecordSet\",\n properties: {\n Name: name,\n ResourceRecords: resourceRecords,\n RecordType: recordType,\n TTL: ttl.toSeconds(),\n Stage: stage,\n },\n });\n }\n}\n\nexport interface GuCnameProps extends GuDomainName, AppIdentity {\n /** The record your CNAME should point to, for example your Load Balancer DNS name */\n resourceRecord: string;\n /** The time to live for the DNS record */\n ttl: Duration;\n}\n\n/**\n * Construct for creating CNAME records in NS1.\n *\n * See [[`GuCnameProps`]] for configuration options.\n */\nexport class GuCname extends GuDnsRecordSet {\n constructor(scope: GuStack, id: string, props: GuCnameProps) {\n const { domainName: name, resourceRecord, ttl } = props;\n\n super(scope, id, {\n name,\n recordType: RecordType.CNAME,\n resourceRecords: [resourceRecord],\n ttl,\n });\n }\n}\n"]}
@@ -3,7 +3,7 @@ import type { GuStack } from "../core";
3
3
  interface VpcFromIdProps extends Omit<VpcAttributes, "availabilityZones"> {
4
4
  availabilityZones?: string[];
5
5
  }
6
- declare type VpcFromIdParameterProps = Omit<VpcFromIdProps, "vpcId">;
6
+ type VpcFromIdParameterProps = Omit<VpcFromIdProps, "vpcId">;
7
7
  export declare enum SubnetType {
8
8
  PUBLIC = "Public",
9
9
  PRIVATE = "Private"
@@ -1 +1 @@
1
- {"version":3,"file":"vpc.d.ts","sourceRoot":"","sources":["../../../src/constructs/ec2/vpc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAExE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,UAAU,cAAe,SAAQ,IAAI,CAAC,aAAa,EAAE,mBAAmB,CAAC;IACvE,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,aAAK,uBAAuB,GAAG,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;AAG7D,oBAAY,UAAU;IACpB,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAGD,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAMD,eAAO,MAAM,QAAQ,WAAY;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,KAAG,MAA0B,CAAC;AAE/E,qB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,CAAC,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,aAAa,GAAG,OAAO,EAAE;IAc7E,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI;IAOtE,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,uBAAuB,GAAG,IAAI;CAI1F"}
@@ -29,17 +29,17 @@ import { AppIdentity } from "../core";
29
29
  * }
30
30
  * ```
31
31
  */
32
- export declare type RepositoryContainer = {
32
+ export type RepositoryContainer = {
33
33
  repository: IRepository;
34
34
  version: string;
35
35
  type: "repository";
36
36
  };
37
- export declare type RegistryContainer = {
37
+ export type RegistryContainer = {
38
38
  id?: string;
39
39
  type: "registry";
40
40
  };
41
- export declare type ContainerConfiguration = RepositoryContainer | RegistryContainer;
42
- export declare type GuEcsTaskMonitoringProps = {
41
+ export type ContainerConfiguration = RepositoryContainer | RegistryContainer;
42
+ export type GuEcsTaskMonitoringProps = {
43
43
  snsTopicArn: string;
44
44
  noMonitoring: false;
45
45
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ecs-task.d.ts","sourceRoot":"","sources":["../../../src/constructs/ecs/ecs-task.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AASvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAsB,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAEnF,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM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,EAAE,MAAM,CAAC;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uBAAuB,EAAE,YAAY,GAAG,wBAAwB,CAAC;IACjE,cAAc,CAAC,EAAE,cAAc,EAAE,CAAC;IAClC,kBAAkB,CAAC,EAAE,eAAe,EAAE,CAAC;IACvC,oBAAoB,CAAC,EAAE,uBAAuB,EAAE,CAAC;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAcD;;;;;;;;;GASG;AACH,qBAAa,SAAU,SAAQ,SAAS;IACtC,YAAY,EAAE,YAAY,CAAC;gBAEf,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc;CAiI9D"}
@@ -1,8 +1,8 @@
1
1
  import { Policy } from "aws-cdk-lib/aws-iam";
2
2
  import type { PolicyProps } from "aws-cdk-lib/aws-iam";
3
3
  import type { GuStack } from "../../core";
4
- export declare type GuPolicyProps = PolicyProps;
5
- export declare type GuNoStatementsPolicyProps = Omit<GuPolicyProps, "statements">;
4
+ export type GuPolicyProps = PolicyProps;
5
+ export type GuNoStatementsPolicyProps = Omit<GuPolicyProps, "statements">;
6
6
  export declare class GuPolicy extends Policy {
7
7
  constructor(scope: GuStack, id: string, props: GuPolicyProps);
8
8
  }
@@ -10,7 +10,7 @@ export interface GuAllowPolicyProps extends GuNoStatementsPolicyProps {
10
10
  actions: string[];
11
11
  resources: string[];
12
12
  }
13
- export declare type GuDenyPolicyProps = GuAllowPolicyProps;
13
+ export type GuDenyPolicyProps = GuAllowPolicyProps;
14
14
  export declare class GuAllowPolicy extends GuPolicy {
15
15
  constructor(scope: GuStack, id: string, props: GuAllowPolicyProps);
16
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"base-policy.d.ts","sourceRoot":"","sources":["../../../../src/constructs/iam/policies/base-policy.ts"],"names":[],"mappings":"AAAA,OAA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AAK,EAAE,aAAa;CAG7D;AAED,MAAM,WAAW,kBAAmB,SAAQ,yBAAyB;IACnE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AACD,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAEnD,qBAAa,aAAc,SAAQ,QAAQ;gBAC7B,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB;CAWlE;AAED,qBAAa,YAAa,SAAQ,QAAQ;gBAC5B,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB;CAWjE"}
@@ -11,7 +11,7 @@ export interface GuInstanceRoleProps {
11
11
  withoutLogShipping?: boolean;
12
12
  additionalPolicies?: GuPolicy[];
13
13
  }
14
- export declare type GuInstanceRolePropsWithApp = GuInstanceRoleProps & AppIdentity;
14
+ export type GuInstanceRolePropsWithApp = GuInstanceRoleProps & AppIdentity;
15
15
  declare const GuInstanceRole_base: {
16
16
  new (...args: any[]): {
17
17
  readonly idWithApp: string;
@@ -1 +1 @@
1
- {"version":3,"file":"instance-role.d.ts","sourceRoot":"","sources":["../../../../src/constructs/iam/roles/instance-role.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAQvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,kBAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC;CACjC;AAED,oBAAY,0BAA0B,GAAG,mBAAmB,GAAG,WAAW,CAAC;;;;;;AAE3E;;;;;;;;;;;;;;GAcG;AACH,qBAAa,cAAe,SAAQ,mBAA2B;gBACjD,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,0BAA0B;CAsB9D"}
1
+ {"version":3,"file":"instance-role.d.ts","sourceRoot":"","sources":["../../../../src/constructs/iam/roles/instance-role.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAQvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,kBAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC;CACjC;AAED,MAAM,MAAM,0BAA0B,GAAG,mBAAmB,GAAG,WAAW,CAAC;;;;;;AAE3E;;;;;;;;;;;;;;GAcG;AACH,qBAAa,cAAe,SAAQ,mBAA2B;gBACjD,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,0BAA0B;CAsB9D"}
@@ -1,7 +1,7 @@
1
1
  import { Role } from "aws-cdk-lib/aws-iam";
2
2
  import type { RoleProps } from "aws-cdk-lib/aws-iam";
3
3
  import type { GuStack } from "../../core";
4
- export declare type GuRoleProps = RoleProps;
4
+ export type GuRoleProps = RoleProps;
5
5
  export declare class GuRole extends Role {
6
6
  constructor(scope: GuStack, id: string, props: GuRoleProps);
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"roles.d.ts","sourceRoot":"","sources":["../../../../src/constructs/iam/roles/roles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,oBAAY,WAAW,GAAG,SAAS,CAAC;AAEpC,qBAAa,MAAO,SAAQ,IAAI;gBAClB,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW;CAG3D"}
1
+ {"version":3,"file":"roles.d.ts","sourceRoot":"","sources":["../../../../src/constructs/iam/roles/roles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,MAAM,WAAW,GAAG,SAAS,CAAC;AAEpC,qBAAa,MAAO,SAAQ,IAAI;gBAClB,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW;CAG3D"}
@@ -1,7 +1,7 @@
1
1
  import { Stream } from "aws-cdk-lib/aws-kinesis";
2
2
  import type { StreamProps } from "aws-cdk-lib/aws-kinesis";
3
3
  import type { GuStack } from "../core";
4
- export declare type GuKinesisStreamProps = StreamProps;
4
+ export type GuKinesisStreamProps = StreamProps;
5
5
  /**
6
6
  * Construct which creates a Kinesis stream.
7
7
  *
@@ -1 +1 @@
1
- {"version":3,"file":"kinesis-stream.d.ts","sourceRoot":"","sources":["../../../src/constructs/kinesis/kinesis-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,oBAAY,oBAAoB,GAAG,WAAW,CAAC;AAE/C;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,MAAM;gBAC7B,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,oBAAoB;CAGrE"}
1
+ {"version":3,"file":"kinesis-stream.d.ts","sourceRoot":"","sources":["../../../src/constructs/kinesis/kinesis-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC;AAE/C;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,MAAM;gBAC7B,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,oBAAoB;CAGrE"}
@@ -1,7 +1,7 @@
1
1
  import type { VpcProps } from "aws-cdk-lib/aws-ec2";
2
2
  import { Vpc } from "aws-cdk-lib/aws-ec2";
3
3
  import type { GuStack } from "../core";
4
- export declare type GuVpcProps = VpcProps;
4
+ export type GuVpcProps = VpcProps;
5
5
  /**
6
6
  * Construct which creates a Virtual Private Cloud.
7
7
  *
@@ -1 +1 @@
1
- {"version":3,"file":"vpc.d.ts","sourceRoot":"","sources":["../../../src/constructs/vpc/vpc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAA4C,GAAG,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,oBAAY,UAAU,GAAG,QAAQ,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,qBAAa,KAAM,SAAQ,GAAG;IAC5B;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,CAAC,0BAA0B;gBAc7B,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,UAAU;CA4B3D"}
1
+ {"version":3,"file":"vpc.d.ts","sourceRoot":"","sources":["../../../src/constructs/vpc/vpc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAA4C,GAAG,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,qBAAa,KAAM,SAAQ,GAAG;IAC5B;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,CAAC,0BAA0B;gBAc7B,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,UAAU;CA4B3D"}
@@ -79,7 +79,7 @@ class GuVpc extends aws_ec2_1.Vpc {
79
79
  },
80
80
  {
81
81
  name: "application",
82
- subnetType: aws_ec2_1.SubnetType.PRIVATE_WITH_NAT,
82
+ subnetType: aws_ec2_1.SubnetType.PRIVATE_WITH_EGRESS,
83
83
  },
84
84
  ],
85
85
  };
@@ -1 +1 @@
1
- {"version":3,"file":"vpc.js","sourceRoot":"","sources":["../../../src/constructs/vpc/vpc.ts"],"names":[],"mappings":";;;AAAA,6CAAoC;AAEpC,iDAAoF;AAKpF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAa,KAAM,SAAQ,aAAG;IAC5B;;;;;;;OAOG;IACK,MAAM,CAAC,0BAA0B,CAAC,EAAE,OAAO,EAAE,IAAI,EAAW;QAClE,IAAI,mBAAK,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE;YAC/B,MAAM,IAAI,KAAK,CACb,8JAA8J,CAC/J,CAAC;SACH;QAED,IAAI,CAAC,UAAU,CAAC,8BAA8B,OAAO,mBAAmB,EAAE;YACxE,YAAY;YACZ,YAAY;YACZ,YAAY;SACb,CAAC,CAAC;IACL,CAAC;IAED,YAAY,KAAc,EAAE,EAAU,EAAE,KAAkB;QACxD,MAAM,eAAe,GAAa;YAChC,gBAAgB,EAAE;gBAChB,EAAE,EAAE;oBACF,OAAO,EAAE,sCAA4B,CAAC,EAAE;iBACzC;gBACD,QAAQ,EAAE;oBACR,OAAO,EAAE,sCAA4B,CAAC,QAAQ;iBAC/C;aACF;YAED,mBAAmB,EAAE;gBACnB;oBACE,IAAI,EAAE,SAAS;oBACf,UAAU,EAAE,oBAAU,CAAC,MAAM;iBAC9B;gBACD;oBACE,IAAI,EAAE,aAAa;oBACnB,UAAU,EAAE,oBAAU,CAAC,gBAAgB;iBACxC;aACF;SACF,CAAC;QAEF,8GAA8G;QAC9G,KAAK,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC;QAExC,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,GAAG,eAAe,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IACrD,CAAC;CACF;AAnDD,sBAmDC","sourcesContent":["import { Token } from \"aws-cdk-lib\";\nimport type { VpcProps } from \"aws-cdk-lib/aws-ec2\";\nimport { GatewayVpcEndpointAwsService, SubnetType, Vpc } from \"aws-cdk-lib/aws-ec2\";\nimport type { GuStack } from \"../core\";\n\nexport type GuVpcProps = VpcProps;\n\n/**\n * Construct which creates a Virtual Private Cloud.\n *\n * NOTE: This construct requires an\n * [environment](https://docs.aws.amazon.com/cdk/latest/guide/environments.html)\n * to be set to function correctly. Without this, an environment-agnostic\n * template will be produced, which will only use two AZs even if the region\n * contains more than that. To set this, set the `env` prop when instantiating\n * your stack.\n *\n * NOTE: If using this construct outside eu-west-1, you'll need to commit the\n * `cdk.context.json` file that's created after synthesising locally.\n *\n * Be aware that account IDs are considered sensitive information and should NOT\n * be committed to public repos.\n *\n * The VPC is provisioned with a public and private subnet for each availability\n * zone, with IPs spread evenly across these. Instances in private subnets\n * cannot be accessed directly over the internet. You should locate services in\n * instances in the private subnets, and provide HTTP(S) as required via load\n * balancers living in the public subnets.\n *\n * A CIDR block is a combined IP and network mask that specifies the IP\n * addresses in your VPC. For testing purposes any (AWS supported) CIDR block\n * will do, but for production you should:\n *\n * - use a /21 network mask (providing up to 2048 IPs, which is plenty for most\n * accounts)\n * - ask Enterprise Tech for an IP address to go with this range (so that\n * peering with other company VPCs is possible without IP clashes)\n *\n * A managed NAT is created for each private subnet to allow access to the\n * internet.\n *\n * For recommendations on how best to configure your VPC see:\n * https://github.com/guardian/recommendations/blob/main/AWS.md#vpc\n *\n * For more information on VPCs and AWS see:\n * https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html.\n */\nexport class GuVpc extends Vpc {\n /**\n * Programmatically sets the CDK context with a list of AZs for eu-west-1.\n * This means consuming stacks do NOT have to commit a `cdk.context.json`\n * file when using this construct in eu-west-1.\n *\n * @throws {Error} if the account ID has not been explicitly set on the parent GuStack\n * @private\n */\n private static setAvailabilityZoneContext({ account, node }: GuStack) {\n if (Token.isUnresolved(account)) {\n throw new Error(\n `Account ID not set - the resulting VPC might not be shaped how you'd expect. See https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.StackProps.html#env`\n );\n }\n\n node.setContext(`availability-zones:account=${account}:region=eu-west-1`, [\n \"eu-west-1a\",\n \"eu-west-1b\",\n \"eu-west-1c\",\n ]);\n }\n\n constructor(scope: GuStack, id: string, props?: GuVpcProps) {\n const defaultVpcProps: VpcProps = {\n gatewayEndpoints: {\n s3: {\n service: GatewayVpcEndpointAwsService.S3,\n },\n dynamodb: {\n service: GatewayVpcEndpointAwsService.DYNAMODB,\n },\n },\n\n subnetConfiguration: [\n {\n name: \"ingress\",\n subnetType: SubnetType.PUBLIC,\n },\n {\n name: \"application\",\n subnetType: SubnetType.PRIVATE_WITH_NAT,\n },\n ],\n };\n\n // Set the context BEFORE the `super` call to avoid `Error: Cannot set context after children have been added`\n GuVpc.setAvailabilityZoneContext(scope);\n\n super(scope, id, { ...defaultVpcProps, ...props });\n }\n}\n"]}
1
+ {"version":3,"file":"vpc.js","sourceRoot":"","sources":["../../../src/constructs/vpc/vpc.ts"],"names":[],"mappings":";;;AAAA,6CAAoC;AAEpC,iDAAoF;AAKpF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAa,KAAM,SAAQ,aAAG;IAC5B;;;;;;;OAOG;IACK,MAAM,CAAC,0BAA0B,CAAC,EAAE,OAAO,EAAE,IAAI,EAAW;QAClE,IAAI,mBAAK,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE;YAC/B,MAAM,IAAI,KAAK,CACb,8JAA8J,CAC/J,CAAC;SACH;QAED,IAAI,CAAC,UAAU,CAAC,8BAA8B,OAAO,mBAAmB,EAAE;YACxE,YAAY;YACZ,YAAY;YACZ,YAAY;SACb,CAAC,CAAC;IACL,CAAC;IAED,YAAY,KAAc,EAAE,EAAU,EAAE,KAAkB;QACxD,MAAM,eAAe,GAAa;YAChC,gBAAgB,EAAE;gBAChB,EAAE,EAAE;oBACF,OAAO,EAAE,sCAA4B,CAAC,EAAE;iBACzC;gBACD,QAAQ,EAAE;oBACR,OAAO,EAAE,sCAA4B,CAAC,QAAQ;iBAC/C;aACF;YAED,mBAAmB,EAAE;gBACnB;oBACE,IAAI,EAAE,SAAS;oBACf,UAAU,EAAE,oBAAU,CAAC,MAAM;iBAC9B;gBACD;oBACE,IAAI,EAAE,aAAa;oBACnB,UAAU,EAAE,oBAAU,CAAC,mBAAmB;iBAC3C;aACF;SACF,CAAC;QAEF,8GAA8G;QAC9G,KAAK,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC;QAExC,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,GAAG,eAAe,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IACrD,CAAC;CACF;AAnDD,sBAmDC","sourcesContent":["import { Token } from \"aws-cdk-lib\";\nimport type { VpcProps } from \"aws-cdk-lib/aws-ec2\";\nimport { GatewayVpcEndpointAwsService, SubnetType, Vpc } from \"aws-cdk-lib/aws-ec2\";\nimport type { GuStack } from \"../core\";\n\nexport type GuVpcProps = VpcProps;\n\n/**\n * Construct which creates a Virtual Private Cloud.\n *\n * NOTE: This construct requires an\n * [environment](https://docs.aws.amazon.com/cdk/latest/guide/environments.html)\n * to be set to function correctly. Without this, an environment-agnostic\n * template will be produced, which will only use two AZs even if the region\n * contains more than that. To set this, set the `env` prop when instantiating\n * your stack.\n *\n * NOTE: If using this construct outside eu-west-1, you'll need to commit the\n * `cdk.context.json` file that's created after synthesising locally.\n *\n * Be aware that account IDs are considered sensitive information and should NOT\n * be committed to public repos.\n *\n * The VPC is provisioned with a public and private subnet for each availability\n * zone, with IPs spread evenly across these. Instances in private subnets\n * cannot be accessed directly over the internet. You should locate services in\n * instances in the private subnets, and provide HTTP(S) as required via load\n * balancers living in the public subnets.\n *\n * A CIDR block is a combined IP and network mask that specifies the IP\n * addresses in your VPC. For testing purposes any (AWS supported) CIDR block\n * will do, but for production you should:\n *\n * - use a /21 network mask (providing up to 2048 IPs, which is plenty for most\n * accounts)\n * - ask Enterprise Tech for an IP address to go with this range (so that\n * peering with other company VPCs is possible without IP clashes)\n *\n * A managed NAT is created for each private subnet to allow access to the\n * internet.\n *\n * For recommendations on how best to configure your VPC see:\n * https://github.com/guardian/recommendations/blob/main/AWS.md#vpc\n *\n * For more information on VPCs and AWS see:\n * https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html.\n */\nexport class GuVpc extends Vpc {\n /**\n * Programmatically sets the CDK context with a list of AZs for eu-west-1.\n * This means consuming stacks do NOT have to commit a `cdk.context.json`\n * file when using this construct in eu-west-1.\n *\n * @throws {Error} if the account ID has not been explicitly set on the parent GuStack\n * @private\n */\n private static setAvailabilityZoneContext({ account, node }: GuStack) {\n if (Token.isUnresolved(account)) {\n throw new Error(\n `Account ID not set - the resulting VPC might not be shaped how you'd expect. See https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.StackProps.html#env`\n );\n }\n\n node.setContext(`availability-zones:account=${account}:region=eu-west-1`, [\n \"eu-west-1a\",\n \"eu-west-1b\",\n \"eu-west-1c\",\n ]);\n }\n\n constructor(scope: GuStack, id: string, props?: GuVpcProps) {\n const defaultVpcProps: VpcProps = {\n gatewayEndpoints: {\n s3: {\n service: GatewayVpcEndpointAwsService.S3,\n },\n dynamodb: {\n service: GatewayVpcEndpointAwsService.DYNAMODB,\n },\n },\n\n subnetConfiguration: [\n {\n name: \"ingress\",\n subnetType: SubnetType.PUBLIC,\n },\n {\n name: \"application\",\n subnetType: SubnetType.PRIVATE_WITH_EGRESS,\n },\n ],\n };\n\n // Set the context BEFORE the `super` call to avoid `Error: Cannot set context after children have been added`\n GuVpc.setAvailabilityZoneContext(scope);\n\n super(scope, id, { ...defaultVpcProps, ...props });\n }\n}\n"]}