@guardian/cdk 50.10.11 → 50.10.12
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.
- package/lib/bin/commands/new-project/utils/init.js.map +1 -1
- package/lib/constants/access.js +1 -1
- package/lib/constants/access.js.map +1 -1
- package/lib/constructs/dns/dns-records.js +1 -1
- package/lib/constructs/dns/dns-records.js.map +1 -1
- package/lib/constructs/ec2/vpc.js +1 -1
- package/lib/constructs/ec2/vpc.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/init.ts"],"names":[],"mappings":";;;AAAA,2BAAgG;AAChG,+BAA4B;AAC5B,qDAAsE;AAMtE,8BAA8B;AAC9B,MAAa,cAAc;IAWzB,YAAY,MAAkB;QAV9B,gBAAW,GAAG,GAAG,SAAS,cAAc,CAAC;QAWvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,cAAc;QACZ,cAAc,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE3C,IAAI,CAAC,IAAA,eAAU,EAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;YACtC,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;YACjD,IAAA,cAAS,EAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;SAClC;QAED,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;QACrC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAEzC,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;QACtC,8DAA8D;QAC9D,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAExD,O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,IAAI;QACb,OAAO,EAAE;YACP,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,MAAM;YACZ,aAAa,EAAE,SAAS;YACxB,MAAM,EAAE,sCAAsC;YAC9C,IAAI,EAAE,gEAAgE;YACtE,KAAK,EAAE,2DAA2D;YAClE,IAAI,EAAE,0DAA0D;SACjE;QACD,eAAe;QAEf,QAAQ,EAAE,oBAAoB;QAE9B,IAAI,EAAE;YACJ,SAAS,EAAE,CAAC,4BAA4B,CAAC;YACzC,SAAS,EAAE;gBACT,aAAa,EAAE,SAAS;aACzB;YACD,kBAAkB,EAAE,CAAC,iBAAiB,CAAC;SACxC;QAED,YAAY,EAAE;YACZ,IAAI,EAAE,IAAI;YACV,GAAG,EAAE;gBACH,IAAI,EAAE,IAAI;gBACV,IAAI,EAAE,IAAI;aACX;YACD,OAAO,EAAE,CAAC,oCAAoC,CAAC;YAC/C,aAAa,EAAE;gBACb,WAAW,EAAE,IAAI;gBACjB,UAAU,EAAE,QAAQ;aACrB;YACD,OAAO,EAAE,CAAC,oBAAoB,CAAC;YAC/B,KAAK,EAAE;gBACL,wCAAwC,EAAE,CAAC;gBAC3C,qBAAqB,EAAE,CAAC;aACzB;YACD,cAAc,EAAE,CAAC,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,gBAAgB,CAAC;SACzF;KACF,CAAC;IACF,IAAA,kBAAa,EAAC,GAAG,eAAe,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACtF,CAAC","sourcesContent":["import { copyFileSync, existsSync, lstatSync, mkdirSync, readdirSync, writeFileSync } from \"fs\";\nimport { join } from \"path\";\nimport { getDevDependency, LibraryInfo } from \"../../../../constants\";\n\nexport interface InitConfig {\n outputDir: string;\n}\n\n// TODO: Add project name flag\nexport class ProjectBuilder {\n templateDir = `${__dirname}/../template`;\n config: InitConfig;\n\n static validateConfig = (config: InitConfig): void => {\n const path = config.outputDir;\n if (existsSync(path) && readdirSync(path).length > 0) {\n throw new Error(`Directory ${path} is not empty`);\n }\n };\n\n constructor(config: InitConfig) {\n this.config = config;\n }\n\n buildDirectory(): void {\n ProjectBuilder.validateConfig(this.config);\n\n if (!existsSync(this.config.outputDir)) {\n console.log(`Creating ${this.config.outputDir}`);\n mkdirSync(this.config.outputDir);\n }\n\n console.log(\"Creating package.json\");\n createPackageJson(this.config.outputDir);\n\n console.log(\"Copying template files\");\n // TODO: Replace any params in files with .template extensions\n this.copyFiles(this.templateDir, this.config.outputDir);\n\n console.log(\"Success!\");\n }\n\n copyFiles(sourcePath: string, targetPath: string): void {\n for (const file of readdirSync(sourcePath)) {\n const path = join(sourcePath, file);\n\n if (path.endsWith(\".ignore\")) {\n continue;\n } else if (lstatSync(path).isDirectory()) {\n const nestedTargetPath = join(targetPath, file);\n if (!existsSync(nestedTargetPath)) {\n mkdirSync(nestedTargetPath);\n }\n this.copyFiles(path, nestedTargetPath);\n } else if (path.endsWith(\".template\")) {\n copyFileSync(path, join(targetPath, file.replace(\".template\", \"\")));\n } else {\n copyFileSync(path, join(targetPath, file));\n }\n }\n }\n}\n\nexport const buildDirectory = (config: InitConfig): void => {\n const builder = new ProjectBuilder(config);\n builder.buildDirectory();\n};\n\nfunction createPackageJson(outputDirectory: string): void {\n const { NODE_ENV, CI } = process.env;\n const isTest = NODE_ENV?.toUpperCase() === \"TEST\" || CI?.toUpperCase() === \"TRUE\";\n\n const coreDeps: Record<string, string> = [\n \"@guardian/eslint-config-typescript\",\n \"@types/jest\",\n \"@types/node\",\n \"eslint\",\n \"jest\",\n \"prettier\",\n \"ts-jest\",\n \"ts-node\",\n \"typescript\",\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- deps come from `package.json`, so shouldn't be `undefined`\n ].reduce((acc, depName) => ({ ...acc, [depName]: getDevDependency(depName)! }), {});\n\n const cdkDeps: Record<string, string> = {\n /*\n Do not add `@guardian/cdk` to the generated `package.json` file when in TEST as we'll `npm link` it instead.\n See https://docs.npmjs.com/cli/v8/commands/npm-link#caveat\n\n TODO remove this once the `new` command allows opting out of automatic dependency installation\n */\n ...(!isTest && { \"@guardian/cdk\": LibraryInfo.VERSION }),\n\n \"aws-cdk\": LibraryInfo.AWS_CDK_VERSION,\n \"aws-cdk-lib\": LibraryInfo.AWS_CDK_VERSION,\n constructs: LibraryInfo.CONSTRUCTS_VERSION,\n };\n\n const customDeps = {\n \"source-map-support\": \"^0.5.20\",\n \"@guardian/prettier\": \"5.0.0\",\n };\n\n const allDeps: Record<string, string> = { ...coreDeps, ...cdkDeps, ...customDeps };\n\n const devDependencies: Record<string, string> = Object.keys(allDeps)\n .sort()\n .reduce((acc, depName) => ({ ...acc, [depName]: allDeps[depName] }), {});\n\n const contents = {\n name: \"cdk\",\n version: \"0.0.0\",\n private: true,\n scripts: {\n build: \"tsc\",\n test: \"jest\",\n \"test-update\": \"jest -u\",\n format: 'prettier --write \"{lib,bin}/**/*.ts\"',\n lint: \"eslint lib/** bin/** --ext .ts --no-error-on-unmatched-pattern\",\n synth: \"cdk synth --path-metadata false --version-reporting false\",\n diff: \"cdk diff --path-metadata false --version-reporting false\",\n },\n devDependencies,\n\n prettier: \"@guardian/prettier\",\n\n jest: {\n testMatch: [\"<rootDir>/lib/**/*.test.ts\"],\n transform: {\n \"^.+\\\\.tsx?$\": \"ts-jest\",\n },\n setupFilesAfterEnv: [\"./jest.setup.js\"],\n },\n\n eslintConfig: {\n root: true,\n env: {\n node: true,\n jest: true,\n },\n extends: [\"@guardian/eslint-config-typescript\"],\n parserOptions: {\n ecmaVersion: 2020,\n sourceType: \"module\",\n },\n plugins: [\"@typescript-eslint\"],\n rules: {\n \"@typescript-eslint/no-inferrable-types\": 0,\n \"import/no-namespace\": 2,\n },\n ignorePatterns: [\"**/*.js\", \"node_modules\", \"cdk.out\", \".eslintrc.js\", \"jest.config.js\"],\n },\n };\n writeFileSync(`${outputDirectory}/package.json`, JSON.stringify(contents, null, 2));\n}\n"]}
|
package/lib/constants/access.js
CHANGED
|
@@ -18,5 +18,5 @@ var AccessScope;
|
|
|
18
18
|
* For when you want to restrict your application's access to the VPC.
|
|
19
19
|
*/
|
|
20
20
|
AccessScope["INTERNAL"] = "Internal";
|
|
21
|
-
})(AccessScope
|
|
21
|
+
})(AccessScope || (exports.AccessScope = AccessScope = {}));
|
|
22
22
|
//# sourceMappingURL=access.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access.js","sourceRoot":"","sources":["../../src/constants/access.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,WAeX;AAfD,WAAY,WAAW;IACrB;;OAEG;IACH,gCAAiB,CAAA;IAEjB;;OAEG;IACH,wCAAyB,CAAA;IAEzB;;OAEG;IACH,oCAAqB,CAAA;AACvB,CAAC,EAfW,WAAW,
|
|
1
|
+
{"version":3,"file":"access.js","sourceRoot":"","sources":["../../src/constants/access.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,WAeX;AAfD,WAAY,WAAW;IACrB;;OAEG;IACH,gCAAiB,CAAA;IAEjB;;OAEG;IACH,wCAAyB,CAAA;IAEzB;;OAEG;IACH,oCAAqB,CAAA;AACvB,CAAC,EAfW,WAAW,2BAAX,WAAW,QAetB","sourcesContent":["/**\n * An enum representing different types of application access.\n */\nexport enum AccessScope {\n /**\n * For when you want your application to be accessible to the world (0.0.0.0/0).\n */\n PUBLIC = \"Public\",\n\n /**\n * For when you want to restrict your application's access to a list of CIDR ranges.\n */\n RESTRICTED = \"Restricted\",\n\n /**\n * For when you want to restrict your application's access to the VPC.\n */\n INTERNAL = \"Internal\",\n}\n"]}
|
|
@@ -6,7 +6,7 @@ const constructs_1 = require("constructs");
|
|
|
6
6
|
var RecordType;
|
|
7
7
|
(function (RecordType) {
|
|
8
8
|
RecordType["CNAME"] = "CNAME";
|
|
9
|
-
})(RecordType
|
|
9
|
+
})(RecordType || (exports.RecordType = RecordType = {}));
|
|
10
10
|
/**
|
|
11
11
|
* This construct can be used to create DNS records in NS1.
|
|
12
12
|
*
|
|
@@ -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,
|
|
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,0BAAV,UAAU,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"]}
|
|
@@ -8,7 +8,7 @@ var SubnetType;
|
|
|
8
8
|
(function (SubnetType) {
|
|
9
9
|
SubnetType["PUBLIC"] = "Public";
|
|
10
10
|
SubnetType["PRIVATE"] = "Private";
|
|
11
|
-
})(SubnetType
|
|
11
|
+
})(SubnetType || (exports.SubnetType = SubnetType = {}));
|
|
12
12
|
/*
|
|
13
13
|
* Some stacks maybe have multiple patterns (such as `GuEc2App`), therefore creating multiple VPC and subnet resources.
|
|
14
14
|
* This function ensures that, where desired, we can have unique IDs for each VPC and subnet declaration
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vpc.js","sourceRoot":"","sources":["../../../src/constructs/ec2/vpc.ts"],"names":[],"mappings":";;;AAAA,iDAAkD;AAElD,kCAAgE;AAShE,0BAA0B;AAC1B,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,+BAAiB,CAAA;IACjB,iCAAmB,CAAA;AACrB,CAAC,EAHW,UAAU,
|
|
1
|
+
{"version":3,"file":"vpc.js","sourceRoot":"","sources":["../../../src/constructs/ec2/vpc.ts"],"names":[],"mappings":";;;AAAA,iDAAkD;AAElD,kCAAgE;AAShE,0BAA0B;AAC1B,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,+BAAiB,CAAA;IACjB,iCAAmB,CAAA;AACrB,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB;AAQD;;;GAGG;AACI,MAAM,QAAQ,GAAG,CAAC,KAAwB,EAAU,EAAE,CAAC,KAAK,EAAE,GAAG,IAAI,EAAE,CAAC;AAAlE,QAAA,QAAQ,YAA0D;AAE/E,MAAa,KAAK;IAChB,MAAM,CAAC,OAAO,CAAC,KAAc,EAAE,OAAiB;QAC9C;;;;;;;;;;;WAWG;QACH,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAC9B,gBAAM,CAAC,oBAAoB,CAAC,KAAK,EAAE,UAAU,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,CAC1F,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,oBAAoB,CAAC,KAAc,EAAE,KAAqB;QAC/D,MAAM,IAAI,GAAG,KAAK,EAAE,IAAI,IAAI,UAAU,CAAC,OAAO,CAAC;QAE/C,MAAM,OAAO,GAAG,IAAI,4BAAqB,CAAC,KAAK,EAAE,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,GAAG,IAAI,SAAS,EAAE;YACnF,WAAW,EAAE,aAAa,IAAI,CAAC,WAAW,EAAE,UAAU;YAEtD,uHAAuH;YACvH,OAAO,EAAE,gCAAgC,IAAI,CAAC,WAAW,EAAE,EAAE;YAC7D,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,KAAc,EAAE,EAAU,EAAE,KAAqB;QAC7D,OAAO,aAAG,CAAC,iBAAiB,CAAC,KAAK,EAAE,EAAE,EAAE;YACtC,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;YAC1C,GAAG,KAAK;SACT,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,eAAe,CAAC,KAAc,EAAE,EAAU,EAAE,KAA+B;QAChF,MAAM,GAAG,GAAG,qBAAc,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC9C,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,aAAa,EAAE,CAAC,CAAC;IACzE,CAAC;CACF;AA5CD,sBA4CC","sourcesContent":["import { Subnet, Vpc } from \"aws-cdk-lib/aws-ec2\";\nimport type { ISubnet, IVpc, VpcAttributes } from \"aws-cdk-lib/aws-ec2\";\nimport { GuSubnetListParameter, GuVpcParameter } from \"../core\";\nimport type { GuStack } from \"../core\";\n\ninterface VpcFromIdProps extends Omit<VpcAttributes, \"availabilityZones\"> {\n availabilityZones?: string[];\n}\n\ntype VpcFromIdParameterProps = Omit<VpcFromIdProps, \"vpcId\">;\n\n// TODO convert to boolean\nexport enum SubnetType {\n PUBLIC = \"Public\",\n PRIVATE = \"Private\",\n}\n\n// TODO: Migrate this to use `AppIdentity`\nexport interface GuSubnetProps {\n type?: SubnetType;\n app?: string;\n}\n\n/*\n * Some stacks maybe have multiple patterns (such as `GuEc2App`), therefore creating multiple VPC and subnet resources.\n * This function ensures that, where desired, we can have unique IDs for each VPC and subnet declaration\n */\nexport const maybeApp = (props?: { app?: string }): string => props?.app ?? \"\";\n\nexport class GuVpc {\n static subnets(scope: GuStack, subnets: string[]): ISubnet[] {\n /**\n * As of ~1.77.0 of the aws/cdk, this line\n * [ previously Subnet.fromSubnetId(scope, `subnet-${subnetId}`, subnetId)) ]\n * resulted in the following error\n * \"Found an encoded list token string in a scalar string context. Use 'Fn.select(0, list)' (not 'list[0]') to extract elements from token lists.\"\n * See https://github.com/aws/aws-cdk/issues/11945 for more information\n *\n * As a hacky workaround, we have moved to using the fromSubnetAttributes method and hardcoded an empty value\n * for the routeTableId prop. This prevents the error and, when tested on existing stacks, results in no change to the CFN output\n *\n * TODO: Understand VPCs and Subnets better and develop a better solution to this problem\n */\n return subnets.map((subnetId) =>\n Subnet.fromSubnetAttributes(scope, `subnet-${subnetId}`, { subnetId, routeTableId: \" \" }),\n );\n }\n\n static subnetsFromParameter(scope: GuStack, props?: GuSubnetProps): ISubnet[] {\n const type = props?.type ?? SubnetType.PRIVATE;\n\n const subnets = new GuSubnetListParameter(scope, `${maybeApp(props)}${type}Subnets`, {\n description: `A list of ${type.toLowerCase()} subnets`,\n\n // TODO use `NAMED_SSM_PARAMETER_PATHS.PrimaryVpcPrivateSubnets` or `NAMED_SSM_PARAMETER_PATHS.PrimaryVpcPublicSubnets`\n default: `/account/vpc/primary/subnets/${type.toLowerCase()}`,\n fromSSM: true,\n });\n\n return GuVpc.subnets(scope, subnets.valueAsList);\n }\n\n static fromId(scope: GuStack, id: string, props: VpcFromIdProps): IVpc {\n return Vpc.fromVpcAttributes(scope, id, {\n availabilityZones: scope.availabilityZones,\n ...props,\n });\n }\n\n static fromIdParameter(scope: GuStack, id: string, props?: VpcFromIdParameterProps): IVpc {\n const vpc = GuVpcParameter.getInstance(scope);\n return GuVpc.fromId(scope, id, { ...props, vpcId: vpc.valueAsString });\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guardian/cdk",
|
|
3
3
|
"description": "Generic Guardian flavoured AWS CDK components",
|
|
4
|
-
"version": "50.10.
|
|
4
|
+
"version": "50.10.12",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"cli:dev": "ts-node src/bin/index.ts"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@guardian/eslint-config-typescript": "
|
|
31
|
+
"@guardian/eslint-config-typescript": "7.0.0",
|
|
32
32
|
"@guardian/eslint-plugin-tsdoc-required": "^0.1.3",
|
|
33
33
|
"@types/git-url-parse": "^9.0.1",
|
|
34
34
|
"@types/jest": "^29.5.4",
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
"ts-jest": "^29.1.1",
|
|
51
51
|
"ts-node": "^10.9.1",
|
|
52
52
|
"typedoc": "^0.25.0",
|
|
53
|
-
"typescript": "
|
|
53
|
+
"typescript": "5.1.6"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@oclif/core": "2.13.0",
|
|
57
57
|
"aws-cdk-lib": "2.90.0",
|
|
58
|
-
"aws-sdk": "^2.
|
|
58
|
+
"aws-sdk": "^2.1448.0",
|
|
59
59
|
"chalk": "^4.1.2",
|
|
60
60
|
"codemaker": "^1.87.0",
|
|
61
61
|
"constructs": "10.2.69",
|