@webiny/project-aws 0.0.0-unstable.9f53ea597d → 0.0.0-unstable.a4f3e4ea8b
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/_templates/appTemplates/api/graphql/package.json +1 -0
- package/infra.d.ts +18 -0
- package/package.json +9 -9
- package/project.d.ts +0 -1
- package/pulumi/apps/admin/createAdminPulumiApp.js +3 -2
- package/pulumi/apps/admin/createAdminPulumiApp.js.map +1 -1
- package/pulumi/apps/api/createApiPulumiApp.js +5 -4
- package/pulumi/apps/api/createApiPulumiApp.js.map +1 -1
- package/pulumi/apps/core/createCorePulumiApp.js +2 -2
- package/pulumi/apps/core/createCorePulumiApp.js.map +1 -1
- package/pulumi/apps/customDomain.d.ts +15 -0
- package/pulumi/apps/customDomain.js +14 -2
- package/pulumi/apps/customDomain.js.map +1 -1
- package/pulumi/apps/extensions/isVpcEnabled.d.ts +14 -0
- package/pulumi/apps/extensions/isVpcEnabled.js +8 -0
- package/pulumi/apps/extensions/isVpcEnabled.js.map +1 -0
- package/pulumi/extensions/AdminCustomDomains.d.ts +9 -0
- package/pulumi/extensions/AdminCustomDomains.js +3 -1
- package/pulumi/extensions/AdminCustomDomains.js.map +1 -1
- package/pulumi/extensions/ApiCustomDomains.d.ts +9 -0
- package/pulumi/extensions/ApiCustomDomains.js +3 -1
- package/pulumi/extensions/ApiCustomDomains.js.map +1 -1
- package/pulumi/extensions/index.d.ts +9 -0
package/infra.d.ts
CHANGED
|
@@ -115,6 +115,15 @@ export declare const Infra: {
|
|
|
115
115
|
vip: "vip";
|
|
116
116
|
}>>;
|
|
117
117
|
certificateArn: import("zod").ZodString;
|
|
118
|
+
minimumProtocolVersion: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
119
|
+
SSLv3: "SSLv3";
|
|
120
|
+
TLSv1: "TLSv1";
|
|
121
|
+
"TLSv1.1_2016": "TLSv1.1_2016";
|
|
122
|
+
"TLSv1.2_2018": "TLSv1.2_2018";
|
|
123
|
+
"TLSv1.2_2019": "TLSv1.2_2019";
|
|
124
|
+
"TLSv1.2_2021": "TLSv1.2_2021";
|
|
125
|
+
TLSv1_2016: "TLSv1_2016";
|
|
126
|
+
}>>;
|
|
118
127
|
}, import("zod/v4/core").$strip>>;
|
|
119
128
|
StackOutputValue: import("@webiny/project/defineExtension/defineExtension.js").ExtensionComponent<import("zod").ZodObject<{
|
|
120
129
|
key: import("zod").ZodString;
|
|
@@ -147,6 +156,15 @@ export declare const Infra: {
|
|
|
147
156
|
vip: "vip";
|
|
148
157
|
}>>;
|
|
149
158
|
certificateArn: import("zod").ZodString;
|
|
159
|
+
minimumProtocolVersion: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
160
|
+
SSLv3: "SSLv3";
|
|
161
|
+
TLSv1: "TLSv1";
|
|
162
|
+
"TLSv1.1_2016": "TLSv1.1_2016";
|
|
163
|
+
"TLSv1.2_2018": "TLSv1.2_2018";
|
|
164
|
+
"TLSv1.2_2019": "TLSv1.2_2019";
|
|
165
|
+
"TLSv1.2_2021": "TLSv1.2_2021";
|
|
166
|
+
TLSv1_2016: "TLSv1_2016";
|
|
167
|
+
}>>;
|
|
150
168
|
}, import("zod/v4/core").$strip>>;
|
|
151
169
|
StackOutputValue: import("@webiny/project/defineExtension/defineExtension.js").ExtensionComponent<import("zod").ZodObject<{
|
|
152
170
|
key: import("zod").ZodString;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/project-aws",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.a4f3e4ea8b",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
"@pulumi/aws": "^7.38.0",
|
|
21
21
|
"@pulumi/pulumi": "^3.253.0",
|
|
22
22
|
"@pulumi/random": "4.21.0",
|
|
23
|
-
"@webiny/api-headless-cms": "0.0.0-unstable.
|
|
24
|
-
"@webiny/aws-layers": "0.0.0-unstable.
|
|
25
|
-
"@webiny/aws-sdk": "0.0.0-unstable.
|
|
26
|
-
"@webiny/cli-core": "0.0.0-unstable.
|
|
23
|
+
"@webiny/api-headless-cms": "0.0.0-unstable.a4f3e4ea8b",
|
|
24
|
+
"@webiny/aws-layers": "0.0.0-unstable.a4f3e4ea8b",
|
|
25
|
+
"@webiny/aws-sdk": "0.0.0-unstable.a4f3e4ea8b",
|
|
26
|
+
"@webiny/cli-core": "0.0.0-unstable.a4f3e4ea8b",
|
|
27
27
|
"@webiny/di": "1.0.2",
|
|
28
|
-
"@webiny/project": "0.0.0-unstable.
|
|
29
|
-
"@webiny/pulumi": "0.0.0-unstable.
|
|
30
|
-
"@webiny/utils": "0.0.0-unstable.
|
|
28
|
+
"@webiny/project": "0.0.0-unstable.a4f3e4ea8b",
|
|
29
|
+
"@webiny/pulumi": "0.0.0-unstable.a4f3e4ea8b",
|
|
30
|
+
"@webiny/utils": "0.0.0-unstable.a4f3e4ea8b",
|
|
31
31
|
"chalk": "5.6.2",
|
|
32
32
|
"email-addresses": "5.0.0",
|
|
33
33
|
"find-up": "8.0.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/lodash": "4.17.24",
|
|
44
44
|
"@types/ncp": "2.0.8",
|
|
45
|
-
"@webiny/build-tools": "0.0.0-unstable.
|
|
45
|
+
"@webiny/build-tools": "0.0.0-unstable.a4f3e4ea8b",
|
|
46
46
|
"typescript": "7.0.2",
|
|
47
47
|
"vitest": "4.1.10"
|
|
48
48
|
},
|
package/project.d.ts
CHANGED
|
@@ -46,7 +46,6 @@ export declare const Project: {
|
|
|
46
46
|
}, import("zod/v4/core").$strip>>;
|
|
47
47
|
}, import("zod/v4/core").$strip>>;
|
|
48
48
|
}, import("zod/v4/core").$strip>>;
|
|
49
|
-
abTesting: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
50
49
|
}, import("zod/v4/core").$strip>;
|
|
51
50
|
}, import("zod/v4/core").$strip>>;
|
|
52
51
|
};
|
|
@@ -14,11 +14,12 @@ const createAdminPulumiApp = async ()=>{
|
|
|
14
14
|
domains: ()=>{
|
|
15
15
|
const [adminDomains] = projectConfig.extensionsByType(AdminCustomDomains);
|
|
16
16
|
if (adminDomains) {
|
|
17
|
-
const { domains, sslMethod, certificateArn } = adminDomains.params;
|
|
17
|
+
const { domains, sslMethod, certificateArn, minimumProtocolVersion } = adminDomains.params;
|
|
18
18
|
return {
|
|
19
19
|
domains,
|
|
20
20
|
sslSupportMethod: sslMethod,
|
|
21
|
-
acmCertificateArn: certificateArn
|
|
21
|
+
acmCertificateArn: certificateArn,
|
|
22
|
+
minimumProtocolVersion
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
25
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pulumi/apps/admin/createAdminPulumiApp.js","sources":["../../../../src/pulumi/apps/admin/createAdminPulumiApp.ts"],"sourcesContent":["import { createReactPulumiApp } from \"~/pulumi/apps/index.js\";\nimport { getProjectSdk } from \"@webiny/project\";\nimport { AdminPulumi, SetAdminCustomDomains } from \"~/abstractions/features/pulumi/index.js\";\nimport { adminPulumi } from \"~/pulumi/features/AdminPulumi/index.js\";\nimport { DefaultSetAdminCustomDomains } from \"~/pulumi/features/DefaultSetAdminCustomDomains.js\";\nimport { AdminCustomDomains as adminCustomDomainsExt } from \"~/pulumi/extensions/AdminCustomDomains.js\";\nimport { withServiceManifest } from \"~/pulumi/index.js\";\n\nexport type AdminPulumiApp = ReturnType<typeof createReactPulumiApp>;\n\nexport const createAdminPulumiApp = async () => {\n const sdk = await getProjectSdk();\n const projectConfig = await sdk.getProjectConfig();\n const baseApp = createReactPulumiApp({\n name: \"admin\",\n folder: \"apps/admin\",\n domains: () => {\n const [adminDomains] = projectConfig.extensionsByType(adminCustomDomainsExt);\n\n if (adminDomains) {\n const { domains, sslMethod, certificateArn }
|
|
1
|
+
{"version":3,"file":"pulumi/apps/admin/createAdminPulumiApp.js","sources":["../../../../src/pulumi/apps/admin/createAdminPulumiApp.ts"],"sourcesContent":["import { createReactPulumiApp } from \"~/pulumi/apps/index.js\";\nimport { getProjectSdk } from \"@webiny/project\";\nimport { AdminPulumi, SetAdminCustomDomains } from \"~/abstractions/features/pulumi/index.js\";\nimport { adminPulumi } from \"~/pulumi/features/AdminPulumi/index.js\";\nimport { DefaultSetAdminCustomDomains } from \"~/pulumi/features/DefaultSetAdminCustomDomains.js\";\nimport { AdminCustomDomains as adminCustomDomainsExt } from \"~/pulumi/extensions/AdminCustomDomains.js\";\nimport { withServiceManifest } from \"~/pulumi/index.js\";\n\nexport type AdminPulumiApp = ReturnType<typeof createReactPulumiApp>;\n\nexport const createAdminPulumiApp = async () => {\n const sdk = await getProjectSdk();\n const projectConfig = await sdk.getProjectConfig();\n const baseApp = createReactPulumiApp({\n name: \"admin\",\n folder: \"apps/admin\",\n domains: () => {\n const [adminDomains] = projectConfig.extensionsByType(adminCustomDomainsExt);\n\n if (adminDomains) {\n const { domains, sslMethod, certificateArn, minimumProtocolVersion } =\n adminDomains.params;\n return {\n domains,\n sslSupportMethod: sslMethod,\n acmCertificateArn: certificateArn,\n minimumProtocolVersion\n };\n }\n\n return undefined;\n },\n pulumi: async app => {\n // Overrides must be applied via a handler, registered at the very start of the program.\n // By doing this, we're ensuring user's adjustments are not applied to late.\n sdk.getContainer().registerComposite(adminPulumi);\n\n // Make the `SetAdminCustomDomains` service injectable into user-defined `AdminPulumi`\n // implementations. This allows applying custom domains using dynamically created\n // Pulumi resources (e.g. ACM certificates), from within a single implementation file.\n // We register an instance (bound to the current `app`) so that user implementations\n // only need to pass the custom domain params - not the `app` itself.\n sdk.getContainer().registerInstance(\n SetAdminCustomDomains,\n new DefaultSetAdminCustomDomains(app as AdminPulumiApp)\n );\n\n const pulumiHandlers = sdk.getContainer().resolve(AdminPulumi);\n\n app.addHandler(() => {\n return pulumiHandlers.execute(app as AdminPulumiApp);\n });\n }\n });\n\n const app = withServiceManifest(baseApp);\n\n app.addHandler(() => {\n app.addServiceManifest({\n name: \"admin\",\n manifest: {\n cloudfront: {\n distributionId: baseApp.resources.cloudfront.output.id,\n domain: baseApp.resources.cloudfront.output.domainName.apply(\n v => `https://${v}`\n )\n }\n }\n });\n });\n\n return app;\n};\n"],"names":["createAdminPulumiApp","sdk","getProjectSdk","projectConfig","baseApp","createReactPulumiApp","adminDomains","adminCustomDomainsExt","domains","sslMethod","certificateArn","minimumProtocolVersion","app","adminPulumi","SetAdminCustomDomains","DefaultSetAdminCustomDomains","pulumiHandlers","AdminPulumi","withServiceManifest","v"],"mappings":";;;;;;;AAUO,MAAMA,uBAAuB;IAChC,MAAMC,MAAM,MAAMC;IAClB,MAAMC,gBAAgB,MAAMF,IAAI,gBAAgB;IAChD,MAAMG,UAAUC,qBAAqB;QACjC,MAAM;QACN,QAAQ;QACR,SAAS;YACL,MAAM,CAACC,aAAa,GAAGH,cAAc,gBAAgB,CAACI;YAEtD,IAAID,cAAc;gBACd,MAAM,EAAEE,OAAO,EAAEC,SAAS,EAAEC,cAAc,EAAEC,sBAAsB,EAAE,GAChEL,aAAa,MAAM;gBACvB,OAAO;oBACHE;oBACA,kBAAkBC;oBAClB,mBAAmBC;oBACnBC;gBACJ;YACJ;QAGJ;QACA,QAAQ,OAAMC;YAGVX,IAAI,YAAY,GAAG,iBAAiB,CAACY;YAOrCZ,IAAI,YAAY,GAAG,gBAAgB,CAC/Ba,uBACA,IAAIC,6BAA6BH;YAGrC,MAAMI,iBAAiBf,IAAI,YAAY,GAAG,OAAO,CAACgB;YAElDL,IAAI,UAAU,CAAC,IACJI,eAAe,OAAO,CAACJ;QAEtC;IACJ;IAEA,MAAMA,MAAMM,oBAAoBd;IAEhCQ,IAAI,UAAU,CAAC;QACXA,IAAI,kBAAkB,CAAC;YACnB,MAAM;YACN,UAAU;gBACN,YAAY;oBACR,gBAAgBR,QAAQ,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;oBACtD,QAAQA,QAAQ,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CACxDe,CAAAA,IAAK,CAAC,QAAQ,EAAEA,GAAG;gBAE3B;YACJ;QACJ;IACJ;IAEA,OAAOP;AACX"}
|
|
@@ -6,6 +6,7 @@ import { applyAwsResourceTags, getAwsAccountId } from "../awsUtils.js";
|
|
|
6
6
|
import { ApiScheduler } from "./ApiScheduler.js";
|
|
7
7
|
import { getProjectSdk } from "@webiny/project";
|
|
8
8
|
import { getVpcConfigFromExtension } from "../extensions/getVpcConfigFromExtension.js";
|
|
9
|
+
import { isVpcEnabled } from "../extensions/isVpcEnabled.js";
|
|
9
10
|
import { getOsConfigFromExtension } from "../extensions/getOsConfigFromExtension.js";
|
|
10
11
|
import { handleGuardDutyEvents } from "./handleGuardDutyEvents.js";
|
|
11
12
|
import { ApiPulumi, SetApiCustomDomains } from "../../../abstractions/features/pulumi/index.js";
|
|
@@ -73,9 +74,8 @@ const createApiPulumiApp = ()=>{
|
|
|
73
74
|
app.addHandler(()=>pulumiHandlers.execute(app));
|
|
74
75
|
const isProduction = app.env.isProduction;
|
|
75
76
|
const core = app.addModule(CoreOutput);
|
|
76
|
-
const vpcEnabled = true === vpcExtensionsConfig || "object" == typeof vpcExtensionsConfig || isProduction;
|
|
77
77
|
app.addModule(VpcConfig, {
|
|
78
|
-
enabled:
|
|
78
|
+
enabled: isVpcEnabled(vpcExtensionsConfig, isProduction)
|
|
79
79
|
});
|
|
80
80
|
const graphql = app.addModule(ApiGraphql, {
|
|
81
81
|
env: {
|
|
@@ -153,11 +153,12 @@ const createApiPulumiApp = ()=>{
|
|
|
153
153
|
const scheduler = app.addModule(ApiScheduler);
|
|
154
154
|
const [apiCustomDomains] = projectConfig.extensionsByType(ApiCustomDomains);
|
|
155
155
|
if (apiCustomDomains) {
|
|
156
|
-
const { domains, sslMethod, certificateArn } = apiCustomDomains.params;
|
|
156
|
+
const { domains, sslMethod, certificateArn, minimumProtocolVersion } = apiCustomDomains.params;
|
|
157
157
|
applyCustomDomain(cloudfront, {
|
|
158
158
|
domains,
|
|
159
159
|
sslSupportMethod: sslMethod,
|
|
160
|
-
acmCertificateArn: certificateArn
|
|
160
|
+
acmCertificateArn: certificateArn,
|
|
161
|
+
minimumProtocolVersion
|
|
161
162
|
});
|
|
162
163
|
}
|
|
163
164
|
app.addOutputs({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pulumi/apps/api/createApiPulumiApp.js","sources":["../../../../src/pulumi/apps/api/createApiPulumiApp.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { createPulumiApp, isResourceOfType, type PulumiApp } from \"@webiny/pulumi\";\nimport {\n ApiBackgroundTask,\n ApiCloudfront,\n ApiFileManager,\n ApiGateway,\n ApiGraphql,\n ApiWebsocket,\n CoreOutput,\n VpcConfig\n} from \"~/pulumi/apps/index.js\";\nimport {\n addDomainsUrlsOutputs,\n withCommonLambdaEnvVariables,\n withServiceManifest\n} from \"~/pulumi/utils/index.js\";\nimport { getEnvVariableAwsRegion } from \"~/pulumi/env/awsRegion.js\";\n// import { attachSyncSystem } from \"../syncSystem/api/index.js\";\nimport { applyAwsResourceTags, getAwsAccountId } from \"~/pulumi/apps/awsUtils.js\";\nimport type { WithServiceManifest } from \"~/pulumi/utils/withServiceManifest.js\";\nimport { ApiScheduler } from \"~/pulumi/apps/api/ApiScheduler.js\";\nimport { getProjectSdk } from \"@webiny/project\";\nimport { getVpcConfigFromExtension } from \"~/pulumi/apps/extensions/getVpcConfigFromExtension.js\";\nimport { getOsConfigFromExtension } from \"~/pulumi/apps/extensions/getOsConfigFromExtension.js\";\nimport { handleGuardDutyEvents } from \"./handleGuardDutyEvents.js\";\nimport { ApiPulumi, SetApiCustomDomains } from \"~/abstractions/features/pulumi/index.js\";\nimport { apiPulumi } from \"~/pulumi/features/ApiPulumi/index.js\";\nimport { DefaultSetApiCustomDomains } from \"~/pulumi/features/DefaultSetApiCustomDomains.js\";\nimport { ApiCustomDomains as apiCustomDomainsExt } from \"~/pulumi/extensions/ApiCustomDomains.js\";\nimport { applyCustomDomain } from \"~/pulumi/apps/customDomain.js\";\n\nexport type ApiPulumiApp = ReturnType<typeof createApiPulumiApp>;\n\nexport const createApiPulumiApp = () => {\n const baseApp = createPulumiApp({\n name: \"api\",\n path: \"apps/api\",\n program: async (app: PulumiApp & WithServiceManifest) => {\n const sdk = await getProjectSdk();\n const projectConfig = await sdk.getProjectConfig();\n\n const pulumiResourceNamePrefix = await sdk.getPulumiResourceNamePrefix();\n const vpcExtensionsConfig = getVpcConfigFromExtension(projectConfig);\n const openSearchExtensionConfig = getOsConfigFromExtension(projectConfig);\n\n let searchEngineParams: typeof openSearchExtensionConfig | null = null;\n\n if (openSearchExtensionConfig) {\n searchEngineParams = openSearchExtensionConfig;\n }\n\n if (searchEngineParams) {\n const params = searchEngineParams;\n if (typeof params === \"object\") {\n if (params.endpoint) {\n process.env.OPENSEARCH_ENDPOINT = params.endpoint;\n }\n\n if (params.domainName) {\n process.env.AWS_OS_DOMAIN_NAME = params.domainName;\n }\n\n if (params.indexPrefix) {\n process.env.OPENSEARCH_INDEX_PREFIX = params.indexPrefix;\n }\n\n if (params.sharedIndexes) {\n process.env.OPENSEARCH_SHARED_INDEXES = \"true\";\n }\n\n if (params.username) {\n process.env.OPENSEARCH_USERNAME = params.username;\n }\n\n if (params.password) {\n process.env.OPENSEARCH_PASSWORD = params.password;\n }\n }\n }\n\n if (pulumiResourceNamePrefix) {\n app.onResource(resource => {\n if (!resource.name.startsWith(pulumiResourceNamePrefix)) {\n resource.name = `${pulumiResourceNamePrefix}${resource.name}`;\n }\n });\n }\n\n // <-------------------- Enterprise start -------------------->\n app.addHandler(async () => {\n const featureFlags = await sdk.getFeatureFlags();\n\n const usingAdvancedVpcParams =\n vpcExtensionsConfig && typeof vpcExtensionsConfig !== \"boolean\";\n\n if (featureFlags.isFileManagerThreatDetectionEnabled()) {\n handleGuardDutyEvents(app as ApiPulumiApp);\n }\n\n // Not using advanced VPC params? Then immediately exit.\n if (usingAdvancedVpcParams) {\n const { onResource, addResource } = app;\n const { useExistingVpc } = vpcExtensionsConfig;\n\n // 1. We first deal with \"existing VPC\" setup.\n if (useExistingVpc) {\n if (!useExistingVpc.lambdaFunctionsVpcConfig) {\n throw new Error(\n \"Cannot specify `useExistingVpc` parameter because the `lambdaFunctionsVpcConfig` parameter wasn't provided.\"\n );\n }\n\n onResource(resource => {\n if (isResourceOfType(resource, aws.lambda.Function)) {\n const canUseVpc = resource.meta.canUseVpc !== false;\n if (canUseVpc) {\n resource.config.vpcConfig(\n useExistingVpc!.lambdaFunctionsVpcConfig\n );\n }\n }\n\n if (isResourceOfType(resource, aws.iam.Role)) {\n if (resource.meta.isLambdaFunctionRole) {\n addResource(aws.iam.RolePolicyAttachment, {\n name: `${resource.name}-vpc-access-execution-role`,\n config: {\n role: resource.output.name,\n policyArn:\n aws.iam.ManagedPolicy\n .AWSLambdaVPCAccessExecutionRole\n }\n });\n }\n }\n });\n }\n }\n });\n // <-------------------- Enterprise end -------------------->\n\n // Overrides must be applied via a handler, registered at the very start of the program.\n // By doing this, we're ensuring user's adjustments are not applied to late.\n sdk.getContainer().registerComposite(apiPulumi);\n\n // Make the `SetApiCustomDomains` service injectable into user-defined `ApiPulumi`\n // implementations. This allows applying custom domains using dynamically created\n // Pulumi resources (e.g. ACM certificates), from within a single implementation file.\n // We register an instance (bound to the current `app`) so that user implementations\n // only need to pass the custom domain params - not the `app` itself.\n sdk.getContainer().registerInstance(\n SetApiCustomDomains,\n new DefaultSetApiCustomDomains(app as ApiPulumiApp)\n );\n\n const pulumiHandlers = sdk.getContainer().resolve(ApiPulumi);\n\n app.addHandler(() => {\n return pulumiHandlers.execute(app as ApiPulumiApp);\n });\n\n const isProduction = app.env.isProduction;\n\n // Register core output as a module available to all the other modules\n const core = app.addModule(CoreOutput);\n\n // Register VPC config module to be available to other modules.\n const vpcEnabled =\n vpcExtensionsConfig === true ||\n typeof vpcExtensionsConfig === \"object\" ||\n isProduction;\n\n app.addModule(VpcConfig, { enabled: vpcEnabled });\n\n const graphql = app.addModule(ApiGraphql, {\n env: {\n COGNITO_REGION: getEnvVariableAwsRegion(),\n COGNITO_USER_POOL_ID: core.cognitoUserPoolId,\n DB_TABLE: core.primaryDynamodbTableName,\n DB_TABLE_AUDIT_LOGS: core.auditLogsDynamodbTableName,\n DB_TABLE_OPENSEARCH: core.opensearchDynamodbTableName,\n OPENSEARCH_ENDPOINT: core.opensearchDomainEndpoint,\n\n // Not required. Useful for testing purposes / ephemeral environments.\n // https://www.webiny.com/docs/key-topics/ci-cd/testing/slow-ephemeral-environments\n OPENSEARCH_INDEX_PREFIX: process.env.OPENSEARCH_INDEX_PREFIX,\n OPENSEARCH_SHARED_INDEXES: process.env.OPENSEARCH_SHARED_INDEXES,\n OPENSEARCH_USERNAME: process.env.OPENSEARCH_USERNAME,\n OPENSEARCH_PASSWORD: process.env.OPENSEARCH_PASSWORD,\n\n S3_BUCKET: core.fileManagerBucketId,\n EVENT_BUS: core.eventBusArn,\n // TODO: move to okta plugin\n OKTA_ISSUER: process.env[\"OKTA_ISSUER\"]\n }\n });\n\n const websocket = app.addModule(ApiWebsocket);\n\n const fileManager = app.addModule(ApiFileManager, {\n env: {\n DB_TABLE: core.primaryDynamodbTableName,\n DB_TABLE_AUDIT_LOGS: core.auditLogsDynamodbTableName\n }\n });\n\n const apiGateway = app.addModule(ApiGateway, {\n \"graphql-post\": {\n path: \"/graphql\",\n method: \"POST\",\n function: graphql.functions.graphql.output.arn\n },\n \"graphql-options\": {\n path: \"/graphql\",\n method: \"OPTIONS\",\n function: graphql.functions.graphql.output.arn\n },\n \"files-any\": {\n path: \"/files/{path+}\",\n method: \"ANY\",\n function: fileManager.functions.download.output.arn\n },\n \"private-any\": {\n path: \"/private/{path+}\",\n method: \"ANY\",\n function: fileManager.functions.download.output.arn\n },\n \"cms-post\": {\n path: \"/cms/{key+}\",\n method: \"POST\",\n function: graphql.functions.graphql.output.arn\n },\n \"cms-options\": {\n path: \"/cms/{key+}\",\n method: \"OPTIONS\",\n function: graphql.functions.graphql.output.arn\n },\n \"redirects-get\": {\n path: \"/wb/redirects\",\n method: \"GET\",\n function: graphql.functions.graphql.output.arn\n },\n \"redirects-options\": {\n path: \"/wb/redirects\",\n method: \"OPTIONS\",\n function: graphql.functions.graphql.output.arn\n },\n \"files-catch-all\": {\n path: \"/{path+}\",\n method: \"ANY\",\n function: fileManager.functions.download.output.arn\n }\n });\n\n const cloudfront = app.addModule(ApiCloudfront);\n const backgroundTask = app.addModule(ApiBackgroundTask);\n const scheduler = app.addModule(ApiScheduler);\n\n const [apiCustomDomains] = projectConfig.extensionsByType(apiCustomDomainsExt);\n if (apiCustomDomains) {\n const { domains, sslMethod, certificateArn } = apiCustomDomains.params;\n applyCustomDomain(cloudfront, {\n domains,\n sslSupportMethod: sslMethod,\n acmCertificateArn: certificateArn\n });\n }\n\n app.addOutputs({\n awsAccountId: getAwsAccountId(app),\n region: aws.config.region,\n cognitoUserPoolId: core.cognitoUserPoolId,\n cognitoAppClientId: core.cognitoAppClientId,\n cognitoUserPoolPasswordPolicy: core.cognitoUserPoolPasswordPolicy,\n dynamoDbTable: core.primaryDynamodbTableName,\n auditLogsDynamoDbTable: core.auditLogsDynamodbTableName,\n graphqlLambdaName: graphql.functions.graphql.output.name,\n graphqlLambdaRole: graphql.role.output.arn,\n graphqlLambdaRoleName: graphql.role.output.name,\n backgroundTaskLambdaArn: backgroundTask.backgroundTask.output.arn,\n backgroundTaskStepFunctionArn: backgroundTask.stepFunction.output.arn,\n fileManagerDownloadLambdaArn: fileManager.functions.download.output.arn,\n websocketApiId: websocket.websocketApi.output.id,\n websocketApiUrl: websocket.websocketApiUrl,\n schedulerLambdaInvokeRole: scheduler.invokeRole.output.arn\n });\n\n // Only add `dynamoDbOpensearchTable` output if using search engine (ES/OS).\n if (searchEngineParams) {\n app.addOutputs({\n dynamoDbOpensearchTable: core.opensearchDynamodbTableName\n });\n }\n\n app.addHandler(() => {\n addDomainsUrlsOutputs({\n app,\n cloudfrontDistribution: cloudfront,\n map: {\n distributionDomain: \"cloudfrontApiDomain\",\n distributionUrl: \"cloudfrontApiUrl\",\n usedDomain: \"apiDomain\",\n usedUrl: \"apiUrl\"\n }\n });\n });\n // /**\n // * We need to attach the Sync System if it exists.\n // */\n // await attachSyncSystem({\n // app,\n // core,\n // env: app.params.run.env\n // });\n\n // Applies internal and user-defined AWS tags.\n await applyAwsResourceTags(\"api\");\n\n return {\n fileManager,\n graphql,\n apiGateway,\n websocket,\n cloudfront,\n backgroundTask,\n scheduler\n };\n }\n });\n\n const app = withServiceManifest(withCommonLambdaEnvVariables(baseApp));\n\n app.addHandler(() => {\n app.addServiceManifest({\n name: \"api\",\n manifest: {\n bgTaskSfn: baseApp.resources.backgroundTask.stepFunction.output.arn,\n cloudfront: {\n distributionId: baseApp.resources.cloudfront.output.id,\n domain: baseApp.resources.cloudfront.output.domainName.apply(\n v => `https://${v}`\n )\n }\n }\n });\n\n app.addServiceManifest({\n name: \"scheduler\",\n manifest: {\n lambdaArn: baseApp.resources.graphql.functions.graphql.output.arn,\n roleArn: baseApp.resources.scheduler.invokeRole.output.arn\n }\n });\n });\n\n return app;\n};\n"],"names":["createApiPulumiApp","baseApp","createPulumiApp","app","sdk","getProjectSdk","projectConfig","pulumiResourceNamePrefix","vpcExtensionsConfig","getVpcConfigFromExtension","openSearchExtensionConfig","getOsConfigFromExtension","searchEngineParams","params","process","resource","featureFlags","usingAdvancedVpcParams","handleGuardDutyEvents","onResource","addResource","useExistingVpc","Error","isResourceOfType","aws","canUseVpc","apiPulumi","SetApiCustomDomains","DefaultSetApiCustomDomains","pulumiHandlers","ApiPulumi","isProduction","core","CoreOutput","vpcEnabled","VpcConfig","graphql","ApiGraphql","getEnvVariableAwsRegion","websocket","ApiWebsocket","fileManager","ApiFileManager","apiGateway","ApiGateway","cloudfront","ApiCloudfront","backgroundTask","ApiBackgroundTask","scheduler","ApiScheduler","apiCustomDomains","apiCustomDomainsExt","domains","sslMethod","certificateArn","applyCustomDomain","getAwsAccountId","addDomainsUrlsOutputs","applyAwsResourceTags","withServiceManifest","withCommonLambdaEnvVariables","v"],"mappings":";;;;;;;;;;;;;;;;AAkCO,MAAMA,qBAAqB;IAC9B,MAAMC,UAAUC,gBAAgB;QAC5B,MAAM;QACN,MAAM;QACN,SAAS,OAAOC;YACZ,MAAMC,MAAM,MAAMC;YAClB,MAAMC,gBAAgB,MAAMF,IAAI,gBAAgB;YAEhD,MAAMG,2BAA2B,MAAMH,IAAI,2BAA2B;YACtE,MAAMI,sBAAsBC,0BAA0BH;YACtD,MAAMI,4BAA4BC,yBAAyBL;YAE3D,IAAIM,qBAA8D;YAElE,IAAIF,2BACAE,qBAAqBF;YAGzB,IAAIE,oBAAoB;gBACpB,MAAMC,SAASD;gBACf,IAAI,AAAkB,YAAlB,OAAOC,QAAqB;oBAC5B,IAAIA,OAAO,QAAQ,EACfC,QAAQ,GAAG,CAAC,mBAAmB,GAAGD,OAAO,QAAQ;oBAGrD,IAAIA,OAAO,UAAU,EACjBC,QAAQ,GAAG,CAAC,kBAAkB,GAAGD,OAAO,UAAU;oBAGtD,IAAIA,OAAO,WAAW,EAClBC,QAAQ,GAAG,CAAC,uBAAuB,GAAGD,OAAO,WAAW;oBAG5D,IAAIA,OAAO,aAAa,EACpBC,QAAQ,GAAG,CAAC,yBAAyB,GAAG;oBAG5C,IAAID,OAAO,QAAQ,EACfC,QAAQ,GAAG,CAAC,mBAAmB,GAAGD,OAAO,QAAQ;oBAGrD,IAAIA,OAAO,QAAQ,EACfC,QAAQ,GAAG,CAAC,mBAAmB,GAAGD,OAAO,QAAQ;gBAEzD;YACJ;YAEA,IAAIN,0BACAJ,IAAI,UAAU,CAACY,CAAAA;gBACX,IAAI,CAACA,SAAS,IAAI,CAAC,UAAU,CAACR,2BAC1BQ,SAAS,IAA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EAAE;oBACtD,QAAQA,QAAQ,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CACxD6D,CAAAA,IAAK,CAAC,QAAQ,EAAEA,GAAG;gBAE3B;YACJ;QACJ;QAEA3D,IAAI,kBAAkB,CAAC;YACnB,MAAM;YACN,UAAU;gBACN,WAAWF,QAAQ,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG;gBACjE,SAASA,QAAQ,SAAS,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG;YAC9D;QACJ;IACJ;IAEA,OAAOE;AACX"}
|
|
1
|
+
{"version":3,"file":"pulumi/apps/api/createApiPulumiApp.js","sources":["../../../../src/pulumi/apps/api/createApiPulumiApp.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { createPulumiApp, isResourceOfType, type PulumiApp } from \"@webiny/pulumi\";\nimport {\n ApiBackgroundTask,\n ApiCloudfront,\n ApiFileManager,\n ApiGateway,\n ApiGraphql,\n ApiWebsocket,\n CoreOutput,\n VpcConfig\n} from \"~/pulumi/apps/index.js\";\nimport {\n addDomainsUrlsOutputs,\n withCommonLambdaEnvVariables,\n withServiceManifest\n} from \"~/pulumi/utils/index.js\";\nimport { getEnvVariableAwsRegion } from \"~/pulumi/env/awsRegion.js\";\n// import { attachSyncSystem } from \"../syncSystem/api/index.js\";\nimport { applyAwsResourceTags, getAwsAccountId } from \"~/pulumi/apps/awsUtils.js\";\nimport type { WithServiceManifest } from \"~/pulumi/utils/withServiceManifest.js\";\nimport { ApiScheduler } from \"~/pulumi/apps/api/ApiScheduler.js\";\nimport { getProjectSdk } from \"@webiny/project\";\nimport { getVpcConfigFromExtension } from \"~/pulumi/apps/extensions/getVpcConfigFromExtension.js\";\nimport { isVpcEnabled } from \"~/pulumi/apps/extensions/isVpcEnabled.js\";\nimport { getOsConfigFromExtension } from \"~/pulumi/apps/extensions/getOsConfigFromExtension.js\";\nimport { handleGuardDutyEvents } from \"./handleGuardDutyEvents.js\";\nimport { ApiPulumi, SetApiCustomDomains } from \"~/abstractions/features/pulumi/index.js\";\nimport { apiPulumi } from \"~/pulumi/features/ApiPulumi/index.js\";\nimport { DefaultSetApiCustomDomains } from \"~/pulumi/features/DefaultSetApiCustomDomains.js\";\nimport { ApiCustomDomains as apiCustomDomainsExt } from \"~/pulumi/extensions/ApiCustomDomains.js\";\nimport { applyCustomDomain } from \"~/pulumi/apps/customDomain.js\";\n\nexport type ApiPulumiApp = ReturnType<typeof createApiPulumiApp>;\n\nexport const createApiPulumiApp = () => {\n const baseApp = createPulumiApp({\n name: \"api\",\n path: \"apps/api\",\n program: async (app: PulumiApp & WithServiceManifest) => {\n const sdk = await getProjectSdk();\n const projectConfig = await sdk.getProjectConfig();\n\n const pulumiResourceNamePrefix = await sdk.getPulumiResourceNamePrefix();\n const vpcExtensionsConfig = getVpcConfigFromExtension(projectConfig);\n const openSearchExtensionConfig = getOsConfigFromExtension(projectConfig);\n\n let searchEngineParams: typeof openSearchExtensionConfig | null = null;\n\n if (openSearchExtensionConfig) {\n searchEngineParams = openSearchExtensionConfig;\n }\n\n if (searchEngineParams) {\n const params = searchEngineParams;\n if (typeof params === \"object\") {\n if (params.endpoint) {\n process.env.OPENSEARCH_ENDPOINT = params.endpoint;\n }\n\n if (params.domainName) {\n process.env.AWS_OS_DOMAIN_NAME = params.domainName;\n }\n\n if (params.indexPrefix) {\n process.env.OPENSEARCH_INDEX_PREFIX = params.indexPrefix;\n }\n\n if (params.sharedIndexes) {\n process.env.OPENSEARCH_SHARED_INDEXES = \"true\";\n }\n\n if (params.username) {\n process.env.OPENSEARCH_USERNAME = params.username;\n }\n\n if (params.password) {\n process.env.OPENSEARCH_PASSWORD = params.password;\n }\n }\n }\n\n if (pulumiResourceNamePrefix) {\n app.onResource(resource => {\n if (!resource.name.startsWith(pulumiResourceNamePrefix)) {\n resource.name = `${pulumiResourceNamePrefix}${resource.name}`;\n }\n });\n }\n\n // <-------------------- Enterprise start -------------------->\n app.addHandler(async () => {\n const featureFlags = await sdk.getFeatureFlags();\n\n const usingAdvancedVpcParams =\n vpcExtensionsConfig && typeof vpcExtensionsConfig !== \"boolean\";\n\n if (featureFlags.isFileManagerThreatDetectionEnabled()) {\n handleGuardDutyEvents(app as ApiPulumiApp);\n }\n\n // Not using advanced VPC params? Then immediately exit.\n if (usingAdvancedVpcParams) {\n const { onResource, addResource } = app;\n const { useExistingVpc } = vpcExtensionsConfig;\n\n // 1. We first deal with \"existing VPC\" setup.\n if (useExistingVpc) {\n if (!useExistingVpc.lambdaFunctionsVpcConfig) {\n throw new Error(\n \"Cannot specify `useExistingVpc` parameter because the `lambdaFunctionsVpcConfig` parameter wasn't provided.\"\n );\n }\n\n onResource(resource => {\n if (isResourceOfType(resource, aws.lambda.Function)) {\n const canUseVpc = resource.meta.canUseVpc !== false;\n if (canUseVpc) {\n resource.config.vpcConfig(\n useExistingVpc!.lambdaFunctionsVpcConfig\n );\n }\n }\n\n if (isResourceOfType(resource, aws.iam.Role)) {\n if (resource.meta.isLambdaFunctionRole) {\n addResource(aws.iam.RolePolicyAttachment, {\n name: `${resource.name}-vpc-access-execution-role`,\n config: {\n role: resource.output.name,\n policyArn:\n aws.iam.ManagedPolicy\n .AWSLambdaVPCAccessExecutionRole\n }\n });\n }\n }\n });\n }\n }\n });\n // <-------------------- Enterprise end -------------------->\n\n // Overrides must be applied via a handler, registered at the very start of the program.\n // By doing this, we're ensuring user's adjustments are not applied to late.\n sdk.getContainer().registerComposite(apiPulumi);\n\n // Make the `SetApiCustomDomains` service injectable into user-defined `ApiPulumi`\n // implementations. This allows applying custom domains using dynamically created\n // Pulumi resources (e.g. ACM certificates), from within a single implementation file.\n // We register an instance (bound to the current `app`) so that user implementations\n // only need to pass the custom domain params - not the `app` itself.\n sdk.getContainer().registerInstance(\n SetApiCustomDomains,\n new DefaultSetApiCustomDomains(app as ApiPulumiApp)\n );\n\n const pulumiHandlers = sdk.getContainer().resolve(ApiPulumi);\n\n app.addHandler(() => {\n return pulumiHandlers.execute(app as ApiPulumiApp);\n });\n\n const isProduction = app.env.isProduction;\n\n // Register core output as a module available to all the other modules\n const core = app.addModule(CoreOutput);\n\n // Register VPC config module to be available to other modules.\n app.addModule(VpcConfig, {\n enabled: isVpcEnabled(vpcExtensionsConfig, isProduction)\n });\n\n const graphql = app.addModule(ApiGraphql, {\n env: {\n COGNITO_REGION: getEnvVariableAwsRegion(),\n COGNITO_USER_POOL_ID: core.cognitoUserPoolId,\n DB_TABLE: core.primaryDynamodbTableName,\n DB_TABLE_AUDIT_LOGS: core.auditLogsDynamodbTableName,\n DB_TABLE_OPENSEARCH: core.opensearchDynamodbTableName,\n OPENSEARCH_ENDPOINT: core.opensearchDomainEndpoint,\n\n // Not required. Useful for testing purposes / ephemeral environments.\n // https://www.webiny.com/docs/key-topics/ci-cd/testing/slow-ephemeral-environments\n OPENSEARCH_INDEX_PREFIX: process.env.OPENSEARCH_INDEX_PREFIX,\n OPENSEARCH_SHARED_INDEXES: process.env.OPENSEARCH_SHARED_INDEXES,\n OPENSEARCH_USERNAME: process.env.OPENSEARCH_USERNAME,\n OPENSEARCH_PASSWORD: process.env.OPENSEARCH_PASSWORD,\n\n S3_BUCKET: core.fileManagerBucketId,\n EVENT_BUS: core.eventBusArn,\n // TODO: move to okta plugin\n OKTA_ISSUER: process.env[\"OKTA_ISSUER\"]\n }\n });\n\n const websocket = app.addModule(ApiWebsocket);\n\n const fileManager = app.addModule(ApiFileManager, {\n env: {\n DB_TABLE: core.primaryDynamodbTableName,\n DB_TABLE_AUDIT_LOGS: core.auditLogsDynamodbTableName\n }\n });\n\n const apiGateway = app.addModule(ApiGateway, {\n \"graphql-post\": {\n path: \"/graphql\",\n method: \"POST\",\n function: graphql.functions.graphql.output.arn\n },\n \"graphql-options\": {\n path: \"/graphql\",\n method: \"OPTIONS\",\n function: graphql.functions.graphql.output.arn\n },\n \"files-any\": {\n path: \"/files/{path+}\",\n method: \"ANY\",\n function: fileManager.functions.download.output.arn\n },\n \"private-any\": {\n path: \"/private/{path+}\",\n method: \"ANY\",\n function: fileManager.functions.download.output.arn\n },\n \"cms-post\": {\n path: \"/cms/{key+}\",\n method: \"POST\",\n function: graphql.functions.graphql.output.arn\n },\n \"cms-options\": {\n path: \"/cms/{key+}\",\n method: \"OPTIONS\",\n function: graphql.functions.graphql.output.arn\n },\n \"redirects-get\": {\n path: \"/wb/redirects\",\n method: \"GET\",\n function: graphql.functions.graphql.output.arn\n },\n \"redirects-options\": {\n path: \"/wb/redirects\",\n method: \"OPTIONS\",\n function: graphql.functions.graphql.output.arn\n },\n \"files-catch-all\": {\n path: \"/{path+}\",\n method: \"ANY\",\n function: fileManager.functions.download.output.arn\n }\n });\n\n const cloudfront = app.addModule(ApiCloudfront);\n const backgroundTask = app.addModule(ApiBackgroundTask);\n const scheduler = app.addModule(ApiScheduler);\n\n const [apiCustomDomains] = projectConfig.extensionsByType(apiCustomDomainsExt);\n if (apiCustomDomains) {\n const { domains, sslMethod, certificateArn, minimumProtocolVersion } =\n apiCustomDomains.params;\n applyCustomDomain(cloudfront, {\n domains,\n sslSupportMethod: sslMethod,\n acmCertificateArn: certificateArn,\n minimumProtocolVersion\n });\n }\n\n app.addOutputs({\n awsAccountId: getAwsAccountId(app),\n region: aws.config.region,\n cognitoUserPoolId: core.cognitoUserPoolId,\n cognitoAppClientId: core.cognitoAppClientId,\n cognitoUserPoolPasswordPolicy: core.cognitoUserPoolPasswordPolicy,\n dynamoDbTable: core.primaryDynamodbTableName,\n auditLogsDynamoDbTable: core.auditLogsDynamodbTableName,\n graphqlLambdaName: graphql.functions.graphql.output.name,\n graphqlLambdaRole: graphql.role.output.arn,\n graphqlLambdaRoleName: graphql.role.output.name,\n backgroundTaskLambdaArn: backgroundTask.backgroundTask.output.arn,\n backgroundTaskStepFunctionArn: backgroundTask.stepFunction.output.arn,\n fileManagerDownloadLambdaArn: fileManager.functions.download.output.arn,\n websocketApiId: websocket.websocketApi.output.id,\n websocketApiUrl: websocket.websocketApiUrl,\n schedulerLambdaInvokeRole: scheduler.invokeRole.output.arn\n });\n\n // Only add `dynamoDbOpensearchTable` output if using search engine (ES/OS).\n if (searchEngineParams) {\n app.addOutputs({\n dynamoDbOpensearchTable: core.opensearchDynamodbTableName\n });\n }\n\n app.addHandler(() => {\n addDomainsUrlsOutputs({\n app,\n cloudfrontDistribution: cloudfront,\n map: {\n distributionDomain: \"cloudfrontApiDomain\",\n distributionUrl: \"cloudfrontApiUrl\",\n usedDomain: \"apiDomain\",\n usedUrl: \"apiUrl\"\n }\n });\n });\n // /**\n // * We need to attach the Sync System if it exists.\n // */\n // await attachSyncSystem({\n // app,\n // core,\n // env: app.params.run.env\n // });\n\n // Applies internal and user-defined AWS tags.\n await applyAwsResourceTags(\"api\");\n\n return {\n fileManager,\n graphql,\n apiGateway,\n websocket,\n cloudfront,\n backgroundTask,\n scheduler\n };\n }\n });\n\n const app = withServiceManifest(withCommonLambdaEnvVariables(baseApp));\n\n app.addHandler(() => {\n app.addServiceManifest({\n name: \"api\",\n manifest: {\n bgTaskSfn: baseApp.resources.backgroundTask.stepFunction.output.arn,\n cloudfront: {\n distributionId: baseApp.resources.cloudfront.output.id,\n domain: baseApp.resources.cloudfront.output.domainName.apply(\n v => `https://${v}`\n )\n }\n }\n });\n\n app.addServiceManifest({\n name: \"scheduler\",\n manifest: {\n lambdaArn: baseApp.resources.graphql.functions.graphql.output.arn,\n roleArn: baseApp.resources.scheduler.invokeRole.output.arn\n }\n });\n });\n\n return app;\n};\n"],"names":["createApiPulumiApp","baseApp","createPulumiApp","app","sdk","getProjectSdk","projectConfig","pulumiResourceNamePrefix","vpcExtensionsConfig","getVpcConfigFromExtension","openSearchExtensionConfig","getOsConfigFromExtension","searchEngineParams","params","process","resource","featureFlags","usingAdvancedVpcParams","handleGuardDutyEvents","onResource","addResource","useExistingVpc","Error","isResourceOfType","aws","canUseVpc","apiPulumi","SetApiCustomDomains","DefaultSetApiCustomDomains","pulumiHandlers","ApiPulumi","isProduction","core","CoreOutput","VpcConfig","isVpcEnabled","graphql","ApiGraphql","getEnvVariableAwsRegion","websocket","ApiWebsocket","fileManager","ApiFileManager","apiGateway","ApiGateway","cloudfront","ApiCloudfront","backgroundTask","ApiBackgroundTask","scheduler","ApiScheduler","apiCustomDomains","apiCustomDomainsExt","domains","sslMethod","certificateArn","minimumProtocolVersion","applyCustomDomain","getAwsAccountId","addDomainsUrlsOutputs","applyAwsResourceTags","withServiceManifest","withCommonLambdaEnvVariables","v"],"mappings":";;;;;;;;;;;;;;;;;AAmCO,MAAMA,qBAAqB;IAC9B,MAAMC,UAAUC,gBAAgB;QAC5B,MAAM;QACN,MAAM;QACN,SAAS,OAAOC;YACZ,MAAMC,MAAM,MAAMC;YAClB,MAAMC,gBAAgB,MAAMF,IAAI,gBAAgB;YAEhD,MAAMG,2BAA2B,MAAMH,IAAI,2BAA2B;YACtE,MAAMI,sBAAsBC,0BAA0BH;YACtD,MAAMI,4BAA4BC,yBAAyBL;YAE3D,IAAIM,qBAA8D;YAElE,IAAIF,2BACAE,qBAAqBF;YAGzB,IAAIE,oBAAoB;gBACpB,MAAMC,SAASD;gBACf,IAAI,AAAkB,YAAlB,OAAOC,QAAqB;oBAC5B,IAAIA,OAAO,QAAQ,EACfC,QAAQ,GAAG,CAAC,mBAAmB,GAAGD,OAAO,QAAQ;oBAGrD,IAAIA,OAAO,UAAU,EACjBC,QAAQ,GAAG,CAAC,kBAAkB,GAAGD,OAAO,UAAU;oBAGtD,IAAIA,OAAO,WAAW,EAClBC,QAAQ,GAAG,CAAC,uBAAuB,GAAGD,OAAO,WAAW;oBAG5D,IAAIA,OAAO,aAAa,EACpBC,QAAQ,GAAG,CAAC,yBAAyB,GAAG;oBAG5C,IAAID,OAAO,QAAQ,EACfC,QAAQ,GAAG,CAAC,mBAAmB,GAAGD,OAAO,QAAQ;oBAGrD,IAAIA,OAAO,QAAQ,EACfC,QAAQ,GAAG,CAAC,mBAAmB,GAAGD,OA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cAAc,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG;gBACnE,YAAY;oBACR,gBAAgBA,QAAQ,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;oBACtD,QAAQA,QAAQ,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CACxD8D,CAAAA,IAAK,CAAC,QAAQ,EAAEA,GAAG;gBAE3B;YACJ;QACJ;QAEA5D,IAAI,kBAAkB,CAAC;YACnB,MAAM;YACN,UAAU;gBACN,WAAWF,QAAQ,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG;gBACjE,SAASA,QAAQ,SAAS,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG;YAC9D;QACJ;IACJ;IAEA,OAAOE;AACX"}
|
|
@@ -13,6 +13,7 @@ import { CorePulumi } from "../../../abstractions/features/pulumi/index.js";
|
|
|
13
13
|
import { corePulumi } from "../../features/CorePulumi/index.js";
|
|
14
14
|
import { getOsConfigFromExtension } from "../extensions/getOsConfigFromExtension.js";
|
|
15
15
|
import { getVpcConfigFromExtension } from "../extensions/getVpcConfigFromExtension.js";
|
|
16
|
+
import { isVpcEnabled } from "../extensions/isVpcEnabled.js";
|
|
16
17
|
import { applyAwsResourceTags, getAwsRegion } from "../awsUtils.js";
|
|
17
18
|
import { configureS3BucketMalwareProtection } from "./configureS3BucketMalwareProtection.js";
|
|
18
19
|
import { CoreAuditLogsDynamo } from "../../index.js";
|
|
@@ -154,8 +155,7 @@ function createCorePulumiApp() {
|
|
|
154
155
|
const auditLogsDynamoDbTable = app.addModule(CoreAuditLogsDynamo, {
|
|
155
156
|
protect
|
|
156
157
|
});
|
|
157
|
-
const
|
|
158
|
-
const vpc = vpcEnabled ? app.addModule(CoreVpc) : null;
|
|
158
|
+
const vpc = isVpcEnabled(vpcExtensionsConfig, isProduction) ? app.addModule(CoreVpc) : null;
|
|
159
159
|
const cognito = app.addModule(CoreCognito, {
|
|
160
160
|
protect,
|
|
161
161
|
useEmailAsUsername: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pulumi/apps/core/createCorePulumiApp.js","sources":["../../../../src/pulumi/apps/core/createCorePulumiApp.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { createPulumiApp, isResourceOfType } from \"@webiny/pulumi\";\nimport { CoreCognito } from \"./CoreCognito.js\";\nimport { CoreDynamo } from \"./CoreDynamo.js\";\nimport { OpenSearch } from \"./CoreOpenSearch.js\";\nimport { CoreEventBus } from \"./CoreEventBus.js\";\nimport { CoreFileManger } from \"./CoreFileManager.js\";\nimport { CoreVpc } from \"./CoreVpc.js\";\nimport { WatchCommand } from \"./WatchCommand.js\";\nimport { withServiceManifest } from \"~/pulumi/utils/withServiceManifest.js\";\nimport {\n addServiceManifestTableItem,\n type TableDefinition\n} from \"~/pulumi/utils/addServiceManifestTableItem.js\";\nimport * as random from \"@pulumi/random\";\n\nimport { getProjectSdk } from \"@webiny/project\";\nimport { CorePulumi } from \"~/abstractions/features/pulumi/index.js\";\nimport { corePulumi } from \"~/pulumi/features/CorePulumi/index.js\";\nimport { getOsConfigFromExtension } from \"~/pulumi/apps/extensions/getOsConfigFromExtension.js\";\nimport { getVpcConfigFromExtension } from \"~/pulumi/apps/extensions/getVpcConfigFromExtension.js\";\nimport { applyAwsResourceTags, getAwsRegion } from \"~/pulumi/apps/awsUtils.js\";\nimport { configureS3BucketMalwareProtection } from \"./configureS3BucketMalwareProtection.js\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport { CoreAuditLogsDynamo } from \"~/pulumi/index.js\";\n\nexport type CorePulumiApp = ReturnType<typeof createCorePulumiApp>;\n\nexport function createCorePulumiApp() {\n const baseApp = createPulumiApp({\n name: \"core\",\n path: \"apps/core\",\n program: async app => {\n const sdk = await getProjectSdk();\n const projectConfig = await sdk.getProjectConfig();\n\n const pulumiResourceNamePrefix = await sdk.getPulumiResourceNamePrefix();\n const coreStackOutput = await sdk.getAppStackOutput<{\n opensearchDomainName?: string;\n primaryDynamodbTableName?: string;\n }>(\"core\");\n const vpcExtensionsConfig = getVpcConfigFromExtension(projectConfig);\n const opensearchExtensionConfig = getOsConfigFromExtension(projectConfig);\n\n const deploymentId = new random.RandomId(\"deploymentId\", { byteLength: 8 });\n\n let searchEngineType: \"opensearch\" | null = null;\n let searchEngineParams: typeof opensearchExtensionConfig | null = null;\n\n if (opensearchExtensionConfig) {\n searchEngineParams = opensearchExtensionConfig;\n searchEngineType = \"opensearch\";\n }\n\n if (searchEngineParams) {\n const params = searchEngineParams;\n if (typeof params === \"object\") {\n if (params.endpoint) {\n process.env.OPENSEARCH_ENDPOINT = params.endpoint;\n }\n\n if (params.domainName) {\n process.env.AWS_OS_DOMAIN_NAME = params.domainName;\n }\n\n if (params.indexPrefix) {\n process.env.OPENSEARCH_INDEX_PREFIX = params.indexPrefix;\n }\n\n if (params.sharedIndexes) {\n process.env.OPENSEARCH_SHARED_INDEXES = \"true\";\n }\n\n if (params.username) {\n process.env.OPENSEARCH_USERNAME = params.username;\n }\n\n if (params.password) {\n process.env.OPENSEARCH_PASSWORD = params.password;\n }\n }\n }\n\n if (pulumiResourceNamePrefix) {\n app.onResource(resource => {\n if (!resource.name.startsWith(pulumiResourceNamePrefix)) {\n resource.name = `${pulumiResourceNamePrefix}${resource.name}`;\n }\n });\n }\n\n // <-------------------- Enterprise start -------------------->\n app.addHandler(async () => {\n const usingAdvancedVpcParams =\n vpcExtensionsConfig && typeof vpcExtensionsConfig !== \"boolean\";\n\n const featureFlags = await sdk.getFeatureFlags();\n if (featureFlags.isFileManagerThreatDetectionEnabled()) {\n configureS3BucketMalwareProtection(app as CorePulumiApp);\n }\n\n // Not using advanced VPC params? Then immediately exit.\n if (!usingAdvancedVpcParams) {\n return;\n }\n\n const { resources, addResource, onResource } = app as CorePulumiApp;\n const { useExistingVpc, useVpcEndpoints } = vpcExtensionsConfig;\n\n // 1. We first deal with \"existing VPC\" setup.\n if (useExistingVpc) {\n if (\"useVpcEndpoints\" in vpcExtensionsConfig) {\n throw new Error(\n \"Cannot specify `useVpcEndpoints` parameter when using an existing VPC. The VPC endpoints configurations should be already defined within the existing VPC.\"\n );\n }\n\n if (opensearchExtensionConfig) {\n if (!useExistingVpc.openSearchDomainVpcConfig) {\n throw new Error(\n \"Cannot specify `useExistingVpc` parameter because the `openSearchDomainVpcConfig` parameter wasn't provided.\"\n );\n }\n\n onResource(resource => {\n if (isResourceOfType(resource, aws.opensearch.Domain)) {\n resource.config.vpcOptions(\n useExistingVpc!.openSearchDomainVpcConfig\n );\n }\n });\n }\n\n if (!useExistingVpc.lambdaFunctionsVpcConfig) {\n throw new Error(\n \"Cannot specify `useExistingVpc` parameter because the `lambdaFunctionsVpcConfig` parameter wasn't provided.\"\n );\n }\n\n onResource(resource => {\n if (isResourceOfType(resource, aws.lambda.Function)) {\n const canUseVpc = resource.meta.canUseVpc !== false;\n if (canUseVpc) {\n resource.config.vpcConfig(useExistingVpc!.lambdaFunctionsVpcConfig);\n }\n }\n\n if (isResourceOfType(resource, aws.iam.Role)) {\n if (resource.meta.isLambdaFunctionRole) {\n addResource(aws.iam.RolePolicyAttachment, {\n name: `${resource.name}-vpc-access-execution-role`,\n config: {\n role: resource.output.name,\n policyArn:\n aws.iam.ManagedPolicy.AWSLambdaVPCAccessExecutionRole\n }\n });\n }\n }\n });\n\n return;\n }\n\n // 2. Now we deal with \"non-existing VPC\" setup.\n if (useVpcEndpoints) {\n const region = getAwsRegion(app);\n\n onResource(resource => {\n if (isResourceOfType(resource, aws.ec2.Vpc)) {\n resource.config.enableDnsSupport(true);\n resource.config.enableDnsHostnames(true);\n }\n });\n\n const { vpc, subnets, routeTables } = resources.vpc!;\n addResource(aws.ec2.VpcEndpoint, {\n name: \"vpc-s3-vpc-endpoint\",\n config: {\n vpcId: vpc.output.id,\n serviceName: pulumi.interpolate`com.amazonaws.${region}.s3`,\n routeTableIds: [routeTables.privateSubnets.output.id]\n }\n });\n\n addResource(aws.ec2.VpcEndpoint, {\n name: \"vpc-dynamodb-vpc-endpoint\",\n config: {\n vpcId: vpc.output.id,\n serviceName: pulumi.interpolate`com.amazonaws.${region}.dynamodb`,\n routeTableIds: [routeTables.privateSubnets.output.id]\n }\n });\n\n addResource(aws.ec2.VpcEndpoint, {\n name: \"vpc-sqs-vpc-endpoint\",\n config: {\n vpcId: vpc.output.id,\n serviceName: pulumi.interpolate`com.amazonaws.${region}.sqs`,\n vpcEndpointType: \"Interface\",\n privateDnsEnabled: true,\n securityGroupIds: [vpc.output.defaultSecurityGroupId],\n subnetIds: subnets.private.map(subNet => subNet.output.id)\n }\n });\n\n addResource(aws.ec2.VpcEndpoint, {\n name: \"vpc-events-vpc-endpoint\",\n config: {\n vpcId: vpc.output.id,\n serviceName: pulumi.interpolate`com.amazonaws.${region}.events`,\n vpcEndpointType: \"Interface\",\n privateDnsEnabled: true,\n securityGroupIds: [vpc.output.defaultSecurityGroupId],\n subnetIds: subnets.private.map(subNet => subNet.output.id)\n }\n });\n }\n });\n // <-------------------- Enterprise end -------------------->\n\n // Overrides must be applied via a handler, registered at the very start of the program.\n // By doing this, we're ensuring user's adjustments are not applied to late.\n sdk.getContainer().registerComposite(corePulumi);\n const pulumiHandlers = sdk.getContainer().resolve(CorePulumi);\n\n app.addHandler(() => {\n return pulumiHandlers.execute(app as CorePulumiApp);\n });\n\n const isProduction = app.env.isProduction;\n const protect = isProduction;\n\n // Setup DynamoDB table\n const dynamoDbTable = app.addModule(CoreDynamo, { protect });\n const auditLogsDynamoDbTable = app.addModule(CoreAuditLogsDynamo, { protect });\n\n // Setup VPC\n const vpcEnabled =\n vpcExtensionsConfig === true ||\n typeof vpcExtensionsConfig === \"object\" ||\n isProduction;\n\n const vpc = vpcEnabled ? app.addModule(CoreVpc) : null;\n\n // Setup Cognito\n const cognito = app.addModule(CoreCognito, {\n protect,\n useEmailAsUsername: false,\n mfa: process.env.COGNITO_MFA === \"true\"\n });\n\n // Cognito custom:id was originally set to maxLength 36 (UUID). Federated OIDC\n // providers (e.g., Entra ID) can produce sub values longer than 36 chars. Since\n // Cognito doesn't allow changing custom attribute constraints after pool creation,\n // we only increase it for new deployments. Existing pools keep their original limit.\n const isNewDeployment = !coreStackOutput || Object.keys(coreStackOutput).length === 0;\n if (isNewDeployment) {\n cognito.userPool.config.schemas(schemas => {\n return schemas?.map(schema => {\n if (schema.name === \"id\") {\n return {\n ...schema,\n stringAttributeConstraints: {\n ...schema.stringAttributeConstraints,\n maxLength: \"256\"\n }\n };\n }\n return schema;\n });\n });\n } else {\n cognito.userPool.opts.ignoreChanges = [\n ...(cognito.userPool.opts.ignoreChanges || []),\n \"schemas\"\n ];\n }\n\n // Setup event bus\n const eventBus = app.addModule(CoreEventBus);\n\n // Setup file core bucket\n const { bucket: fileManagerBucket } = app.addModule(CoreFileManger, { protect });\n\n let opensearch;\n if (searchEngineType === \"opensearch\") {\n const prevDomainName = coreStackOutput?.opensearchDomainName;\n\n // When upgrading from old code that never stored opensearchDomainName, the old\n // code always generated domain names without any prefix (app.params.create\n // .pulumiResourceNamePrefix was never a real Pulumi param, so it returned \"\").\n // Using the SDK default \"wby-\" prefix here would generate a different name and\n // cause Pulumi to destroy and recreate the cluster.\n const isUpgradeFromOldCode =\n !!coreStackOutput?.primaryDynamodbTableName && !prevDomainName;\n const namePrefixForOs = isUpgradeFromOldCode ? \"\" : pulumiResourceNamePrefix || \"\";\n\n opensearch = app.addModule(OpenSearch, {\n protect,\n namePrefix: namePrefixForOs,\n prevDomainName\n });\n }\n\n app.addModule(WatchCommand, { deploymentId: deploymentId.hex });\n\n app.addOutputs({\n deploymentId: deploymentId.hex,\n region: aws.config.region,\n fileManagerBucketId: fileManagerBucket.output.id,\n primaryDynamodbTableArn: dynamoDbTable.output.arn,\n primaryDynamodbTableName: dynamoDbTable.output.name,\n primaryDynamodbTableHashKey: dynamoDbTable.output.hashKey,\n primaryDynamodbTableRangeKey: dynamoDbTable.output.rangeKey,\n auditLogsDynamodbTableArn: auditLogsDynamoDbTable.output.arn,\n auditLogsDynamodbTableName: auditLogsDynamoDbTable.output.name,\n auditLogsDynamodbTableHashKey: auditLogsDynamoDbTable.output.hashKey,\n auditLogsDynamodbTableRangeKey: auditLogsDynamoDbTable.output.rangeKey,\n cognitoUserPoolId: cognito.userPool.output.id,\n cognitoUserPoolArn: cognito.userPool.output.arn,\n cognitoUserPoolPasswordPolicy: cognito.userPool.output.passwordPolicy,\n cognitoAppClientId: cognito.userPoolClient.output.id,\n eventBusName: eventBus.output.name,\n eventBusArn: eventBus.output.arn\n });\n\n // Applies internal and user-defined AWS tags.\n await applyAwsResourceTags(\"core\");\n\n return {\n dynamoDbTable,\n vpc,\n ...cognito,\n fileManagerBucket,\n eventBus,\n opensearch\n };\n }\n });\n\n const app = withServiceManifest(baseApp, manifests => {\n const dynamoTable = baseApp.resources.dynamoDbTable;\n\n const table: TableDefinition = {\n tableName: dynamoTable.output.name,\n hashKey: dynamoTable.output.hashKey,\n rangeKey: dynamoTable.output.rangeKey\n };\n\n manifests.forEach(manifest => addServiceManifestTableItem(baseApp, table, manifest));\n });\n\n app.addHandler(() => {\n app.addServiceManifest({\n name: \"core\",\n manifest: {\n eventBus: {\n arn: baseApp.resources.eventBus.output.arn,\n name: baseApp.resources.eventBus.output.name\n },\n dynamodbTable: {\n arn: baseApp.resources.dynamoDbTable.output.arn,\n name: baseApp.resources.dynamoDbTable.output.name,\n hashKey: baseApp.resources.dynamoDbTable.output.hashKey,\n rangeKey: baseApp.resources.dynamoDbTable.output.rangeKey\n }\n }\n });\n });\n\n return app;\n}\n"],"names":["createCorePulumiApp","baseApp","createPulumiApp","app","sdk","getProjectSdk","projectConfig","pulumiResourceNamePrefix","coreStackOutput","vpcExtensionsConfig","getVpcConfigFromExtension","opensearchExtensionConfig","getOsConfigFromExtension","deploymentId","random","searchEngineType","searchEngineParams","params","process","resource","usingAdvancedVpcParams","featureFlags","configureS3BucketMalwareProtection","resources","addResource","onResource","useExistingVpc","useVpcEndpoints","Error","isResourceOfType","aws","canUseVpc","region","getAwsRegion","vpc","subnets","routeTables","pulumi","subNet","corePulumi","pulumiHandlers","CorePulumi","isProduction","protect","dynamoDbTable","CoreDynamo","auditLogsDynamoDbTable","CoreAuditLogsDynamo","vpcEnabled","CoreVpc","cognito","CoreCognito","isNewDeployment","Object","schemas","schema","eventBus","CoreEventBus","fileManagerBucket","CoreFileManger","opensearch","prevDomainName","isUpgradeFromOldCode","namePrefixForOs","OpenSearch","WatchCommand","applyAwsResourceTags","withServiceManifest","manifests","dynamoTable","table","manifest","addServiceManifestTableItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA4BO,SAASA;IACZ,MAAMC,UAAUC,gBAAgB;QAC5B,MAAM;QACN,MAAM;QACN,SAAS,OAAMC;YACX,MAAMC,MAAM,MAAMC;YAClB,MAAMC,gBAAgB,MAAMF,IAAI,gBAAgB;YAEhD,MAAMG,2BAA2B,MAAMH,IAAI,2BAA2B;YACtE,MAAMI,kBAAkB,MAAMJ,IAAI,iBAAiB,CAGhD;YACH,MAAMK,sBAAsBC,0BAA0BJ;YACtD,MAAMK,4BAA4BC,yBAAyBN;YAE3D,MAAMO,eAAe,IAAIC,0CAAAA,QAAe,CAAC,gBAAgB;gBAAE,YAAY;YAAE;YAEzE,IAAIC,mBAAwC;YAC5C,IAAIC,qBAA8D;YAElE,IAAIL,2BAA2B;gBAC3BK,qBAAqBL;gBACrBI,mBAAmB;YACvB;YAEA,IAAIC,oBAAoB;gBACpB,MAAMC,SAASD;gBACf,IAAI,AAAkB,YAAlB,OAAOC,QAAqB;oBAC5B,IAAIA,OAAO,QAAQ,EACfC,QAAQ,GAAG,CAAC,mBAAmB,GAAGD,OAAO,QAAQ;oBAGrD,IAAIA,OAAO,UAAU,EACjBC,QAAQ,GAAG,CAAC,kBAAkB,GAAGD,OAAO,UAAU;oBAGtD,IAAIA,OAAO,WAAW,EAClBC,QAAQ,GAAG,CAAC,uBAAuB,GAAGD,OAAO,WAAW;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,CAAC;YACnB,MAAM;YACN,UAAU;gBACN,UAAU;oBACN,KAAKF,QAAQ,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG;oBAC1C,MAAMA,QAAQ,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI;gBAChD;gBACA,eAAe;oBACX,KAAKA,QAAQ,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG;oBAC/C,MAAMA,QAAQ,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI;oBACjD,SAASA,QAAQ,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO;oBACvD,UAAUA,QAAQ,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ;gBAC7D;YACJ;QACJ;IACJ;IAEA,OAAOE;AACX"}
|
|
1
|
+
{"version":3,"file":"pulumi/apps/core/createCorePulumiApp.js","sources":["../../../../src/pulumi/apps/core/createCorePulumiApp.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { createPulumiApp, isResourceOfType } from \"@webiny/pulumi\";\nimport { CoreCognito } from \"./CoreCognito.js\";\nimport { CoreDynamo } from \"./CoreDynamo.js\";\nimport { OpenSearch } from \"./CoreOpenSearch.js\";\nimport { CoreEventBus } from \"./CoreEventBus.js\";\nimport { CoreFileManger } from \"./CoreFileManager.js\";\nimport { CoreVpc } from \"./CoreVpc.js\";\nimport { WatchCommand } from \"./WatchCommand.js\";\nimport { withServiceManifest } from \"~/pulumi/utils/withServiceManifest.js\";\nimport {\n addServiceManifestTableItem,\n type TableDefinition\n} from \"~/pulumi/utils/addServiceManifestTableItem.js\";\nimport * as random from \"@pulumi/random\";\n\nimport { getProjectSdk } from \"@webiny/project\";\nimport { CorePulumi } from \"~/abstractions/features/pulumi/index.js\";\nimport { corePulumi } from \"~/pulumi/features/CorePulumi/index.js\";\nimport { getOsConfigFromExtension } from \"~/pulumi/apps/extensions/getOsConfigFromExtension.js\";\nimport { getVpcConfigFromExtension } from \"~/pulumi/apps/extensions/getVpcConfigFromExtension.js\";\nimport { isVpcEnabled } from \"~/pulumi/apps/extensions/isVpcEnabled.js\";\nimport { applyAwsResourceTags, getAwsRegion } from \"~/pulumi/apps/awsUtils.js\";\nimport { configureS3BucketMalwareProtection } from \"./configureS3BucketMalwareProtection.js\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport { CoreAuditLogsDynamo } from \"~/pulumi/index.js\";\n\nexport type CorePulumiApp = ReturnType<typeof createCorePulumiApp>;\n\nexport function createCorePulumiApp() {\n const baseApp = createPulumiApp({\n name: \"core\",\n path: \"apps/core\",\n program: async app => {\n const sdk = await getProjectSdk();\n const projectConfig = await sdk.getProjectConfig();\n\n const pulumiResourceNamePrefix = await sdk.getPulumiResourceNamePrefix();\n const coreStackOutput = await sdk.getAppStackOutput<{\n opensearchDomainName?: string;\n primaryDynamodbTableName?: string;\n }>(\"core\");\n const vpcExtensionsConfig = getVpcConfigFromExtension(projectConfig);\n const opensearchExtensionConfig = getOsConfigFromExtension(projectConfig);\n\n const deploymentId = new random.RandomId(\"deploymentId\", { byteLength: 8 });\n\n let searchEngineType: \"opensearch\" | null = null;\n let searchEngineParams: typeof opensearchExtensionConfig | null = null;\n\n if (opensearchExtensionConfig) {\n searchEngineParams = opensearchExtensionConfig;\n searchEngineType = \"opensearch\";\n }\n\n if (searchEngineParams) {\n const params = searchEngineParams;\n if (typeof params === \"object\") {\n if (params.endpoint) {\n process.env.OPENSEARCH_ENDPOINT = params.endpoint;\n }\n\n if (params.domainName) {\n process.env.AWS_OS_DOMAIN_NAME = params.domainName;\n }\n\n if (params.indexPrefix) {\n process.env.OPENSEARCH_INDEX_PREFIX = params.indexPrefix;\n }\n\n if (params.sharedIndexes) {\n process.env.OPENSEARCH_SHARED_INDEXES = \"true\";\n }\n\n if (params.username) {\n process.env.OPENSEARCH_USERNAME = params.username;\n }\n\n if (params.password) {\n process.env.OPENSEARCH_PASSWORD = params.password;\n }\n }\n }\n\n if (pulumiResourceNamePrefix) {\n app.onResource(resource => {\n if (!resource.name.startsWith(pulumiResourceNamePrefix)) {\n resource.name = `${pulumiResourceNamePrefix}${resource.name}`;\n }\n });\n }\n\n // <-------------------- Enterprise start -------------------->\n app.addHandler(async () => {\n const usingAdvancedVpcParams =\n vpcExtensionsConfig && typeof vpcExtensionsConfig !== \"boolean\";\n\n const featureFlags = await sdk.getFeatureFlags();\n if (featureFlags.isFileManagerThreatDetectionEnabled()) {\n configureS3BucketMalwareProtection(app as CorePulumiApp);\n }\n\n // Not using advanced VPC params? Then immediately exit.\n if (!usingAdvancedVpcParams) {\n return;\n }\n\n const { resources, addResource, onResource } = app as CorePulumiApp;\n const { useExistingVpc, useVpcEndpoints } = vpcExtensionsConfig;\n\n // 1. We first deal with \"existing VPC\" setup.\n if (useExistingVpc) {\n if (\"useVpcEndpoints\" in vpcExtensionsConfig) {\n throw new Error(\n \"Cannot specify `useVpcEndpoints` parameter when using an existing VPC. The VPC endpoints configurations should be already defined within the existing VPC.\"\n );\n }\n\n if (opensearchExtensionConfig) {\n if (!useExistingVpc.openSearchDomainVpcConfig) {\n throw new Error(\n \"Cannot specify `useExistingVpc` parameter because the `openSearchDomainVpcConfig` parameter wasn't provided.\"\n );\n }\n\n onResource(resource => {\n if (isResourceOfType(resource, aws.opensearch.Domain)) {\n resource.config.vpcOptions(\n useExistingVpc!.openSearchDomainVpcConfig\n );\n }\n });\n }\n\n if (!useExistingVpc.lambdaFunctionsVpcConfig) {\n throw new Error(\n \"Cannot specify `useExistingVpc` parameter because the `lambdaFunctionsVpcConfig` parameter wasn't provided.\"\n );\n }\n\n onResource(resource => {\n if (isResourceOfType(resource, aws.lambda.Function)) {\n const canUseVpc = resource.meta.canUseVpc !== false;\n if (canUseVpc) {\n resource.config.vpcConfig(useExistingVpc!.lambdaFunctionsVpcConfig);\n }\n }\n\n if (isResourceOfType(resource, aws.iam.Role)) {\n if (resource.meta.isLambdaFunctionRole) {\n addResource(aws.iam.RolePolicyAttachment, {\n name: `${resource.name}-vpc-access-execution-role`,\n config: {\n role: resource.output.name,\n policyArn:\n aws.iam.ManagedPolicy.AWSLambdaVPCAccessExecutionRole\n }\n });\n }\n }\n });\n\n return;\n }\n\n // 2. Now we deal with \"non-existing VPC\" setup.\n if (useVpcEndpoints) {\n const region = getAwsRegion(app);\n\n onResource(resource => {\n if (isResourceOfType(resource, aws.ec2.Vpc)) {\n resource.config.enableDnsSupport(true);\n resource.config.enableDnsHostnames(true);\n }\n });\n\n const { vpc, subnets, routeTables } = resources.vpc!;\n addResource(aws.ec2.VpcEndpoint, {\n name: \"vpc-s3-vpc-endpoint\",\n config: {\n vpcId: vpc.output.id,\n serviceName: pulumi.interpolate`com.amazonaws.${region}.s3`,\n routeTableIds: [routeTables.privateSubnets.output.id]\n }\n });\n\n addResource(aws.ec2.VpcEndpoint, {\n name: \"vpc-dynamodb-vpc-endpoint\",\n config: {\n vpcId: vpc.output.id,\n serviceName: pulumi.interpolate`com.amazonaws.${region}.dynamodb`,\n routeTableIds: [routeTables.privateSubnets.output.id]\n }\n });\n\n addResource(aws.ec2.VpcEndpoint, {\n name: \"vpc-sqs-vpc-endpoint\",\n config: {\n vpcId: vpc.output.id,\n serviceName: pulumi.interpolate`com.amazonaws.${region}.sqs`,\n vpcEndpointType: \"Interface\",\n privateDnsEnabled: true,\n securityGroupIds: [vpc.output.defaultSecurityGroupId],\n subnetIds: subnets.private.map(subNet => subNet.output.id)\n }\n });\n\n addResource(aws.ec2.VpcEndpoint, {\n name: \"vpc-events-vpc-endpoint\",\n config: {\n vpcId: vpc.output.id,\n serviceName: pulumi.interpolate`com.amazonaws.${region}.events`,\n vpcEndpointType: \"Interface\",\n privateDnsEnabled: true,\n securityGroupIds: [vpc.output.defaultSecurityGroupId],\n subnetIds: subnets.private.map(subNet => subNet.output.id)\n }\n });\n }\n });\n // <-------------------- Enterprise end -------------------->\n\n // Overrides must be applied via a handler, registered at the very start of the program.\n // By doing this, we're ensuring user's adjustments are not applied to late.\n sdk.getContainer().registerComposite(corePulumi);\n const pulumiHandlers = sdk.getContainer().resolve(CorePulumi);\n\n app.addHandler(() => {\n return pulumiHandlers.execute(app as CorePulumiApp);\n });\n\n const isProduction = app.env.isProduction;\n const protect = isProduction;\n\n // Setup DynamoDB table\n const dynamoDbTable = app.addModule(CoreDynamo, { protect });\n const auditLogsDynamoDbTable = app.addModule(CoreAuditLogsDynamo, { protect });\n\n // Setup VPC\n const vpc = isVpcEnabled(vpcExtensionsConfig, isProduction)\n ? app.addModule(CoreVpc)\n : null;\n\n // Setup Cognito\n const cognito = app.addModule(CoreCognito, {\n protect,\n useEmailAsUsername: false,\n mfa: process.env.COGNITO_MFA === \"true\"\n });\n\n // Cognito custom:id was originally set to maxLength 36 (UUID). Federated OIDC\n // providers (e.g., Entra ID) can produce sub values longer than 36 chars. Since\n // Cognito doesn't allow changing custom attribute constraints after pool creation,\n // we only increase it for new deployments. Existing pools keep their original limit.\n const isNewDeployment = !coreStackOutput || Object.keys(coreStackOutput).length === 0;\n if (isNewDeployment) {\n cognito.userPool.config.schemas(schemas => {\n return schemas?.map(schema => {\n if (schema.name === \"id\") {\n return {\n ...schema,\n stringAttributeConstraints: {\n ...schema.stringAttributeConstraints,\n maxLength: \"256\"\n }\n };\n }\n return schema;\n });\n });\n } else {\n cognito.userPool.opts.ignoreChanges = [\n ...(cognito.userPool.opts.ignoreChanges || []),\n \"schemas\"\n ];\n }\n\n // Setup event bus\n const eventBus = app.addModule(CoreEventBus);\n\n // Setup file core bucket\n const { bucket: fileManagerBucket } = app.addModule(CoreFileManger, { protect });\n\n let opensearch;\n if (searchEngineType === \"opensearch\") {\n const prevDomainName = coreStackOutput?.opensearchDomainName;\n\n // When upgrading from old code that never stored opensearchDomainName, the old\n // code always generated domain names without any prefix (app.params.create\n // .pulumiResourceNamePrefix was never a real Pulumi param, so it returned \"\").\n // Using the SDK default \"wby-\" prefix here would generate a different name and\n // cause Pulumi to destroy and recreate the cluster.\n const isUpgradeFromOldCode =\n !!coreStackOutput?.primaryDynamodbTableName && !prevDomainName;\n const namePrefixForOs = isUpgradeFromOldCode ? \"\" : pulumiResourceNamePrefix || \"\";\n\n opensearch = app.addModule(OpenSearch, {\n protect,\n namePrefix: namePrefixForOs,\n prevDomainName\n });\n }\n\n app.addModule(WatchCommand, { deploymentId: deploymentId.hex });\n\n app.addOutputs({\n deploymentId: deploymentId.hex,\n region: aws.config.region,\n fileManagerBucketId: fileManagerBucket.output.id,\n primaryDynamodbTableArn: dynamoDbTable.output.arn,\n primaryDynamodbTableName: dynamoDbTable.output.name,\n primaryDynamodbTableHashKey: dynamoDbTable.output.hashKey,\n primaryDynamodbTableRangeKey: dynamoDbTable.output.rangeKey,\n auditLogsDynamodbTableArn: auditLogsDynamoDbTable.output.arn,\n auditLogsDynamodbTableName: auditLogsDynamoDbTable.output.name,\n auditLogsDynamodbTableHashKey: auditLogsDynamoDbTable.output.hashKey,\n auditLogsDynamodbTableRangeKey: auditLogsDynamoDbTable.output.rangeKey,\n cognitoUserPoolId: cognito.userPool.output.id,\n cognitoUserPoolArn: cognito.userPool.output.arn,\n cognitoUserPoolPasswordPolicy: cognito.userPool.output.passwordPolicy,\n cognitoAppClientId: cognito.userPoolClient.output.id,\n eventBusName: eventBus.output.name,\n eventBusArn: eventBus.output.arn\n });\n\n // Applies internal and user-defined AWS tags.\n await applyAwsResourceTags(\"core\");\n\n return {\n dynamoDbTable,\n vpc,\n ...cognito,\n fileManagerBucket,\n eventBus,\n opensearch\n };\n }\n });\n\n const app = withServiceManifest(baseApp, manifests => {\n const dynamoTable = baseApp.resources.dynamoDbTable;\n\n const table: TableDefinition = {\n tableName: dynamoTable.output.name,\n hashKey: dynamoTable.output.hashKey,\n rangeKey: dynamoTable.output.rangeKey\n };\n\n manifests.forEach(manifest => addServiceManifestTableItem(baseApp, table, manifest));\n });\n\n app.addHandler(() => {\n app.addServiceManifest({\n name: \"core\",\n manifest: {\n eventBus: {\n arn: baseApp.resources.eventBus.output.arn,\n name: baseApp.resources.eventBus.output.name\n },\n dynamodbTable: {\n arn: baseApp.resources.dynamoDbTable.output.arn,\n name: baseApp.resources.dynamoDbTable.output.name,\n hashKey: baseApp.resources.dynamoDbTable.output.hashKey,\n rangeKey: baseApp.resources.dynamoDbTable.output.rangeKey\n }\n }\n });\n });\n\n return app;\n}\n"],"names":["createCorePulumiApp","baseApp","createPulumiApp","app","sdk","getProjectSdk","projectConfig","pulumiResourceNamePrefix","coreStackOutput","vpcExtensionsConfig","getVpcConfigFromExtension","opensearchExtensionConfig","getOsConfigFromExtension","deploymentId","random","searchEngineType","searchEngineParams","params","process","resource","usingAdvancedVpcParams","featureFlags","configureS3BucketMalwareProtection","resources","addResource","onResource","useExistingVpc","useVpcEndpoints","Error","isResourceOfType","aws","canUseVpc","region","getAwsRegion","vpc","subnets","routeTables","pulumi","subNet","corePulumi","pulumiHandlers","CorePulumi","isProduction","protect","dynamoDbTable","CoreDynamo","auditLogsDynamoDbTable","CoreAuditLogsDynamo","isVpcEnabled","CoreVpc","cognito","CoreCognito","isNewDeployment","Object","schemas","schema","eventBus","CoreEventBus","fileManagerBucket","CoreFileManger","opensearch","prevDomainName","isUpgradeFromOldCode","namePrefixForOs","OpenSearch","WatchCommand","applyAwsResourceTags","withServiceManifest","manifests","dynamoTable","table","manifest","addServiceManifestTableItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6BO,SAASA;IACZ,MAAMC,UAAUC,gBAAgB;QAC5B,MAAM;QACN,MAAM;QACN,SAAS,OAAMC;YACX,MAAMC,MAAM,MAAMC;YAClB,MAAMC,gBAAgB,MAAMF,IAAI,gBAAgB;YAEhD,MAAMG,2BAA2B,MAAMH,IAAI,2BAA2B;YACtE,MAAMI,kBAAkB,MAAMJ,IAAI,iBAAiB,CAGhD;YACH,MAAMK,sBAAsBC,0BAA0BJ;YACtD,MAAMK,4BAA4BC,yBAAyBN;YAE3D,MAAMO,eAAe,IAAIC,0CAAAA,QAAe,CAAC,gBAAgB;gBAAE,YAAY;YAAE;YAEzE,IA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;YACJ;QACJ;IACJ;IAEA,MAAMzD,MAAMgE,oBAAoBlE,SAASmE,CAAAA;QACrC,MAAMC,cAAcpE,QAAQ,SAAS,CAAC,aAAa;QAEnD,MAAMqE,QAAyB;YAC3B,WAAWD,YAAY,MAAM,CAAC,IAAI;YAClC,SAASA,YAAY,MAAM,CAAC,OAAO;YACnC,UAAUA,YAAY,MAAM,CAAC,QAAQ;QACzC;QAEAD,UAAU,OAAO,CAACG,CAAAA,WAAYC,4BAA4BvE,SAASqE,OAAOC;IAC9E;IAEApE,IAAI,UAAU,CAAC;QACXA,IAAI,kBAAkB,CAAC;YACnB,MAAM;YACN,UAAU;gBACN,UAAU;oBACN,KAAKF,QAAQ,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG;oBAC1C,MAAMA,QAAQ,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI;gBAChD;gBACA,eAAe;oBACX,KAAKA,QAAQ,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG;oBAC/C,MAAMA,QAAQ,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI;oBACjD,SAASA,QAAQ,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO;oBACvD,UAAUA,QAAQ,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ;gBAC7D;YACJ;QACJ;IACJ;IAEA,OAAOE;AACX"}
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
import { type Input } from "@pulumi/pulumi";
|
|
2
2
|
import type * as aws from "@pulumi/aws";
|
|
3
3
|
import { type PulumiAppResource } from "@webiny/pulumi";
|
|
4
|
+
/**
|
|
5
|
+
* TLS security policies CloudFront accepts for `minimumProtocolVersion`.
|
|
6
|
+
* Pulumi types the property as a plain string, so the accepted values are
|
|
7
|
+
* listed here to keep the public configuration typed.
|
|
8
|
+
*/
|
|
9
|
+
export declare const minimumProtocolVersions: readonly ["SSLv3", "TLSv1", "TLSv1_2016", "TLSv1.1_2016", "TLSv1.2_2018", "TLSv1.2_2019", "TLSv1.2_2021"];
|
|
10
|
+
export type MinimumProtocolVersion = (typeof minimumProtocolVersions)[number];
|
|
4
11
|
export interface CustomDomainParams {
|
|
5
12
|
domains: Input<string[]>;
|
|
6
13
|
acmCertificateArn: Input<string>;
|
|
7
14
|
sslSupportMethod?: Input<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Minimum TLS version viewers must support in order to connect.
|
|
17
|
+
*
|
|
18
|
+
* Left unset by default, which keeps whatever CloudFront applies on its
|
|
19
|
+
* own. Setting it on an existing project updates the distribution, and
|
|
20
|
+
* raising it can lock out clients that only speak older TLS versions.
|
|
21
|
+
*/
|
|
22
|
+
minimumProtocolVersion?: Input<MinimumProtocolVersion>;
|
|
8
23
|
}
|
|
9
24
|
export declare function applyCustomDomain(cloudfront: PulumiAppResource<typeof aws.cloudfront.Distribution>, params: CustomDomainParams): void;
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
+
const minimumProtocolVersions = [
|
|
2
|
+
"SSLv3",
|
|
3
|
+
"TLSv1",
|
|
4
|
+
"TLSv1_2016",
|
|
5
|
+
"TLSv1.1_2016",
|
|
6
|
+
"TLSv1.2_2018",
|
|
7
|
+
"TLSv1.2_2019",
|
|
8
|
+
"TLSv1.2_2021"
|
|
9
|
+
];
|
|
1
10
|
function applyCustomDomain(cloudfront, params) {
|
|
2
11
|
cloudfront.config.aliases(params.domains);
|
|
3
12
|
cloudfront.config.viewerCertificate({
|
|
4
13
|
acmCertificateArn: params.acmCertificateArn,
|
|
5
|
-
sslSupportMethod: params.sslSupportMethod ?? "sni-only"
|
|
14
|
+
sslSupportMethod: params.sslSupportMethod ?? "sni-only",
|
|
15
|
+
...params.minimumProtocolVersion ? {
|
|
16
|
+
minimumProtocolVersion: params.minimumProtocolVersion
|
|
17
|
+
} : {}
|
|
6
18
|
});
|
|
7
19
|
}
|
|
8
|
-
export { applyCustomDomain };
|
|
20
|
+
export { applyCustomDomain, minimumProtocolVersions };
|
|
9
21
|
|
|
10
22
|
//# sourceMappingURL=customDomain.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pulumi/apps/customDomain.js","sources":["../../../src/pulumi/apps/customDomain.ts"],"sourcesContent":["import { type Input } from \"@pulumi/pulumi\";\nimport type * as aws from \"@pulumi/aws\";\nimport { type PulumiAppResource } from \"@webiny/pulumi\";\n\nexport interface CustomDomainParams {\n domains: Input<string[]>;\n acmCertificateArn: Input<string>;\n sslSupportMethod?: Input<string>;\n}\n\nexport function applyCustomDomain(\n cloudfront: PulumiAppResource<typeof aws.cloudfront.Distribution>,\n params: CustomDomainParams\n) {\n cloudfront.config.aliases(params.domains);\n\n cloudfront.config.viewerCertificate({\n acmCertificateArn: params.acmCertificateArn,\n sslSupportMethod: params.sslSupportMethod ?? \"sni-only\"\n });\n}\n"],"names":["applyCustomDomain","cloudfront","params"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pulumi/apps/customDomain.js","sources":["../../../src/pulumi/apps/customDomain.ts"],"sourcesContent":["import { type Input } from \"@pulumi/pulumi\";\nimport type * as aws from \"@pulumi/aws\";\nimport { type PulumiAppResource } from \"@webiny/pulumi\";\n\n/**\n * TLS security policies CloudFront accepts for `minimumProtocolVersion`.\n * Pulumi types the property as a plain string, so the accepted values are\n * listed here to keep the public configuration typed.\n */\nexport const minimumProtocolVersions = [\n \"SSLv3\",\n \"TLSv1\",\n \"TLSv1_2016\",\n \"TLSv1.1_2016\",\n \"TLSv1.2_2018\",\n \"TLSv1.2_2019\",\n \"TLSv1.2_2021\"\n] as const;\n\nexport type MinimumProtocolVersion = (typeof minimumProtocolVersions)[number];\n\nexport interface CustomDomainParams {\n domains: Input<string[]>;\n acmCertificateArn: Input<string>;\n sslSupportMethod?: Input<string>;\n /**\n * Minimum TLS version viewers must support in order to connect.\n *\n * Left unset by default, which keeps whatever CloudFront applies on its\n * own. Setting it on an existing project updates the distribution, and\n * raising it can lock out clients that only speak older TLS versions.\n */\n minimumProtocolVersion?: Input<MinimumProtocolVersion>;\n}\n\nexport function applyCustomDomain(\n cloudfront: PulumiAppResource<typeof aws.cloudfront.Distribution>,\n params: CustomDomainParams\n) {\n cloudfront.config.aliases(params.domains);\n\n cloudfront.config.viewerCertificate({\n acmCertificateArn: params.acmCertificateArn,\n sslSupportMethod: params.sslSupportMethod ?? \"sni-only\",\n // Only sent when configured, so distributions that do not set it are\n // left exactly as they were.\n ...(params.minimumProtocolVersion\n ? { minimumProtocolVersion: params.minimumProtocolVersion }\n : {})\n });\n}\n"],"names":["minimumProtocolVersions","applyCustomDomain","cloudfront","params"],"mappings":"AASO,MAAMA,0BAA0B;IACnC;IACA;IACA;IACA;IACA;IACA;IACA;CACH;AAkBM,SAASC,kBACZC,UAAiE,EACjEC,MAA0B;IAE1BD,WAAW,MAAM,CAAC,OAAO,CAACC,OAAO,OAAO;IAExCD,WAAW,MAAM,CAAC,iBAAiB,CAAC;QAChC,mBAAmBC,OAAO,iBAAiB;QAC3C,kBAAkBA,OAAO,gBAAgB,IAAI;QAG7C,GAAIA,OAAO,sBAAsB,GAC3B;YAAE,wBAAwBA,OAAO,sBAAsB;QAAC,IACxD,CAAC,CAAC;IACZ;AACJ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { getVpcConfigFromExtension } from "./getVpcConfigFromExtension.js";
|
|
2
|
+
export type VpcExtensionConfig = ReturnType<typeof getVpcConfigFromExtension>;
|
|
3
|
+
/**
|
|
4
|
+
* Decides whether an app should use a VPC, from the `Infra.Vpc` extension config plus whether the
|
|
5
|
+
* target environment is a production one.
|
|
6
|
+
*
|
|
7
|
+
* Production environments get a VPC by default. An explicit `<Infra.Vpc enabled={false} />` beats
|
|
8
|
+
* that default: `enabled` is documented as a plain toggle, so ignoring it on production would
|
|
9
|
+
* silently do the opposite of what the project config asks for.
|
|
10
|
+
*
|
|
11
|
+
* Shared by the core and api apps so the two cannot disagree — a mismatch would leave the api app's
|
|
12
|
+
* Lambdas configured for subnets the core app never created.
|
|
13
|
+
*/
|
|
14
|
+
export declare function isVpcEnabled(config: VpcExtensionConfig, isProduction: boolean): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pulumi/apps/extensions/isVpcEnabled.js","sources":["../../../../src/pulumi/apps/extensions/isVpcEnabled.ts"],"sourcesContent":["import type { getVpcConfigFromExtension } from \"./getVpcConfigFromExtension.js\";\n\nexport type VpcExtensionConfig = ReturnType<typeof getVpcConfigFromExtension>;\n\n/**\n * Decides whether an app should use a VPC, from the `Infra.Vpc` extension config plus whether the\n * target environment is a production one.\n *\n * Production environments get a VPC by default. An explicit `<Infra.Vpc enabled={false} />` beats\n * that default: `enabled` is documented as a plain toggle, so ignoring it on production would\n * silently do the opposite of what the project config asks for.\n *\n * Shared by the core and api apps so the two cannot disagree — a mismatch would leave the api app's\n * Lambdas configured for subnets the core app never created.\n */\nexport function isVpcEnabled(config: VpcExtensionConfig, isProduction: boolean): boolean {\n // Explicitly turned off via `<Infra.Vpc enabled={false} />`.\n if (config === false) {\n return false;\n }\n\n // Explicitly turned on, or given advanced params (useVpcEndpoints / useExistingVpc).\n if (config === true || typeof config === \"object\") {\n return true;\n }\n\n // No `Infra.Vpc` extension registered: a VPC is used for production environments only.\n return isProduction;\n}\n"],"names":["isVpcEnabled","config","isProduction"],"mappings":"AAeO,SAASA,aAAaC,MAA0B,EAAEC,YAAqB;IAE1E,IAAID,AAAW,UAAXA,QACA,OAAO;IAIX,IAAIA,AAAW,SAAXA,UAAmB,AAAkB,YAAlB,OAAOA,QAC1B,OAAO;IAIX,OAAOC;AACX"}
|
|
@@ -6,4 +6,13 @@ export declare const AdminCustomDomains: import("@webiny/project/extensions").Ex
|
|
|
6
6
|
vip: "vip";
|
|
7
7
|
}>>;
|
|
8
8
|
certificateArn: z.ZodString;
|
|
9
|
+
minimumProtocolVersion: z.ZodOptional<z.ZodEnum<{
|
|
10
|
+
SSLv3: "SSLv3";
|
|
11
|
+
TLSv1: "TLSv1";
|
|
12
|
+
"TLSv1.1_2016": "TLSv1.1_2016";
|
|
13
|
+
"TLSv1.2_2018": "TLSv1.2_2018";
|
|
14
|
+
"TLSv1.2_2019": "TLSv1.2_2019";
|
|
15
|
+
"TLSv1.2_2021": "TLSv1.2_2021";
|
|
16
|
+
TLSv1_2016: "TLSv1_2016";
|
|
17
|
+
}>>;
|
|
9
18
|
}, z.core.$strip>>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { defineExtension } from "@webiny/project/defineExtension/index.js";
|
|
3
|
+
import { minimumProtocolVersions } from "../apps/customDomain.js";
|
|
3
4
|
const AdminCustomDomains = defineExtension({
|
|
4
5
|
type: "Infra/Admin/CustomDomains",
|
|
5
6
|
tags: {
|
|
@@ -12,7 +13,8 @@ const AdminCustomDomains = defineExtension({
|
|
|
12
13
|
"sni-only",
|
|
13
14
|
"vip"
|
|
14
15
|
]).describe("The method to use for SSL/TLS certificate validation.").default("sni-only"),
|
|
15
|
-
certificateArn: z.string().describe("The ARN of the SSL/TLS certificate to use for the custom domains.")
|
|
16
|
+
certificateArn: z.string().describe("The ARN of the SSL/TLS certificate to use for the custom domains."),
|
|
17
|
+
minimumProtocolVersion: z["enum"](minimumProtocolVersions).describe("The minimum TLS version viewers must support. Left to CloudFront's own default when omitted.").optional()
|
|
16
18
|
})
|
|
17
19
|
});
|
|
18
20
|
export { AdminCustomDomains };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pulumi/extensions/AdminCustomDomains.js","sources":["../../../src/pulumi/extensions/AdminCustomDomains.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\n\nexport const AdminCustomDomains = defineExtension({\n type: \"Infra/Admin/CustomDomains\",\n tags: { runtimeContext: \"project\" },\n description: \"Configure custom domains for the Admin app.\",\n paramsSchema: z.object({\n domains: z.array(z.string()).describe(\"List of custom domains.\").min(1),\n sslMethod: z\n .enum([\"sni-only\", \"vip\"])\n .describe(\"The method to use for SSL/TLS certificate validation.\")\n .default(\"sni-only\"),\n certificateArn: z\n .string()\n .describe(\"The ARN of the SSL/TLS certificate to use for the custom domains.\")\n })\n});\n"],"names":["AdminCustomDomains","defineExtension","z"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pulumi/extensions/AdminCustomDomains.js","sources":["../../../src/pulumi/extensions/AdminCustomDomains.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { minimumProtocolVersions } from \"~/pulumi/apps/customDomain.js\";\n\nexport const AdminCustomDomains = defineExtension({\n type: \"Infra/Admin/CustomDomains\",\n tags: { runtimeContext: \"project\" },\n description: \"Configure custom domains for the Admin app.\",\n paramsSchema: z.object({\n domains: z.array(z.string()).describe(\"List of custom domains.\").min(1),\n sslMethod: z\n .enum([\"sni-only\", \"vip\"])\n .describe(\"The method to use for SSL/TLS certificate validation.\")\n .default(\"sni-only\"),\n certificateArn: z\n .string()\n .describe(\"The ARN of the SSL/TLS certificate to use for the custom domains.\"),\n minimumProtocolVersion: z\n .enum(minimumProtocolVersions)\n .describe(\n \"The minimum TLS version viewers must support. Left to CloudFront's own default when omitted.\"\n )\n .optional()\n })\n});\n"],"names":["AdminCustomDomains","defineExtension","z","minimumProtocolVersions"],"mappings":";;;AAIO,MAAMA,qBAAqBC,gBAAgB;IAC9C,MAAM;IACN,MAAM;QAAE,gBAAgB;IAAU;IAClC,aAAa;IACb,cAAcC,EAAE,MAAM,CAAC;QACnB,SAASA,EAAE,KAAK,CAACA,EAAE,MAAM,IAAI,QAAQ,CAAC,2BAA2B,GAAG,CAAC;QACrE,WAAWA,CAAC,CAADA,OACF,CAAC;YAAC;YAAY;SAAM,EACxB,QAAQ,CAAC,yDACT,OAAO,CAAC;QACb,gBAAgBA,EAAAA,MACL,GACN,QAAQ,CAAC;QACd,wBAAwBA,CAAC,CAADA,OACf,CAACC,yBACL,QAAQ,CACL,gGAEH,QAAQ;IACjB;AACJ"}
|
|
@@ -6,4 +6,13 @@ export declare const ApiCustomDomains: import("@webiny/project/extensions").Exte
|
|
|
6
6
|
vip: "vip";
|
|
7
7
|
}>>;
|
|
8
8
|
certificateArn: z.ZodString;
|
|
9
|
+
minimumProtocolVersion: z.ZodOptional<z.ZodEnum<{
|
|
10
|
+
SSLv3: "SSLv3";
|
|
11
|
+
TLSv1: "TLSv1";
|
|
12
|
+
"TLSv1.1_2016": "TLSv1.1_2016";
|
|
13
|
+
"TLSv1.2_2018": "TLSv1.2_2018";
|
|
14
|
+
"TLSv1.2_2019": "TLSv1.2_2019";
|
|
15
|
+
"TLSv1.2_2021": "TLSv1.2_2021";
|
|
16
|
+
TLSv1_2016: "TLSv1_2016";
|
|
17
|
+
}>>;
|
|
9
18
|
}, z.core.$strip>>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { defineExtension } from "@webiny/project/defineExtension/index.js";
|
|
3
|
+
import { minimumProtocolVersions } from "../apps/customDomain.js";
|
|
3
4
|
const ApiCustomDomains = defineExtension({
|
|
4
5
|
type: "Infra/Api/CustomDomains",
|
|
5
6
|
tags: {
|
|
@@ -12,7 +13,8 @@ const ApiCustomDomains = defineExtension({
|
|
|
12
13
|
"sni-only",
|
|
13
14
|
"vip"
|
|
14
15
|
]).describe("The method to use for SSL/TLS certificate validation.").default("sni-only"),
|
|
15
|
-
certificateArn: z.string().describe("The ARN of the SSL/TLS certificate to use for the custom domains.")
|
|
16
|
+
certificateArn: z.string().describe("The ARN of the SSL/TLS certificate to use for the custom domains."),
|
|
17
|
+
minimumProtocolVersion: z["enum"](minimumProtocolVersions).describe("The minimum TLS version viewers must support. Left to CloudFront's own default when omitted.").optional()
|
|
16
18
|
})
|
|
17
19
|
});
|
|
18
20
|
export { ApiCustomDomains };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pulumi/extensions/ApiCustomDomains.js","sources":["../../../src/pulumi/extensions/ApiCustomDomains.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\n\nexport const ApiCustomDomains = defineExtension({\n type: \"Infra/Api/CustomDomains\",\n tags: { runtimeContext: \"project\" },\n description: \"Configure custom domains for the API.\",\n paramsSchema: z.object({\n domains: z.array(z.string()).describe(\"List of custom domains.\").min(1),\n sslMethod: z\n .enum([\"sni-only\", \"vip\"])\n .describe(\"The method to use for SSL/TLS certificate validation.\")\n .default(\"sni-only\"),\n certificateArn: z\n .string()\n .describe(\"The ARN of the SSL/TLS certificate to use for the custom domains.\")\n })\n});\n"],"names":["ApiCustomDomains","defineExtension","z"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pulumi/extensions/ApiCustomDomains.js","sources":["../../../src/pulumi/extensions/ApiCustomDomains.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { minimumProtocolVersions } from \"~/pulumi/apps/customDomain.js\";\n\nexport const ApiCustomDomains = defineExtension({\n type: \"Infra/Api/CustomDomains\",\n tags: { runtimeContext: \"project\" },\n description: \"Configure custom domains for the API.\",\n paramsSchema: z.object({\n domains: z.array(z.string()).describe(\"List of custom domains.\").min(1),\n sslMethod: z\n .enum([\"sni-only\", \"vip\"])\n .describe(\"The method to use for SSL/TLS certificate validation.\")\n .default(\"sni-only\"),\n certificateArn: z\n .string()\n .describe(\"The ARN of the SSL/TLS certificate to use for the custom domains.\"),\n minimumProtocolVersion: z\n .enum(minimumProtocolVersions)\n .describe(\n \"The minimum TLS version viewers must support. Left to CloudFront's own default when omitted.\"\n )\n .optional()\n })\n});\n"],"names":["ApiCustomDomains","defineExtension","z","minimumProtocolVersions"],"mappings":";;;AAIO,MAAMA,mBAAmBC,gBAAgB;IAC5C,MAAM;IACN,MAAM;QAAE,gBAAgB;IAAU;IAClC,aAAa;IACb,cAAcC,EAAE,MAAM,CAAC;QACnB,SAASA,EAAE,KAAK,CAACA,EAAE,MAAM,IAAI,QAAQ,CAAC,2BAA2B,GAAG,CAAC;QACrE,WAAWA,CAAC,CAADA,OACF,CAAC;YAAC;YAAY;SAAM,EACxB,QAAQ,CAAC,yDACT,OAAO,CAAC;QACb,gBAAgBA,EAAAA,MACL,GACN,QAAQ,CAAC;QACd,wBAAwBA,CAAC,CAADA,OACf,CAACC,yBACL,QAAQ,CACL,gGAEH,QAAQ;IACjB;AACJ"}
|
|
@@ -46,6 +46,15 @@ export declare const definitions: (import("@webiny/project/defineExtension/index
|
|
|
46
46
|
vip: "vip";
|
|
47
47
|
}>>;
|
|
48
48
|
certificateArn: import("zod").ZodString;
|
|
49
|
+
minimumProtocolVersion: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
50
|
+
SSLv3: "SSLv3";
|
|
51
|
+
TLSv1: "TLSv1";
|
|
52
|
+
"TLSv1.1_2016": "TLSv1.1_2016";
|
|
53
|
+
"TLSv1.2_2018": "TLSv1.2_2018";
|
|
54
|
+
"TLSv1.2_2019": "TLSv1.2_2019";
|
|
55
|
+
"TLSv1.2_2021": "TLSv1.2_2021";
|
|
56
|
+
TLSv1_2016: "TLSv1_2016";
|
|
57
|
+
}>>;
|
|
49
58
|
}, import("zod/v4/core").$strip>> | import("@webiny/project/defineExtension/index.js").ExtensionDefinitionModel<import("zod").ZodObject<{
|
|
50
59
|
enabled: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
51
60
|
domains: import("zod").ZodObject<{
|