@infoxchange/make-it-so 2.13.0 → 2.14.0-internal-testing-add-sst-3-support.2

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 (111) hide show
  1. package/build.ts +47 -0
  2. package/dist/components/ix/InternalNetwork.d.ts +24 -0
  3. package/dist/components/ix/InternalNetwork.d.ts.map +1 -0
  4. package/dist/components/ix/dns.d.ts +97 -0
  5. package/dist/components/ix/dns.d.ts.map +1 -0
  6. package/dist/components/ix/index.d.ts +3 -0
  7. package/dist/components/ix/index.d.ts.map +1 -0
  8. package/dist/components/ix/index.js +375 -0
  9. package/dist/components/ix/index.js.map +7 -0
  10. package/dist/deployConfig.d.ts.map +1 -1
  11. package/dist/index.d.ts +4 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +114 -0
  14. package/dist/index.js.map +7 -0
  15. package/dist/lib/sst/component-defaults.d.ts +14 -0
  16. package/dist/lib/sst/component-defaults.d.ts.map +1 -0
  17. package/eslint.config.js +1 -0
  18. package/package.json +16 -16
  19. package/src/components/ix/InternalNetwork.ts +126 -0
  20. package/src/components/ix/dns.ts +280 -0
  21. package/src/components/ix/index.ts +2 -0
  22. package/src/deployConfig.ts +12 -6
  23. package/src/index.ts +3 -0
  24. package/src/lib/sst/component-defaults.ts +80 -0
  25. package/src/sst-globals.d.ts +1 -0
  26. package/tsconfig.build.json +13 -0
  27. package/tsconfig.json +8 -4
  28. package/vitest.config.ts +19 -0
  29. package/dist/cdk-constructs/IxApi.d.ts +0 -12
  30. package/dist/cdk-constructs/IxApi.d.ts.map +0 -1
  31. package/dist/cdk-constructs/IxApi.js +0 -56
  32. package/dist/cdk-constructs/IxBucket.d.ts +0 -9
  33. package/dist/cdk-constructs/IxBucket.d.ts.map +0 -1
  34. package/dist/cdk-constructs/IxBucket.js +0 -22
  35. package/dist/cdk-constructs/IxCertificate.d.ts +0 -16
  36. package/dist/cdk-constructs/IxCertificate.d.ts.map +0 -1
  37. package/dist/cdk-constructs/IxCertificate.js +0 -26
  38. package/dist/cdk-constructs/IxDnsRecord.d.ts +0 -23
  39. package/dist/cdk-constructs/IxDnsRecord.d.ts.map +0 -1
  40. package/dist/cdk-constructs/IxDnsRecord.js +0 -43
  41. package/dist/cdk-constructs/IxElasticache.d.ts +0 -17
  42. package/dist/cdk-constructs/IxElasticache.d.ts.map +0 -1
  43. package/dist/cdk-constructs/IxElasticache.js +0 -70
  44. package/dist/cdk-constructs/IxNextjsSite.d.ts +0 -16
  45. package/dist/cdk-constructs/IxNextjsSite.d.ts.map +0 -1
  46. package/dist/cdk-constructs/IxNextjsSite.js +0 -38
  47. package/dist/cdk-constructs/IxQuicksightWorkspace.d.ts +0 -17
  48. package/dist/cdk-constructs/IxQuicksightWorkspace.d.ts.map +0 -1
  49. package/dist/cdk-constructs/IxQuicksightWorkspace.js +0 -29
  50. package/dist/cdk-constructs/IxSESIdentity.d.ts +0 -12
  51. package/dist/cdk-constructs/IxSESIdentity.d.ts.map +0 -1
  52. package/dist/cdk-constructs/IxSESIdentity.js +0 -45
  53. package/dist/cdk-constructs/IxStaticSite.d.ts +0 -17
  54. package/dist/cdk-constructs/IxStaticSite.d.ts.map +0 -1
  55. package/dist/cdk-constructs/IxStaticSite.js +0 -38
  56. package/dist/cdk-constructs/IxVpcDetails.d.ts +0 -12
  57. package/dist/cdk-constructs/IxVpcDetails.d.ts.map +0 -1
  58. package/dist/cdk-constructs/IxVpcDetails.js +0 -26
  59. package/dist/cdk-constructs/IxWebsiteRedirect.d.ts +0 -35
  60. package/dist/cdk-constructs/IxWebsiteRedirect.d.ts.map +0 -1
  61. package/dist/cdk-constructs/IxWebsiteRedirect.js +0 -72
  62. package/dist/cdk-constructs/SiteOidcAuth/auth-check-handler-body.d.ts +0 -2
  63. package/dist/cdk-constructs/SiteOidcAuth/auth-check-handler-body.d.ts.map +0 -1
  64. package/dist/cdk-constructs/SiteOidcAuth/auth-check-handler-body.js +0 -130
  65. package/dist/cdk-constructs/SiteOidcAuth/auth-route.d.ts +0 -2
  66. package/dist/cdk-constructs/SiteOidcAuth/auth-route.d.ts.map +0 -1
  67. package/dist/cdk-constructs/SiteOidcAuth/auth-route.js +0 -59
  68. package/dist/cdk-constructs/SiteOidcAuth/index.d.ts +0 -197
  69. package/dist/cdk-constructs/SiteOidcAuth/index.d.ts.map +0 -1
  70. package/dist/cdk-constructs/SiteOidcAuth/index.js +0 -188
  71. package/dist/cdk-constructs/index.d.ts +0 -11
  72. package/dist/cdk-constructs/index.d.ts.map +0 -1
  73. package/dist/cdk-constructs/index.js +0 -10
  74. package/dist/deployConfig.js +0 -78
  75. package/dist/lib/auth/index.d.ts +0 -2
  76. package/dist/lib/auth/index.d.ts.map +0 -1
  77. package/dist/lib/auth/index.js +0 -1
  78. package/dist/lib/auth/oidc.d.ts +0 -26
  79. package/dist/lib/auth/oidc.d.ts.map +0 -1
  80. package/dist/lib/auth/oidc.js +0 -48
  81. package/dist/lib/proxy/fetch.js +0 -31
  82. package/dist/lib/proxy/index.js +0 -1
  83. package/dist/lib/site/support.d.ts +0 -71
  84. package/dist/lib/site/support.d.ts.map +0 -1
  85. package/dist/lib/site/support.js +0 -262
  86. package/dist/lib/utils/hash.d.ts +0 -2
  87. package/dist/lib/utils/hash.d.ts.map +0 -1
  88. package/dist/lib/utils/hash.js +0 -13
  89. package/dist/lib/utils/objects.d.ts +0 -4
  90. package/dist/lib/utils/objects.d.ts.map +0 -1
  91. package/dist/lib/utils/objects.js +0 -7
  92. package/src/cdk-constructs/IxApi.ts +0 -81
  93. package/src/cdk-constructs/IxBucket.ts +0 -35
  94. package/src/cdk-constructs/IxCertificate.ts +0 -54
  95. package/src/cdk-constructs/IxDnsRecord.ts +0 -79
  96. package/src/cdk-constructs/IxElasticache.ts +0 -106
  97. package/src/cdk-constructs/IxNextjsSite.ts +0 -72
  98. package/src/cdk-constructs/IxQuicksightWorkspace.ts +0 -54
  99. package/src/cdk-constructs/IxSESIdentity.ts +0 -70
  100. package/src/cdk-constructs/IxStaticSite.ts +0 -69
  101. package/src/cdk-constructs/IxVpcDetails.ts +0 -38
  102. package/src/cdk-constructs/IxWebsiteRedirect.ts +0 -133
  103. package/src/cdk-constructs/SiteOidcAuth/auth-check-handler-body.ts +0 -168
  104. package/src/cdk-constructs/SiteOidcAuth/auth-route.ts +0 -71
  105. package/src/cdk-constructs/SiteOidcAuth/index.ts +0 -299
  106. package/src/cdk-constructs/index.ts +0 -10
  107. package/src/lib/auth/index.ts +0 -1
  108. package/src/lib/auth/oidc.ts +0 -73
  109. package/src/lib/site/support.ts +0 -439
  110. package/src/lib/utils/hash.ts +0 -14
  111. package/src/lib/utils/objects.ts +0 -19
package/build.ts ADDED
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env -S npx tsx
2
+
3
+ import * as esbuild from "esbuild";
4
+ import { readFileSync, rmSync } from "fs";
5
+ import { execSync } from "child_process";
6
+
7
+ interface PackageJson {
8
+ peerDependencies?: Record<string, string>;
9
+ dependencies?: Record<string, string>;
10
+ }
11
+
12
+ const packageJson: PackageJson = JSON.parse(
13
+ readFileSync("./package.json", "utf-8"),
14
+ );
15
+
16
+ // Clean dist directory before building
17
+ rmSync("dist", { recursive: true, force: true });
18
+
19
+ // Get all dependencies that should be external (not bundled)
20
+ const external = [
21
+ ...Object.keys(packageJson.peerDependencies || {}),
22
+ ...Object.keys(packageJson.dependencies || {}).filter(
23
+ (dep) => dep !== "sst3",
24
+ ),
25
+ "@infoxchange/make-it-so/*", // Self-references should be external
26
+ ];
27
+
28
+ // Build ESM
29
+ await esbuild.build({
30
+ entryPoints: ["src/components/ix/index.ts", "src/index.ts"],
31
+ bundle: true,
32
+ platform: "node",
33
+ target: "node21",
34
+ external,
35
+ sourcemap: true,
36
+ format: "esm",
37
+ outdir: "dist",
38
+ outExtension: { ".js": ".js" },
39
+ // Bundle sst3 code
40
+ packages: "bundle",
41
+ entryNames: "[dir]/[name]", // Preserve directory structure
42
+ });
43
+
44
+ // Build declaration files
45
+ execSync("tsc --project tsconfig.build.json", { stdio: "inherit" });
46
+
47
+ console.log("Build complete!");
@@ -0,0 +1,24 @@
1
+ import * as pulumi from "@pulumi/pulumi";
2
+ import * as aws from "@pulumi/aws";
3
+ import { Transform } from "sst3/platform/src/components/component";
4
+ export interface InternalNetworkArgs {
5
+ name?: string;
6
+ transform?: {
7
+ securityGroup?: Transform<aws.ec2.SecurityGroupArgs>;
8
+ };
9
+ }
10
+ export declare class InternalNetwork extends pulumi.ComponentResource {
11
+ readonly vpc: pulumi.Output<aws.ec2.GetVpcResult>;
12
+ readonly subnetIds: pulumi.Output<string[]>;
13
+ readonly securityGroup: pulumi.Output<aws.ec2.SecurityGroup>;
14
+ constructor(name: string, args?: InternalNetworkArgs, opts?: pulumi.ComponentResourceOptions);
15
+ get securityGroupIds(): pulumi.Output<pulumi.Output<string>[]>;
16
+ static getVpcSubnetIds(): pulumi.Output<string[]>;
17
+ createSecurityGroup({ parentName, vpc, args, opts, }: {
18
+ parentName: string;
19
+ vpc: aws.ec2.GetVpcResult;
20
+ args?: Transform<aws.ec2.SecurityGroupArgs>;
21
+ opts: pulumi.ComponentResourceOptions;
22
+ }): import("@pulumi/aws/ec2/securityGroup").SecurityGroup;
23
+ }
24
+ //# sourceMappingURL=InternalNetwork.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InternalNetwork.d.ts","sourceRoot":"","sources":["../../../src/components/ix/InternalNetwork.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAa,MAAM,wCAAwC,CAAC;AAE9E,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE;QACV,aAAa,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;KACtD,CAAC;CACH;AAED,qBAAa,eAAgB,SAAQ,MAAM,CAAC,iBAAiB;IAC3D,SAAgB,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACzD,SAAgB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IACnD,SAAgB,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;gBAGlE,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,mBAAwB,EAC9B,IAAI,CAAC,EAAE,MAAM,CAAC,wBAAwB;IAqCxC,IAAW,gBAAgB,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAEpE;IAED,MAAM,CAAC,eAAe,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;IAwBjD,mBAAmB,CAAC,EAClB,UAAU,EACV,GAAG,EACH,IAAI,EACJ,IAAI,GACL,EAAE;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC;QAC1B,IAAI,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC5C,IAAI,EAAE,MAAM,CAAC,wBAAwB,CAAC;KACvC;CA8BF"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * The AWS DNS Adapter is used to create DNS records to manage domains hosted on
3
+ * [Route 53](https://aws.amazon.com/route53/).
4
+ *
5
+ * This adapter is passed in as `domain.dns` when setting a custom domain.
6
+ *
7
+ * @example
8
+ *
9
+ * ```ts
10
+ * {
11
+ * domain: {
12
+ * name: "example.com",
13
+ * dns: sst.aws.dns()
14
+ * }
15
+ * }
16
+ * ```
17
+ *
18
+ * You can also specify a hosted zone ID if you have multiple hosted zones with the same domain.
19
+ *
20
+ * ```ts
21
+ * {
22
+ * domain: {
23
+ * name: "example.com",
24
+ * dns: sst.aws.dns({
25
+ * zone: "Z2FDTNDATAQYW2"
26
+ * })
27
+ * }
28
+ * }
29
+ * ```
30
+ *
31
+ * @packageDocumentation
32
+ */
33
+ import { AliasRecord, Record as DnsRecord } from "sst3/platform/src/components/dns";
34
+ import { ComponentResourceOptions } from "@pulumi/pulumi";
35
+ import { Transform } from "sst3/platform/src/components/component";
36
+ import { Input } from "sst3/platform/src/components/input";
37
+ import { route53 } from "@pulumi/aws";
38
+ export interface DnsArgs {
39
+ /**
40
+ * Set the hosted zone ID if you have multiple hosted zones that have the same
41
+ * domain in Route 53.
42
+ *
43
+ * The 14 letter ID of the [Route 53 hosted zone](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/hosted-zones-working-with.html) that contains the `domainName`. You can find the hosted zone ID in the Route 53 part of the AWS Console.
44
+ *
45
+ * @example
46
+ * ```js
47
+ * {
48
+ * zone: "Z2FDTNDATAQYW2"
49
+ * }
50
+ * ```
51
+ */
52
+ zone?: Input<string>;
53
+ /**
54
+ * Set to `true` if you want to let the new DNS records replace the existing ones.
55
+ *
56
+ * :::tip
57
+ * Use this to migrate over your domain without any downtime.
58
+ * :::
59
+ *
60
+ * This is useful if your domain is currently used by another app and you want to switch it
61
+ * to your current app. Without setting this, you'll first have to remove the existing DNS
62
+ * records and then add the new one. This can cause downtime.
63
+ *
64
+ * You can avoid this by setting this to `true` and the existing DNS records will be replaced
65
+ * without any downtime. Just make sure that when you remove your old app, you don't remove
66
+ * the DNS records.
67
+ *
68
+ * @default `false`
69
+ * @example
70
+ * ```js
71
+ * {
72
+ * override: true
73
+ * }
74
+ * ```
75
+ */
76
+ override?: Input<boolean>;
77
+ /**
78
+ * [Transform](/docs/components#transform) how this component creates its underlying
79
+ * resources.
80
+ */
81
+ transform?: {
82
+ /**
83
+ * Transform the AWS Route 53 record resource.
84
+ */
85
+ record?: Transform<route53.RecordArgs & {
86
+ aliasIpType?: "IPv4" | "IPv6";
87
+ lambdaInput?: Record<string, unknown>;
88
+ }>;
89
+ };
90
+ }
91
+ export declare function dns(args?: DnsArgs): {
92
+ provider: "aws";
93
+ createAlias: (namePrefix: string, record: AliasRecord, opts: ComponentResourceOptions) => import("@pulumi/pulumi").Output<import("@pulumi/aws/lambda/invocation").Invocation>[];
94
+ createCaa: (namePrefix: string, recordName: string, opts: ComponentResourceOptions) => undefined;
95
+ createRecord: (namePrefix: string, record: DnsRecord, opts: ComponentResourceOptions) => import("@pulumi/pulumi").Output<import("@pulumi/aws/lambda/invocation").Invocation>;
96
+ };
97
+ //# sourceMappingURL=dns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dns.d.ts","sourceRoot":"","sources":["../../../src/components/ix/dns.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EACL,WAAW,EAEX,MAAM,IAAI,SAAS,EACpB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,wBAAwB,EAAU,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAa,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,KAAK,EAAE,MAAM,oCAAoC,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAItC,MAAM,WAAW,OAAO;IACtB;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACrB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE;QACV;;WAEG;QACH,MAAM,CAAC,EAAE,SAAS,CAChB,OAAO,CAAC,UAAU,GAAG;YACnB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;YAE9B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SACvC,CACF,CAAC;KACH,CAAC;CACH;AAED,wBAAgB,GAAG,CAAC,IAAI,GAAE,OAAY;;8BAgBtB,MAAM,UACV,WAAW,QACb,wBAAwB;4BAwBlB,MAAM,cACN,MAAM,QACZ,wBAAwB;+BAelB,MAAM,UACV,SAAS,QACX,wBAAwB;EAiHjC"}
@@ -0,0 +1,3 @@
1
+ export * from "./dns.js";
2
+ export * from "./InternalNetwork.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ix/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,375 @@
1
+ // node_modules/sst3/platform/src/components/naming.ts
2
+ function logicalName(name) {
3
+ name = name.replace(/[^a-zA-Z0-9]/g, "");
4
+ return name.charAt(0).toUpperCase() + name.slice(1);
5
+ }
6
+
7
+ // src/components/ix/dns.ts
8
+ import { output as output2 } from "@pulumi/pulumi";
9
+
10
+ // node_modules/sst3/platform/src/components/component.ts
11
+ import {
12
+ ComponentResource,
13
+ runtime,
14
+ output,
15
+ asset as pulumiAsset,
16
+ all
17
+ } from "@pulumi/pulumi";
18
+
19
+ // node_modules/sst3/platform/src/components/error.ts
20
+ var VisibleError = class extends Error {
21
+ constructor(...message) {
22
+ super(message.join("\n"));
23
+ }
24
+ };
25
+
26
+ // node_modules/sst3/platform/src/components/component.ts
27
+ function transform(transform2, name, args, opts) {
28
+ if (typeof transform2 === "function") {
29
+ transform2(args, opts, name);
30
+ return [name, args, opts];
31
+ }
32
+ return [name, { ...args, ...transform2 }, opts];
33
+ }
34
+
35
+ // node_modules/sst3/platform/src/components/aws/helpers/provider.ts
36
+ import { runtime as runtime2 } from "@pulumi/pulumi";
37
+ import { Provider } from "@pulumi/aws";
38
+
39
+ // node_modules/sst3/platform/src/util/lazy.ts
40
+ function lazy(callback) {
41
+ let loaded = false;
42
+ let result;
43
+ return () => {
44
+ if (!loaded) {
45
+ loaded = true;
46
+ result = callback();
47
+ }
48
+ return result;
49
+ };
50
+ }
51
+
52
+ // node_modules/sst3/platform/src/components/aws/helpers/provider.ts
53
+ var useProviderCache = lazy(() => /* @__PURE__ */ new Map());
54
+ var useProvider = (region) => {
55
+ const cache = useProviderCache();
56
+ const existing = cache.get(region);
57
+ if (existing) return existing;
58
+ const config = runtime2.allConfig();
59
+ for (const key in config) {
60
+ const value = config[key];
61
+ delete config[key];
62
+ const [prefix, real] = key.split(":");
63
+ if (prefix !== "aws") continue;
64
+ try {
65
+ config[real] = JSON.parse(value);
66
+ } catch (e) {
67
+ config[real] = value;
68
+ }
69
+ }
70
+ const provider = new Provider(`AwsProvider.sst.${region}`, {
71
+ ...config,
72
+ region
73
+ });
74
+ cache.set(region, provider);
75
+ return provider;
76
+ };
77
+
78
+ // src/components/ix/dns.ts
79
+ import * as aws from "@pulumi/aws";
80
+ function dns(args = {}) {
81
+ return {
82
+ provider: "aws",
83
+ createAlias,
84
+ createCaa,
85
+ createRecord
86
+ };
87
+ function createAlias(namePrefix, record, opts) {
88
+ return ["A", "AAAA"].map(
89
+ (type) => _createRecord(
90
+ namePrefix,
91
+ {
92
+ type,
93
+ name: record.name,
94
+ aliases: [
95
+ {
96
+ name: record.aliasName,
97
+ zoneId: record.aliasZone,
98
+ evaluateTargetHealth: true
99
+ }
100
+ ]
101
+ },
102
+ opts
103
+ )
104
+ );
105
+ }
106
+ function createCaa(namePrefix, recordName, opts) {
107
+ return void 0;
108
+ }
109
+ function createRecord(namePrefix, record, opts) {
110
+ return _createRecord(
111
+ namePrefix,
112
+ {
113
+ type: record.type,
114
+ name: record.name,
115
+ ttl: 60,
116
+ records: [record.value]
117
+ },
118
+ opts
119
+ );
120
+ }
121
+ function _createRecord(namePrefix, partial, opts) {
122
+ return output2(partial).apply((partial2) => {
123
+ const nameSuffix = logicalName(partial2.name);
124
+ const zoneId = "";
125
+ const dnsRecord = createRecord2();
126
+ return dnsRecord;
127
+ function createRecord2() {
128
+ const [name, mergedArgs, mergedOpts] = transform(
129
+ args.transform?.record,
130
+ `${namePrefix}${partial2.type}Record${nameSuffix}`,
131
+ {
132
+ zoneId,
133
+ allowOverwrite: args.override,
134
+ ...partial2
135
+ },
136
+ opts
137
+ );
138
+ const lambdaInput = output2(mergedArgs).apply((mergedArgs2) => {
139
+ const { aliases } = mergedArgs2;
140
+ let { aliasIpType } = mergedArgs2;
141
+ if (aliases && aliases.length > 1) {
142
+ throw new VisibleError(
143
+ "Aliases with multiple targets are not supported"
144
+ );
145
+ }
146
+ const [alias] = aliases || [];
147
+ if (alias) {
148
+ if (mergedArgs2.type === "A") {
149
+ aliasIpType = "IPv4";
150
+ } else if (mergedArgs2.type === "AAAA") {
151
+ aliasIpType = "IPv6";
152
+ } else {
153
+ throw new VisibleError(
154
+ "Alias records can only be created for A or AAAA record types"
155
+ );
156
+ }
157
+ }
158
+ return {
159
+ RecordType: mergedArgs2.type,
160
+ // Even though a trailing dot is valid a bug in the IX dns lambda means that an error occurs
161
+ // when trying to find the hosted zone if there is a trailing dot.
162
+ RecordFQDN: mergedArgs2.name.replace(/\.$/, ""),
163
+ // If giving the IX dns lambda multiple values we need to wrap in 'Value' objects
164
+ // unlike for single values where the lambda does it for us
165
+ // https://github.com/InfoxchangeTS/aws-gov/blob/213609c2e91b021375b93290efdaf38936ee98e1/components/xaccount-route53/dns-record-updater-lambda/src/index.py#L133
166
+ RecordValue: mergedArgs2.records?.map((value) => ({ Value: value })),
167
+ ...mergedArgs2.zoneId ? { HostedZoneId: mergedArgs2.zoneId } : {},
168
+ ...mergedArgs2.ttl ? { RecordTTL: mergedArgs2.ttl } : {},
169
+ ...alias ? {
170
+ RecordType: "ALIAS",
171
+ // https://github.com/InfoxchangeTS/aws-gov/blob/213609c2e91b021375b93290efdaf38936ee98e1/components/xaccount-route53/dns-record-updater-lambda/src/index.py#L145
172
+ RecordValue: alias.name,
173
+ // https://github.com/InfoxchangeTS/aws-gov/blob/213609c2e91b021375b93290efdaf38936ee98e1/components/xaccount-route53/dns-record-updater-lambda/src/index.py#L144
174
+ AliasZoneId: alias.zoneId,
175
+ // alias.evaluateTargetHealth can't be set by the lambda
176
+ IpAddressType: aliasIpType?.toLowerCase()
177
+ } : {},
178
+ ...mergedArgs2.lambdaInput
179
+ };
180
+ });
181
+ return new aws.lambda.Invocation(
182
+ name,
183
+ {
184
+ input: output2(lambdaInput).apply(
185
+ (lambdaInput2) => JSON.stringify({
186
+ RequestType: "Create",
187
+ ResourceProperties: lambdaInput2,
188
+ // We need some value so that the lambda doesn't throw an error but we don't want the lambda to actually
189
+ // send a response to this url (the response is for CloudFormation which we're not using). Setting an
190
+ // invalid domain will cause it to log an error but not throw so the lambda is considered successful.
191
+ ResponseURL: "invalid://make-it-so-dns",
192
+ StackId: "",
193
+ RequestId: "",
194
+ LogicalResourceId: ""
195
+ })
196
+ ),
197
+ functionName: aws.ssm.getParameter({
198
+ name: "/shared-services/route53/lambdaArn"
199
+ }).then((param) => param.value)
200
+ },
201
+ {
202
+ ...mergedOpts,
203
+ // Function can only be invoked from within the same region it is deployed
204
+ provider: useProvider("ap-southeast-2")
205
+ }
206
+ );
207
+ }
208
+ });
209
+ }
210
+ }
211
+
212
+ // src/components/ix/InternalNetwork.ts
213
+ import * as pulumi from "@pulumi/pulumi";
214
+ import * as aws2 from "@pulumi/aws";
215
+
216
+ // src/deployConfig.ts
217
+ import { z } from "zod";
218
+ var getEnvVars = () => ({
219
+ isIxDeploy: process.env.IX_DEPLOYMENT?.toLowerCase() === "true",
220
+ // This needs to start as a bool for the discriminated union
221
+ appName: process.env.IX_APP_NAME ?? "",
222
+ environment: process.env.IX_ENVIRONMENT ?? "",
223
+ workloadGroup: process.env.IX_WORKLOAD_GROUP ?? "",
224
+ primaryAwsRegion: process.env.IX_PRIMARY_AWS_REGION ?? "",
225
+ siteDomains: process.env.IX_SITE_DOMAINS ?? "",
226
+ siteDomainAliases: process.env.IX_SITE_DOMAIN_ALIASES ?? "",
227
+ isInternalApp: process.env.IX_INTERNAL_APP ?? "",
228
+ deploymentType: process.env.IX_DEPLOYMENT_TYPE ?? "",
229
+ sourceCommitRef: process.env.IX_SOURCE_COMMIT_REF ?? "",
230
+ sourceCommitHash: process.env.IX_SOURCE_COMMIT_HASH ?? "",
231
+ deployTriggeredBy: process.env.IX_DEPLOY_TRIGGERED_BY ?? "",
232
+ smtpHost: process.env.SMTP_HOST ?? "",
233
+ smtpPort: process.env.SMTP_PORT ?? "",
234
+ clamAVUrl: process.env.CLAMAV_URL ?? "",
235
+ vpcHttpProxy: process.env.VPC_HTTP_PROXY ?? ""
236
+ });
237
+ var ixDeployConfigSchema = z.object({
238
+ isIxDeploy: z.literal(true),
239
+ appName: z.string().min(1),
240
+ environment: z.enum(["dev", "test", "uat", "prod"]),
241
+ workloadGroup: z.enum(["ds", "srs"]),
242
+ primaryAwsRegion: z.literal("ap-southeast-2"),
243
+ siteDomains: z.string().transform(
244
+ (val) => val.split(",").map((domain) => domain.trim()).filter(Boolean)
245
+ ),
246
+ siteDomainAliases: z.string().transform(
247
+ (val) => val.split(",").map((domain) => domain.trim()).filter(Boolean)
248
+ ),
249
+ isInternalApp: z.coerce.boolean(),
250
+ deploymentType: z.enum(["docker", "serverless"]),
251
+ sourceCommitRef: z.string().min(1),
252
+ sourceCommitHash: z.string().min(1),
253
+ deployTriggeredBy: z.string().min(1),
254
+ smtpHost: z.string().min(1),
255
+ smtpPort: z.coerce.number().int(),
256
+ clamAVUrl: z.string().url(),
257
+ vpcHttpProxy: z.string().url()
258
+ }).strip();
259
+ var nonIxDeployConfigSchema = z.object({
260
+ isIxDeploy: z.literal(false),
261
+ appName: z.string(),
262
+ environment: z.string(),
263
+ workloadGroup: z.string(),
264
+ primaryAwsRegion: z.string(),
265
+ siteDomains: z.string().transform((val) => val.split(",").map((domain) => domain.trim())),
266
+ siteDomainAliases: z.string().transform((val) => val.split(",").map((domain) => domain.trim())),
267
+ isInternalApp: z.string().transform((val) => val ? val.toLowerCase() === "true" : void 0),
268
+ deploymentType: z.string(),
269
+ sourceCommitRef: z.string(),
270
+ sourceCommitHash: z.string(),
271
+ deployTriggeredBy: z.string(),
272
+ smtpHost: z.string(),
273
+ smtpPort: z.string().transform(
274
+ (val) => isNaN(parseInt(val, 10)) ? void 0 : parseInt(val, 10)
275
+ ),
276
+ clamAVUrl: z.string(),
277
+ vpcHttpProxy: z.string()
278
+ }).strip();
279
+ var schema = z.discriminatedUnion("isIxDeploy", [
280
+ ixDeployConfigSchema,
281
+ nonIxDeployConfigSchema
282
+ ]);
283
+ var deployConfig_default = schema.parse(getEnvVars());
284
+
285
+ // src/components/ix/InternalNetwork.ts
286
+ var InternalNetwork = class _InternalNetwork extends pulumi.ComponentResource {
287
+ vpc;
288
+ subnetIds;
289
+ securityGroup;
290
+ constructor(name, args = {}, opts) {
291
+ super("ix:aws:InternalNetwork", name, args, opts);
292
+ const vpcIdParam = aws2.ssm.getParameterOutput(
293
+ {
294
+ name: "/vpc/id"
295
+ },
296
+ { parent: this }
297
+ );
298
+ const vpcId = vpcIdParam.value;
299
+ this.vpc = vpcId.apply(
300
+ async (vpcId2) => await aws2.ec2.getVpc({ id: vpcId2 })
301
+ );
302
+ this.subnetIds = _InternalNetwork.getVpcSubnetIds();
303
+ this.securityGroup = this.vpc.apply(
304
+ (vpc) => this.createSecurityGroup({
305
+ parentName: name,
306
+ vpc,
307
+ args: args.transform?.securityGroup,
308
+ opts: { parent: this }
309
+ })
310
+ );
311
+ this.registerOutputs({
312
+ vpc: this.vpc,
313
+ subnetIds: this.subnetIds
314
+ });
315
+ }
316
+ get securityGroupIds() {
317
+ return pulumi.output(this.securityGroup).apply((sg) => [sg.id]);
318
+ }
319
+ static getVpcSubnetIds() {
320
+ const { workloadGroup, appName } = deployConfig_default;
321
+ let suffix = "";
322
+ if (workloadGroup === "ds") {
323
+ const possibleSuffixes = ["", "-2"];
324
+ const hash = appName.split("").reduce((acc, char) => acc + char.charCodeAt(0), 0);
325
+ suffix = possibleSuffixes[hash % possibleSuffixes.length];
326
+ }
327
+ const subnetOutputs = [1, 2, 3].map(
328
+ (subnetNum) => aws2.ssm.getParameterOutput({
329
+ name: `/vpc/subnet/private-${workloadGroup}${suffix}/${subnetNum}/id`
330
+ }).value
331
+ );
332
+ return pulumi.all(subnetOutputs);
333
+ }
334
+ // Based on https://github.com/anomalyco/sst/blob/3407c32b2cf97b85ea96a92361c6f4a0a8d55200/platform/src/components/aws/vpc.ts#L840
335
+ createSecurityGroup({
336
+ parentName,
337
+ vpc,
338
+ args,
339
+ opts
340
+ }) {
341
+ return new aws2.ec2.SecurityGroup(
342
+ ...transform(
343
+ args,
344
+ `${parentName}SecurityGroup`,
345
+ {
346
+ description: "Managed by make-it-so",
347
+ vpcId: vpc.id,
348
+ egress: [
349
+ {
350
+ fromPort: 0,
351
+ toPort: 0,
352
+ protocol: "-1",
353
+ cidrBlocks: ["0.0.0.0/0"]
354
+ }
355
+ ],
356
+ ingress: [
357
+ {
358
+ fromPort: 0,
359
+ toPort: 0,
360
+ protocol: "-1",
361
+ // Restricts inbound traffic to only within the VPC
362
+ cidrBlocks: [vpc.cidrBlock]
363
+ }
364
+ ]
365
+ },
366
+ opts
367
+ )
368
+ );
369
+ }
370
+ };
371
+ export {
372
+ InternalNetwork,
373
+ dns
374
+ };
375
+ //# sourceMappingURL=index.js.map