@webiny/project-aws 6.5.2-beta.0 → 6.5.2-beta.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.
@@ -11,7 +11,7 @@ const BackgroundTasks = defineExtension({
11
11
  runtimeContext: "project"
12
12
  },
13
13
  description: "Configure default settings for background tasks. The retention value is used as the default when no admin has explicitly set a value via the Settings UI.",
14
- paramsSchema: paramsSchema,
14
+ paramsSchema,
15
15
  render (params) {
16
16
  return /*#__PURE__*/ react.createElement(BuildParam, {
17
17
  paramName: "BackgroundTasks.RetentionDays",
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/BackgroundTasks.js","sources":["../../src/extensions/BackgroundTasks.tsx"],"sourcesContent":["import React from \"react\";\nimport { z } from \"zod\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { BuildParam } from \"@webiny/project/extensions/index.js\";\n\nconst paramsSchema = z.object({\n retentionDays: z\n .number()\n .int()\n .min(0)\n .max(3650)\n .describe(\n \"Default retention period (in days) for completed background task runs. 0 = never delete. Max 3650.\"\n )\n});\n\nexport const BackgroundTasks = defineExtension({\n type: \"Api/BackgroundTasks\",\n tags: { runtimeContext: \"project\" },\n description:\n \"Configure default settings for background tasks. The retention value is used as the default when no admin has explicitly set a value via the Settings UI.\",\n paramsSchema,\n render(params) {\n return (\n <BuildParam paramName=\"BackgroundTasks.RetentionDays\" value={params.retentionDays} />\n );\n }\n});\n"],"names":["paramsSchema","z","BackgroundTasks","defineExtension","params","BuildParam"],"mappings":";;;;AAKA,MAAMA,eAAeC,EAAE,MAAM,CAAC;IAC1B,eAAeA,EAAAA,MACJ,GACN,GAAG,GACH,GAAG,CAAC,GACJ,GAAG,CAAC,MACJ,QAAQ,CACL;AAEZ;AAEO,MAAMC,kBAAkBC,gBAAgB;IAC3C,MAAM;IACN,MAAM;QAAE,gBAAgB;IAAU;IAClC,aACI;IACJH,cAAAA;IACA,QAAOI,MAAM;QACT,OAAO,WAAP,GACI,oBAACC,YAAUA;YAAC,WAAU;YAAgC,OAAOD,OAAO,aAAa;;IAEzF;AACJ"}
1
+ {"version":3,"file":"extensions/BackgroundTasks.js","sources":["../../src/extensions/BackgroundTasks.tsx"],"sourcesContent":["import React from \"react\";\nimport { z } from \"zod\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { BuildParam } from \"@webiny/project/extensions/index.js\";\n\nconst paramsSchema = z.object({\n retentionDays: z\n .number()\n .int()\n .min(0)\n .max(3650)\n .describe(\n \"Default retention period (in days) for completed background task runs. 0 = never delete. Max 3650.\"\n )\n});\n\nexport const BackgroundTasks = defineExtension({\n type: \"Api/BackgroundTasks\",\n tags: { runtimeContext: \"project\" },\n description:\n \"Configure default settings for background tasks. The retention value is used as the default when no admin has explicitly set a value via the Settings UI.\",\n paramsSchema,\n render(params) {\n return (\n <BuildParam paramName=\"BackgroundTasks.RetentionDays\" value={params.retentionDays} />\n );\n }\n});\n"],"names":["paramsSchema","z","BackgroundTasks","defineExtension","params","BuildParam"],"mappings":";;;;AAKA,MAAMA,eAAeC,EAAE,MAAM,CAAC;IAC1B,eAAeA,EAAAA,MACJ,GACN,GAAG,GACH,GAAG,CAAC,GACJ,GAAG,CAAC,MACJ,QAAQ,CACL;AAEZ;AAEO,MAAMC,kBAAkBC,gBAAgB;IAC3C,MAAM;IACN,MAAM;QAAE,gBAAgB;IAAU;IAClC,aACI;IACJH;IACA,QAAOI,MAAM;QACT,OAAO,WAAP,GACI,oBAACC,YAAUA;YAAC,WAAU;YAAgC,OAAOD,OAAO,aAAa;;IAEzF;AACJ"}
@@ -11,7 +11,7 @@ const ModelFieldCompression = defineExtension({
11
11
  runtimeContext: "project"
12
12
  },
13
13
  description: "Enable or disable compression of Headless CMS model fields at the database storage level.",
14
- paramsSchema: paramsSchema,
14
+ paramsSchema,
15
15
  render (params) {
16
16
  return /*#__PURE__*/ react.createElement(BuildParam, {
17
17
  paramName: "ContentModelFieldCompression",
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/Cms/ModelFieldCompression.js","sources":["../../../src/extensions/Cms/ModelFieldCompression.tsx"],"sourcesContent":["import React from \"react\";\nimport { z } from \"zod\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { BuildParam } from \"@webiny/project/extensions/index.js\";\n\nconst paramsSchema = z.object({\n enabled: z\n .boolean()\n .describe(\"Enable compression of model fields before storing in the database.\")\n});\n\nexport const ModelFieldCompression = defineExtension({\n type: \"Api/Cms/ModelFieldCompression\",\n tags: { runtimeContext: \"project\" },\n description:\n \"Enable or disable compression of Headless CMS model fields at the database storage level.\",\n paramsSchema,\n render(params) {\n return <BuildParam paramName=\"ContentModelFieldCompression\" value={params.enabled} />;\n }\n});\n"],"names":["paramsSchema","z","ModelFieldCompression","defineExtension","params","BuildParam"],"mappings":";;;;AAKA,MAAMA,eAAeC,EAAE,MAAM,CAAC;IAC1B,SAASA,EAAAA,OACG,GACP,QAAQ,CAAC;AAClB;AAEO,MAAMC,wBAAwBC,gBAAgB;IACjD,MAAM;IACN,MAAM;QAAE,gBAAgB;IAAU;IAClC,aACI;IACJH,cAAAA;IACA,QAAOI,MAAM;QACT,OAAO,WAAP,GAAO,oBAACC,YAAUA;YAAC,WAAU;YAA+B,OAAOD,OAAO,OAAO;;IACrF;AACJ"}
1
+ {"version":3,"file":"extensions/Cms/ModelFieldCompression.js","sources":["../../../src/extensions/Cms/ModelFieldCompression.tsx"],"sourcesContent":["import React from \"react\";\nimport { z } from \"zod\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { BuildParam } from \"@webiny/project/extensions/index.js\";\n\nconst paramsSchema = z.object({\n enabled: z\n .boolean()\n .describe(\"Enable compression of model fields before storing in the database.\")\n});\n\nexport const ModelFieldCompression = defineExtension({\n type: \"Api/Cms/ModelFieldCompression\",\n tags: { runtimeContext: \"project\" },\n description:\n \"Enable or disable compression of Headless CMS model fields at the database storage level.\",\n paramsSchema,\n render(params) {\n return <BuildParam paramName=\"ContentModelFieldCompression\" value={params.enabled} />;\n }\n});\n"],"names":["paramsSchema","z","ModelFieldCompression","defineExtension","params","BuildParam"],"mappings":";;;;AAKA,MAAMA,eAAeC,EAAE,MAAM,CAAC;IAC1B,SAASA,EAAAA,OACG,GACP,QAAQ,CAAC;AAClB;AAEO,MAAMC,wBAAwBC,gBAAgB;IACjD,MAAM;IACN,MAAM;QAAE,gBAAgB;IAAU;IAClC,aACI;IACJH;IACA,QAAOI,MAAM;QACT,OAAO,WAAP,GAAO,oBAACC,YAAUA;YAAC,WAAU;YAA+B,OAAOD,OAAO,OAAO;;IACrF;AACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/project-aws",
3
- "version": "6.5.2-beta.0",
3
+ "version": "6.5.2-beta.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -17,17 +17,17 @@
17
17
  "access": "public"
18
18
  },
19
19
  "dependencies": {
20
- "@pulumi/aws": "^7.52.1",
21
- "@pulumi/pulumi": "^3.273.0",
22
- "@pulumi/random": "4.21.4",
23
- "@webiny/api-headless-cms": "6.5.2-beta.0",
24
- "@webiny/aws-layers": "6.5.2-beta.0",
25
- "@webiny/aws-sdk": "6.5.2-beta.0",
26
- "@webiny/cli-core": "6.5.2-beta.0",
20
+ "@pulumi/aws": "^7.54.0",
21
+ "@pulumi/pulumi": "^3.274.1",
22
+ "@pulumi/random": "4.21.6",
23
+ "@webiny/api-headless-cms": "6.5.2-beta.2",
24
+ "@webiny/aws-layers": "6.5.2-beta.2",
25
+ "@webiny/aws-sdk": "6.5.2-beta.2",
26
+ "@webiny/cli-core": "6.5.2-beta.2",
27
27
  "@webiny/di": "1.1.0",
28
- "@webiny/project": "6.5.2-beta.0",
29
- "@webiny/pulumi": "6.5.2-beta.0",
30
- "@webiny/utils": "6.5.2-beta.0",
28
+ "@webiny/project": "6.5.2-beta.2",
29
+ "@webiny/pulumi": "6.5.2-beta.2",
30
+ "@webiny/utils": "6.5.2-beta.2",
31
31
  "chalk": "6.0.1",
32
32
  "email-addresses": "5.0.0",
33
33
  "find-up": "8.0.0",
@@ -42,9 +42,9 @@
42
42
  "devDependencies": {
43
43
  "@types/lodash": "4.17.27",
44
44
  "@types/ncp": "2.0.8",
45
- "@webiny/build-tools": "6.5.2-beta.0",
45
+ "@webiny/build-tools": "6.5.2-beta.2",
46
46
  "typescript": "7.0.2",
47
- "vitest": "5.0.5"
47
+ "vitest": "5.1.0"
48
48
  },
49
49
  "adio": {
50
50
  "ignoreDirs": [
@@ -1,3 +1,5 @@
1
+ import * as aws from "@pulumi/aws";
2
+ import * as pulumi from "@pulumi/pulumi";
1
3
  import { type PulumiAppModule } from "@webiny/pulumi";
2
4
  export interface CoreCognitoParams {
3
5
  protect: boolean;
@@ -5,6 +7,18 @@ export interface CoreCognitoParams {
5
7
  mfa?: boolean;
6
8
  }
7
9
  export type CoreCognito = PulumiAppModule<typeof CoreCognito>;
10
+ /**
11
+ * Attributes that users must never change themselves. `custom:id` is the Webiny identity id:
12
+ * a user who could write it would sign in as any other user. Webiny sets it with Cognito admin
13
+ * APIs, which `writeAttributes` doesn't restrict.
14
+ */
15
+ export declare const USER_PROTECTED_ATTRIBUTES: string[];
16
+ /**
17
+ * Everything users could write before (all standard and all custom attributes of the pool,
18
+ * including custom attributes a project adds to the schema), except the protected ones.
19
+ * Cognito has no deny list for app clients, so the allowed list is built from the pool schema.
20
+ */
21
+ export declare const getUserWritableAttributes: (schemas: pulumi.Input<aws.types.input.cognito.UserPoolSchema[] | undefined>) => pulumi.Output<string[]>;
8
22
  export declare const CoreCognito: import("@webiny/pulumi").PulumiAppModuleDefinition<{
9
23
  userPool: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cognito/userPool").UserPool>;
10
24
  userPoolClient: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cognito/userPoolClient").UserPoolClient>;
@@ -1,5 +1,37 @@
1
1
  import { createAppModule } from "@webiny/pulumi";
2
2
  import * as __rspack_external__pulumi_aws_9e2bee2d from "@pulumi/aws";
3
+ import * as __rspack_external__pulumi_pulumi_f3e773ed from "@pulumi/pulumi";
4
+ const STANDARD_USER_WRITABLE_ATTRIBUTES = [
5
+ "address",
6
+ "birthdate",
7
+ "email",
8
+ "family_name",
9
+ "gender",
10
+ "given_name",
11
+ "locale",
12
+ "middle_name",
13
+ "name",
14
+ "nickname",
15
+ "phone_number",
16
+ "picture",
17
+ "preferred_username",
18
+ "profile",
19
+ "updated_at",
20
+ "website",
21
+ "zoneinfo"
22
+ ];
23
+ const USER_PROTECTED_ATTRIBUTES = [
24
+ "custom:id"
25
+ ];
26
+ const getUserWritableAttributes = (schemas)=>__rspack_external__pulumi_pulumi_f3e773ed.output(schemas).apply((items)=>{
27
+ const custom = (items || []).map((schema)=>schema.name).filter((name)=>!STANDARD_USER_WRITABLE_ATTRIBUTES.includes(name)).filter((name)=>!name.endsWith("_verified")).map((name)=>name.startsWith("custom:") ? name : `custom:${name}`);
28
+ return [
29
+ ...new Set([
30
+ ...STANDARD_USER_WRITABLE_ATTRIBUTES,
31
+ ...custom
32
+ ])
33
+ ].filter((name)=>!USER_PROTECTED_ATTRIBUTES.includes(name));
34
+ });
3
35
  const CoreCognito = createAppModule({
4
36
  name: "Cognito",
5
37
  config (app, params) {
@@ -103,6 +135,7 @@ const CoreCognito = createAppModule({
103
135
  name: "user-pool-client",
104
136
  config: {
105
137
  userPoolId: userPool.output.id,
138
+ writeAttributes: getUserWritableAttributes(userPool.output.schemas),
106
139
  accessTokenValidity: 60,
107
140
  idTokenValidity: 60,
108
141
  refreshTokenValidity: 30,
@@ -119,6 +152,6 @@ const CoreCognito = createAppModule({
119
152
  };
120
153
  }
121
154
  });
122
- export { CoreCognito };
155
+ export { CoreCognito, USER_PROTECTED_ATTRIBUTES, getUserWritableAttributes };
123
156
 
124
157
  //# sourceMappingURL=CoreCognito.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pulumi/apps/core/CoreCognito.js","sources":["../../../../src/pulumi/apps/core/CoreCognito.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { createAppModule, type PulumiApp, type PulumiAppModule } from \"@webiny/pulumi\";\n\nexport interface CoreCognitoParams {\n protect: boolean;\n useEmailAsUsername: boolean;\n mfa?: boolean;\n}\n\nexport type CoreCognito = PulumiAppModule<typeof CoreCognito>;\n\nexport const CoreCognito = createAppModule({\n name: \"Cognito\",\n config(app: PulumiApp, params: CoreCognitoParams) {\n const userPool = app.addResource(aws.cognito.UserPool, {\n name: \"user-pool\",\n config: {\n passwordPolicy: {\n minimumLength: 8,\n requireLowercase: false,\n requireNumbers: false,\n requireSymbols: false,\n requireUppercase: false,\n temporaryPasswordValidityDays: 7\n },\n adminCreateUserConfig: {\n allowAdminCreateUserOnly: true\n },\n autoVerifiedAttributes: [\"email\"],\n emailConfiguration: {\n emailSendingAccount: \"COGNITO_DEFAULT\"\n },\n // In a legacy setup we use email as username.\n // We need to provide a way for users to have this setup,\n // because changing it would require whole cognito pool to be recreated.\n usernameAttributes: params.useEmailAsUsername ? [\"email\"] : undefined,\n aliasAttributes: params.useEmailAsUsername ? undefined : [\"preferred_username\"],\n lambdaConfig: {},\n mfaConfiguration: params.mfa ? \"ON\" : \"OFF\",\n softwareTokenMfaConfiguration: params.mfa ? { enabled: true } : undefined,\n userPoolAddOns: {\n advancedSecurityMode: \"OFF\" /* required */\n },\n verificationMessageTemplate: {\n defaultEmailOption: \"CONFIRM_WITH_CODE\"\n },\n accountRecoverySetting: {\n recoveryMechanisms: [{ name: \"verified_email\", priority: 1 }]\n },\n schemas: [\n {\n attributeDataType: \"String\",\n name: \"email\",\n required: true,\n developerOnlyAttribute: false,\n mutable: true,\n stringAttributeConstraints: {\n maxLength: \"2048\",\n minLength: \"0\"\n }\n },\n {\n attributeDataType: \"String\",\n name: \"family_name\",\n required: true,\n developerOnlyAttribute: false,\n mutable: true,\n stringAttributeConstraints: {\n maxLength: \"2048\",\n minLength: \"0\"\n }\n },\n {\n attributeDataType: \"String\",\n name: \"given_name\",\n required: true,\n developerOnlyAttribute: false,\n mutable: true,\n stringAttributeConstraints: {\n maxLength: \"2048\",\n minLength: \"0\"\n }\n },\n {\n attributeDataType: \"String\",\n name: \"id\",\n required: false,\n developerOnlyAttribute: false,\n mutable: true,\n stringAttributeConstraints: {\n maxLength: \"36\",\n minLength: \"0\"\n }\n }\n ]\n },\n opts: {\n protect: params.protect\n }\n });\n\n const userPoolClient = app.addResource(aws.cognito.UserPoolClient, {\n name: \"user-pool-client\",\n config: {\n userPoolId: userPool.output.id,\n accessTokenValidity: 60,\n idTokenValidity: 60,\n refreshTokenValidity: 30,\n tokenValidityUnits: {\n accessToken: \"minutes\",\n idToken: \"minutes\",\n refreshToken: \"days\"\n }\n }\n });\n\n return {\n userPool,\n userPoolClient\n };\n }\n});\n"],"names":["CoreCognito","createAppModule","app","params","userPool","aws","undefined","userPoolClient"],"mappings":";;AAWO,MAAMA,cAAcC,gBAAgB;IACvC,MAAM;IACN,QAAOC,GAAc,EAAEC,MAAyB;QAC5C,MAAMC,WAAWF,IAAI,WAAW,CAACG,uCAAAA,OAAAA,CAAAA,QAAoB,EAAE;YACnD,MAAM;YACN,QAAQ;gBACJ,gBAAgB;oBACZ,eAAe;oBACf,kBAAkB;oBAClB,gBAAgB;oBAChB,gBAAgB;oBAChB,kBAAkB;oBAClB,+BAA+B;gBACnC;gBACA,uBAAuB;oBACnB,0BAA0B;gBAC9B;gBACA,wBAAwB;oBAAC;iBAAQ;gBACjC,oBAAoB;oBAChB,qBAAqB;gBACzB;gBAIA,oBAAoBF,OAAO,kBAAkB,GAAG;oBAAC;iBAAQ,GAAGG;gBAC5D,iBAAiBH,OAAO,kBAAkB,GAAGG,SAAY;oBAAC;iBAAqB;gBAC/E,cAAc,CAAC;gBACf,kBAAkBH,OAAO,GAAG,GAAG,OAAO;gBACtC,+BAA+BA,OAAO,GAAG,GAAG;oBAAE,SAAS;gBAAK,IAAIG;gBAChE,gBAAgB;oBACZ,sBAAsB;gBAC1B;gBACA,6BAA6B;oBACzB,oBAAoB;gBACxB;gBACA,wBAAwB;oBACpB,oBAAoB;wBAAC;4BAAE,MAAM;4BAAkB,UAAU;wBAAE;qBAAE;gBACjE;gBACA,SAAS;oBACL;wBACI,mBAAmB;wBACnB,MAAM;wBACN,UAAU;wBACV,wBAAwB;wBACxB,SAAS;wBACT,4BAA4B;4BACxB,WAAW;4BACX,WAAW;wBACf;oBACJ;oBACA;wBACI,mBAAmB;wBACnB,MAAM;wBACN,UAAU;wBACV,wBAAwB;wBACxB,SAAS;wBACT,4BAA4B;4BACxB,WAAW;4BACX,WAAW;wBACf;oBACJ;oBACA;wBACI,mBAAmB;wBACnB,MAAM;wBACN,UAAU;wBACV,wBAAwB;wBACxB,SAAS;wBACT,4BAA4B;4BACxB,WAAW;4BACX,WAAW;wBACf;oBACJ;oBACA;wBACI,mBAAmB;wBACnB,MAAM;wBACN,UAAU;wBACV,wBAAwB;wBACxB,SAAS;wBACT,4BAA4B;4BACxB,WAAW;4BACX,WAAW;wBACf;oBACJ;iBACH;YACL;YACA,MAAM;gBACF,SAASH,OAAO,OAAO;YAC3B;QACJ;QAEA,MAAMI,iBAAiBL,IAAI,WAAW,CAACG,uCAAAA,OAAAA,CAAAA,cAA0B,EAAE;YAC/D,MAAM;YACN,QAAQ;gBACJ,YAAYD,SAAS,MAAM,CAAC,EAAE;gBAC9B,qBAAqB;gBACrB,iBAAiB;gBACjB,sBAAsB;gBACtB,oBAAoB;oBAChB,aAAa;oBACb,SAAS;oBACT,cAAc;gBAClB;YACJ;QACJ;QAEA,OAAO;YACHA;YACAG;QACJ;IACJ;AACJ"}
1
+ {"version":3,"file":"pulumi/apps/core/CoreCognito.js","sources":["../../../../src/pulumi/apps/core/CoreCognito.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport { createAppModule, type PulumiApp, type PulumiAppModule } from \"@webiny/pulumi\";\n\nexport interface CoreCognitoParams {\n protect: boolean;\n useEmailAsUsername: boolean;\n mfa?: boolean;\n}\n\nexport type CoreCognito = PulumiAppModule<typeof CoreCognito>;\n\n/**\n * Standard attributes users may change themselves (with their own access token). The\n * `*_verified` flags are left out, so users can't mark an address they don't own as verified.\n */\nconst STANDARD_USER_WRITABLE_ATTRIBUTES = [\n \"address\",\n \"birthdate\",\n \"email\",\n \"family_name\",\n \"gender\",\n \"given_name\",\n \"locale\",\n \"middle_name\",\n \"name\",\n \"nickname\",\n \"phone_number\",\n \"picture\",\n \"preferred_username\",\n \"profile\",\n \"updated_at\",\n \"website\",\n \"zoneinfo\"\n];\n\n/**\n * Attributes that users must never change themselves. `custom:id` is the Webiny identity id:\n * a user who could write it would sign in as any other user. Webiny sets it with Cognito admin\n * APIs, which `writeAttributes` doesn't restrict.\n */\nexport const USER_PROTECTED_ATTRIBUTES = [\"custom:id\"];\n\n/**\n * Everything users could write before (all standard and all custom attributes of the pool,\n * including custom attributes a project adds to the schema), except the protected ones.\n * Cognito has no deny list for app clients, so the allowed list is built from the pool schema.\n */\nexport const getUserWritableAttributes = (\n schemas: pulumi.Input<aws.types.input.cognito.UserPoolSchema[] | undefined>\n): pulumi.Output<string[]> => {\n return pulumi.output(schemas).apply(items => {\n const custom = (items || [])\n .map(schema => schema.name)\n .filter(name => !STANDARD_USER_WRITABLE_ATTRIBUTES.includes(name))\n .filter(name => !name.endsWith(\"_verified\"))\n .map(name => (name.startsWith(\"custom:\") ? name : `custom:${name}`));\n\n return [...new Set([...STANDARD_USER_WRITABLE_ATTRIBUTES, ...custom])].filter(name => {\n return !USER_PROTECTED_ATTRIBUTES.includes(name);\n });\n });\n};\n\nexport const CoreCognito = createAppModule({\n name: \"Cognito\",\n config(app: PulumiApp, params: CoreCognitoParams) {\n const userPool = app.addResource(aws.cognito.UserPool, {\n name: \"user-pool\",\n config: {\n passwordPolicy: {\n minimumLength: 8,\n requireLowercase: false,\n requireNumbers: false,\n requireSymbols: false,\n requireUppercase: false,\n temporaryPasswordValidityDays: 7\n },\n adminCreateUserConfig: {\n allowAdminCreateUserOnly: true\n },\n autoVerifiedAttributes: [\"email\"],\n emailConfiguration: {\n emailSendingAccount: \"COGNITO_DEFAULT\"\n },\n // In a legacy setup we use email as username.\n // We need to provide a way for users to have this setup,\n // because changing it would require whole cognito pool to be recreated.\n usernameAttributes: params.useEmailAsUsername ? [\"email\"] : undefined,\n aliasAttributes: params.useEmailAsUsername ? undefined : [\"preferred_username\"],\n lambdaConfig: {},\n mfaConfiguration: params.mfa ? \"ON\" : \"OFF\",\n softwareTokenMfaConfiguration: params.mfa ? { enabled: true } : undefined,\n userPoolAddOns: {\n advancedSecurityMode: \"OFF\" /* required */\n },\n verificationMessageTemplate: {\n defaultEmailOption: \"CONFIRM_WITH_CODE\"\n },\n accountRecoverySetting: {\n recoveryMechanisms: [{ name: \"verified_email\", priority: 1 }]\n },\n schemas: [\n {\n attributeDataType: \"String\",\n name: \"email\",\n required: true,\n developerOnlyAttribute: false,\n mutable: true,\n stringAttributeConstraints: {\n maxLength: \"2048\",\n minLength: \"0\"\n }\n },\n {\n attributeDataType: \"String\",\n name: \"family_name\",\n required: true,\n developerOnlyAttribute: false,\n mutable: true,\n stringAttributeConstraints: {\n maxLength: \"2048\",\n minLength: \"0\"\n }\n },\n {\n attributeDataType: \"String\",\n name: \"given_name\",\n required: true,\n developerOnlyAttribute: false,\n mutable: true,\n stringAttributeConstraints: {\n maxLength: \"2048\",\n minLength: \"0\"\n }\n },\n {\n attributeDataType: \"String\",\n name: \"id\",\n required: false,\n developerOnlyAttribute: false,\n mutable: true,\n stringAttributeConstraints: {\n maxLength: \"36\",\n minLength: \"0\"\n }\n }\n ]\n },\n opts: {\n protect: params.protect\n }\n });\n\n const userPoolClient = app.addResource(aws.cognito.UserPoolClient, {\n name: \"user-pool-client\",\n config: {\n userPoolId: userPool.output.id,\n writeAttributes: getUserWritableAttributes(userPool.output.schemas),\n accessTokenValidity: 60,\n idTokenValidity: 60,\n refreshTokenValidity: 30,\n tokenValidityUnits: {\n accessToken: \"minutes\",\n idToken: \"minutes\",\n refreshToken: \"days\"\n }\n }\n });\n\n return {\n userPool,\n userPoolClient\n };\n }\n});\n"],"names":["STANDARD_USER_WRITABLE_ATTRIBUTES","USER_PROTECTED_ATTRIBUTES","getUserWritableAttributes","schemas","pulumi","items","custom","schema","name","Set","CoreCognito","createAppModule","app","params","userPool","aws","undefined","userPoolClient"],"mappings":";;;AAgBA,MAAMA,oCAAoC;IACtC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACH;AAOM,MAAMC,4BAA4B;IAAC;CAAY;AAO/C,MAAMC,4BAA4B,CACrCC,UAEOC,0CAAAA,MAAa,CAACD,SAAS,KAAK,CAACE,CAAAA;QAChC,MAAMC,SAAUD,AAAAA,CAAAA,SAAS,EAAC,EACrB,GAAG,CAACE,CAAAA,SAAUA,OAAO,IAAI,EACzB,MAAM,CAACC,CAAAA,OAAQ,CAACR,kCAAkC,QAAQ,CAACQ,OAC3D,MAAM,CAACA,CAAAA,OAAQ,CAACA,KAAK,QAAQ,CAAC,cAC9B,GAAG,CAACA,CAAAA,OAASA,KAAK,UAAU,CAAC,aAAaA,OAAO,CAAC,OAAO,EAAEA,MAAM;QAEtE,OAAO;eAAI,IAAIC,IAAI;mBAAIT;mBAAsCM;aAAO;SAAE,CAAC,MAAM,CAACE,CAAAA,OACnE,CAACP,0BAA0B,QAAQ,CAACO;IAEnD;AAGG,MAAME,cAAcC,gBAAgB;IACvC,MAAM;IACN,QAAOC,GAAc,EAAEC,MAAyB;QAC5C,MAAMC,WAAWF,IAAI,WAAW,CAACG,uCAAAA,OAAAA,CAAAA,QAAoB,EAAE;YACnD,MAAM;YACN,QAAQ;gBACJ,gBAAgB;oBACZ,eAAe;oBACf,kBAAkB;oBAClB,gBAAgB;oBAChB,gBAAgB;oBAChB,kBAAkB;oBAClB,+BAA+B;g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EAAE;gBAC9B,iBAAiBZ,0BAA0BY,SAAS,MAAM,CAAC,OAAO;gBAClE,qBAAqB;gBACrB,iBAAiB;gBACjB,sBAAsB;gBACtB,oBAAoB;oBAChB,aAAa;oBACb,SAAS;oBACT,cAAc;gBAClB;YACJ;QACJ;QAEA,OAAO;YACHA;YACAG;QACJ;IACJ;AACJ"}
@@ -1,4 +1,5 @@
1
1
  import { getIdpConfig } from "./getIdpConfig.js";
2
+ import { getUserWritableAttributes } from "../CoreCognito.js";
2
3
  import { getEnvVariableAwsRegion } from "../../../env/awsRegion.js";
3
4
  import * as __rspack_external__pulumi_aws_9e2bee2d from "@pulumi/aws";
4
5
  import * as __rspack_external__pulumi_pulumi_f3e773ed from "@pulumi/pulumi";
@@ -41,6 +42,16 @@ const configureAdminCognitoFederation = (app, config)=>{
41
42
  return config.providerType;
42
43
  })
43
44
  ]);
45
+ const mappedAttributes = idpConfigs.flatMap((config)=>{
46
+ const mapping = config.attributeMapping || {};
47
+ return Object.keys(mapping).filter((name)=>"username" !== name);
48
+ });
49
+ appClient.config.writeAttributes(getUserWritableAttributes(userPool.output.schemas).apply((attributes)=>[
50
+ ...new Set([
51
+ ...attributes,
52
+ ...mappedAttributes
53
+ ])
54
+ ]));
44
55
  appClient.config.allowedOauthScopes([
45
56
  "profile",
46
57
  "email",
@@ -1 +1 @@
1
- {"version":3,"file":"pulumi/apps/core/cognitoIdentityProviders/configure.js","sources":["../../../../../src/pulumi/apps/core/cognitoIdentityProviders/configure.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { type UserPoolDomainArgs } from \"@pulumi/aws/cognito/userPoolDomain.js\";\nimport { type IdentityProviderArgs } from \"@pulumi/aws/cognito/index.js\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport {\n type PulumiApp,\n type PulumiAppResource,\n type PulumiAppResourceConstructor\n} from \"@webiny/pulumi\";\nimport { getIdpConfig } from \"./getIdpConfig.js\";\nimport { getEnvVariableAwsRegion } from \"~/pulumi/env/awsRegion.js\";\n\nexport type IdentityAttributeMapping = {\n \"custom:id\": string;\n username: string;\n email: string;\n family_name: string;\n given_name: string;\n [key: string]: string;\n};\n\nexport interface CognitoIdentityProvidersConfig {\n domain:\n | string\n | {\n name: UserPoolDomainArgs[\"domain\"];\n certificateArn?: UserPoolDomainArgs[\"certificateArn\"];\n };\n identityProviders: CognitoIdentityProviderConfig[];\n callbackUrls: string[];\n logoutUrls?: string[];\n}\n\nexport interface CognitoIdentityProviderConfig {\n name?: string;\n type: \"google\" | \"facebook\" | \"amazon\" | \"apple\" | \"oidc\";\n providerDetails: IdentityProviderArgs[\"providerDetails\"];\n idpIdentifiers?: IdentityProviderArgs[\"idpIdentifiers\"];\n attributeMapping?: IdentityAttributeMapping;\n}\n\nconst isString = (value?: any): value is string => {\n return typeof value === \"string\";\n};\n\nexport const configureAdminCognitoFederation = (\n app: PulumiApp,\n config: CognitoIdentityProvidersConfig\n) => {\n const region = getEnvVariableAwsRegion();\n\n const userPool = app.resources.userPool as PulumiAppResource<\n PulumiAppResourceConstructor<aws.cognito.UserPool>\n >;\n\n const appClient = app.resources.userPoolClient as PulumiAppResource<\n PulumiAppResourceConstructor<aws.cognito.UserPoolClient>\n >;\n\n /**\n * We need to create a user pool domain, which is used to interact with the federated identity providers.\n */\n const userPoolDomain = app.addResource(aws.cognito.UserPoolDomain, {\n name: \"cognitoUserPoolDomain\",\n config: {\n domain: isString(config.domain) ? config.domain : config.domain.name,\n certificateArn: isString(config.domain) ? undefined : config.domain.certificateArn,\n userPoolId: userPool.output.id\n }\n });\n\n app.addOutput(\n \"cognitoUserPoolDomain\",\n pulumi.interpolate`${userPoolDomain.output.domain}.auth.${region}.amazoncognito.com`\n );\n\n const idpConfigs: aws.cognito.IdentityProviderArgs[] = [];\n const idpOutputs: pulumi.Output<aws.cognito.IdentityProvider>[] = [];\n\n for (const idp of config.identityProviders) {\n const config = getIdpConfig(idp.type, userPool.output.id, idp);\n\n // The idea to lowercase the provider name emerged while working on backwards compatibility issue.\n // Basically, in cases where a user used the OIDC provider and did not specify a name, instead of\n // using `OIDC` as the name, we wanted to ensure `oidc` is used. But, what I soon realized is that\n // by simply lowercasing the name, we can avoid the need to check for the provider type and name.\n // And although this will now happen for all providers, it's not a problem since Pulumi requires\n // names to be all lowercase anyway.\n const name = config.providerName.toString().toLowerCase();\n\n const idpResource = app.addResource(aws.cognito.IdentityProvider, { name, config });\n idpOutputs.push(idpResource.output);\n\n idpConfigs.push(config);\n }\n\n appClient.opts.dependsOn = [\n ...(appClient.opts.dependsOn\n ? Array.isArray(appClient.opts.dependsOn)\n ? appClient.opts.dependsOn\n : [appClient.opts.dependsOn]\n : []),\n ...idpOutputs\n ] as pulumi.Input<pulumi.Resource>[];\n\n appClient.config.supportedIdentityProviders([\n \"COGNITO\",\n ...idpConfigs.map(config => {\n // For built-in identity providers, we use the type as the name. Only for OIDC,\n // we allow the user to provide a custom name, and we only use the type as a fallback.\n if (config.providerType === \"OIDC\") {\n return config.providerName;\n }\n return config.providerType;\n })\n ]);\n\n appClient.config.allowedOauthScopes([\"profile\", \"email\", \"openid\"]);\n appClient.config.allowedOauthFlows([\"implicit\", \"code\"]);\n appClient.config.allowedOauthFlowsUserPoolClient(true);\n appClient.config.callbackUrls(config.callbackUrls);\n appClient.config.logoutUrls(config.logoutUrls ?? config.callbackUrls);\n};\n"],"names":["isString","value","configureAdminCognitoFederation","app","config","region","getEnvVariableAwsRegion","userPool","appClient","userPoolDomain","aws","undefined","pulumi","idpConfigs","idpOutputs","idp","getIdpConfig","name","idpResource","Array"],"mappings":";;;;AAyCA,MAAMA,WAAW,CAACC,QACP,AAAiB,YAAjB,OAAOA;AAGX,MAAMC,kCAAkC,CAC3CC,KACAC;IAEA,MAAMC,SAASC;IAEf,MAAMC,WAAWJ,IAAI,SAAS,CAAC,QAAQ;IAIvC,MAAMK,YAAYL,IAAI,SAAS,CAAC,cAAc;IAO9C,MAAMM,iBAAiBN,IAAI,WAAW,CAACO,uCAAAA,OAAA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;QAAS;KAAS;IAClEA,UAAU,MAAM,CAAC,iBAAiB,CAAC;QAAC;QAAY;KAAO;IACvDA,UAAU,MAAM,CAAC,+BAA+B,CAAC;IACjDA,UAAU,MAAM,CAAC,YAAY,CAACJ,OAAO,YAAY;IACjDI,UAAU,MAAM,CAAC,UAAU,CAACJ,OAAO,UAAU,IAAIA,OAAO,YAAY;AACxE"}
1
+ {"version":3,"file":"pulumi/apps/core/cognitoIdentityProviders/configure.js","sources":["../../../../../src/pulumi/apps/core/cognitoIdentityProviders/configure.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { type UserPoolDomainArgs } from \"@pulumi/aws/cognito/userPoolDomain.js\";\nimport { type IdentityProviderArgs } from \"@pulumi/aws/cognito/index.js\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport {\n type PulumiApp,\n type PulumiAppResource,\n type PulumiAppResourceConstructor\n} from \"@webiny/pulumi\";\nimport { getIdpConfig } from \"./getIdpConfig.js\";\nimport { getUserWritableAttributes } from \"../CoreCognito.js\";\nimport { getEnvVariableAwsRegion } from \"~/pulumi/env/awsRegion.js\";\n\nexport type IdentityAttributeMapping = {\n \"custom:id\": string;\n username: string;\n email: string;\n family_name: string;\n given_name: string;\n [key: string]: string;\n};\n\nexport interface CognitoIdentityProvidersConfig {\n domain:\n | string\n | {\n name: UserPoolDomainArgs[\"domain\"];\n certificateArn?: UserPoolDomainArgs[\"certificateArn\"];\n };\n identityProviders: CognitoIdentityProviderConfig[];\n callbackUrls: string[];\n logoutUrls?: string[];\n}\n\nexport interface CognitoIdentityProviderConfig {\n name?: string;\n type: \"google\" | \"facebook\" | \"amazon\" | \"apple\" | \"oidc\";\n providerDetails: IdentityProviderArgs[\"providerDetails\"];\n idpIdentifiers?: IdentityProviderArgs[\"idpIdentifiers\"];\n attributeMapping?: IdentityAttributeMapping;\n}\n\nconst isString = (value?: any): value is string => {\n return typeof value === \"string\";\n};\n\nexport const configureAdminCognitoFederation = (\n app: PulumiApp,\n config: CognitoIdentityProvidersConfig\n) => {\n const region = getEnvVariableAwsRegion();\n\n const userPool = app.resources.userPool as PulumiAppResource<\n PulumiAppResourceConstructor<aws.cognito.UserPool>\n >;\n\n const appClient = app.resources.userPoolClient as PulumiAppResource<\n PulumiAppResourceConstructor<aws.cognito.UserPoolClient>\n >;\n\n /**\n * We need to create a user pool domain, which is used to interact with the federated identity providers.\n */\n const userPoolDomain = app.addResource(aws.cognito.UserPoolDomain, {\n name: \"cognitoUserPoolDomain\",\n config: {\n domain: isString(config.domain) ? config.domain : config.domain.name,\n certificateArn: isString(config.domain) ? undefined : config.domain.certificateArn,\n userPoolId: userPool.output.id\n }\n });\n\n app.addOutput(\n \"cognitoUserPoolDomain\",\n pulumi.interpolate`${userPoolDomain.output.domain}.auth.${region}.amazoncognito.com`\n );\n\n const idpConfigs: aws.cognito.IdentityProviderArgs[] = [];\n const idpOutputs: pulumi.Output<aws.cognito.IdentityProvider>[] = [];\n\n for (const idp of config.identityProviders) {\n const config = getIdpConfig(idp.type, userPool.output.id, idp);\n\n // The idea to lowercase the provider name emerged while working on backwards compatibility issue.\n // Basically, in cases where a user used the OIDC provider and did not specify a name, instead of\n // using `OIDC` as the name, we wanted to ensure `oidc` is used. But, what I soon realized is that\n // by simply lowercasing the name, we can avoid the need to check for the provider type and name.\n // And although this will now happen for all providers, it's not a problem since Pulumi requires\n // names to be all lowercase anyway.\n const name = config.providerName.toString().toLowerCase();\n\n const idpResource = app.addResource(aws.cognito.IdentityProvider, { name, config });\n idpOutputs.push(idpResource.output);\n\n idpConfigs.push(config);\n }\n\n appClient.opts.dependsOn = [\n ...(appClient.opts.dependsOn\n ? Array.isArray(appClient.opts.dependsOn)\n ? appClient.opts.dependsOn\n : [appClient.opts.dependsOn]\n : []),\n ...idpOutputs\n ] as pulumi.Input<pulumi.Resource>[];\n\n appClient.config.supportedIdentityProviders([\n \"COGNITO\",\n ...idpConfigs.map(config => {\n // For built-in identity providers, we use the type as the name. Only for OIDC,\n // we allow the user to provide a custom name, and we only use the type as a fallback.\n if (config.providerType === \"OIDC\") {\n return config.providerName;\n }\n return config.providerType;\n })\n ]);\n\n /* Cognito writes the mapped attributes on every federated sign-in, so the app client must be\n allowed to write them. Note: this includes `custom:id`, which then also becomes writable by\n users through their own access token. */\n const mappedAttributes = idpConfigs.flatMap(config => {\n const mapping = (config.attributeMapping || {}) as Record<string, unknown>;\n return Object.keys(mapping).filter(name => name !== \"username\");\n });\n appClient.config.writeAttributes(\n getUserWritableAttributes(userPool.output.schemas).apply(attributes => {\n return [...new Set([...attributes, ...mappedAttributes])];\n })\n );\n\n appClient.config.allowedOauthScopes([\"profile\", \"email\", \"openid\"]);\n appClient.config.allowedOauthFlows([\"implicit\", \"code\"]);\n appClient.config.allowedOauthFlowsUserPoolClient(true);\n appClient.config.callbackUrls(config.callbackUrls);\n appClient.config.logoutUrls(config.logoutUrls ?? config.callbackUrls);\n};\n"],"names":["isString","value","configureAdminCognitoFederation","app","config","region","getEnvVariableAwsRegion","userPool","appClient","userPoolDomain","aws","undefined","pulumi","idpConfigs","idpOutputs","idp","getIdpConfig","name","idpResource","Array","mappedAttributes","mapping","Object","getUserWritableAttributes","attributes","Set"],"mappings":";;;;;AA0CA,MAAMA,WAAW,CAACC,QACP,AAAiB,YAAjB,OAAOA;AAGX,MAAMC,kCAAkC,CAC3CC,KACAC;IAEA,MAAMC,SAASC;IAEf,MAAMC,WAAWJ,IAAI,SAAS,CAAC,QAAQ;IAIvC,MAAMK,YAAYL,IAAI,SAAS,CAAC,cAAc;IAO9C,MAAMM,iBAAiBN,IAAI,WAAW,CAACO,uCAAAA,OAAAA,CAAAA,cAA0B,EAAE;QAC/D,MAAM;QACN,QAAQ;YACJ,QAAQV,SAASI,OAAO,MAAM,IAAIA,OAAO,MAAM,GAAGA,OAAO,MAAM,CAAC,IAAI;YACpE,gBAAgBJ,SAASI,OAAO,MAAM,IAAIO,SAAYP,OAAO,MAAM,CAAC,cAAc;YAClF,YAAYG,SAAS,MAAM,C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AAA,aAC9C;eAAI,IAAIC,IAAI;mBAAID;mBAAeJ;aAAiB;SAAE;IAIjEZ,UAAU,MAAM,CAAC,kBAAkB,CAAC;QAAC;QAAW;QAAS;KAAS;IAClEA,UAAU,MAAM,CAAC,iBAAiB,CAAC;QAAC;QAAY;KAAO;IACvDA,UAAU,MAAM,CAAC,+BAA+B,CAAC;IACjDA,UAAU,MAAM,CAAC,YAAY,CAACJ,OAAO,YAAY;IACjDI,UAAU,MAAM,CAAC,UAAU,CAACJ,OAAO,UAAU,IAAIA,OAAO,YAAY;AACxE"}
@@ -171,7 +171,7 @@ const configureS3BucketMalwareProtection = (app)=>{
171
171
  }
172
172
  }
173
173
  });
174
- app.addResource(__rspack_external__pulumi_aws_9e2bee2d.iam.RolePolicyAttachment, {
174
+ const attachment = app.addResource(__rspack_external__pulumi_aws_9e2bee2d.iam.RolePolicyAttachment, {
175
175
  name: "fm-bucket-malware-protection-role-policy-attachment",
176
176
  config: {
177
177
  role: role.output.name,
@@ -187,6 +187,11 @@ const configureS3BucketMalwareProtection = (app)=>{
187
187
  bucketName: bucket.bucket
188
188
  }
189
189
  }
190
+ },
191
+ opts: {
192
+ dependsOn: [
193
+ attachment.output
194
+ ]
190
195
  }
191
196
  });
192
197
  const eventBridgeRole = app.addResource(__rspack_external__pulumi_aws_9e2bee2d.iam.Role, {
@@ -206,7 +211,7 @@ const configureS3BucketMalwareProtection = (app)=>{
206
211
  })
207
212
  }
208
213
  });
209
- app.addResource(__rspack_external__pulumi_aws_9e2bee2d.iam.RolePolicy, {
214
+ const forwardEventsPolicy = app.addResource(__rspack_external__pulumi_aws_9e2bee2d.iam.RolePolicy, {
210
215
  name: "guard-duty-forward-events-policy",
211
216
  config: {
212
217
  role: eventBridgeRole.output,
@@ -250,6 +255,11 @@ const configureS3BucketMalwareProtection = (app)=>{
250
255
  roleArn: eventBridgeRole.output.arn,
251
256
  eventBusName: "default",
252
257
  arn: eventBus.output.arn
258
+ },
259
+ opts: {
260
+ dependsOn: [
261
+ forwardEventsPolicy.output
262
+ ]
253
263
  }
254
264
  });
255
265
  };
@@ -1 +1 @@
1
- {"version":3,"file":"pulumi/apps/core/configureS3BucketMalwareProtection.js","sources":["../../../../src/pulumi/apps/core/configureS3BucketMalwareProtection.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport type { CorePulumiApp } from \"~/pulumi/apps/core/index.js\";\nimport { getAwsAccountId, getAwsRegion } from \"~/pulumi/apps/awsUtils.js\";\n\nexport const configureS3BucketMalwareProtection = (app: CorePulumiApp) => {\n const awsAccountId = getAwsAccountId(app);\n const awsRegion = getAwsRegion(app);\n const eventBus = app.resources.eventBus;\n\n const bucket = app.resources.fileManagerBucket.output;\n\n const currentAccount = {\n StringEquals: {\n \"aws:ResourceAccount\": awsAccountId\n }\n };\n\n const managedByGuardDuty = {\n StringEquals: {\n \"events:ManagedBy\": \"malware-protection-plan.guardduty.amazonaws.com\"\n }\n };\n\n const assumeRole = aws.iam.getPolicyDocument({\n statements: [\n {\n effect: \"Allow\",\n principals: [\n {\n type: \"Service\",\n identifiers: [\"malware-protection-plan.guardduty.amazonaws.com\"]\n }\n ],\n actions: [\"sts:AssumeRole\"]\n }\n ]\n });\n\n const role = app.addResource(aws.iam.Role, {\n name: \"fm-bucket-guardduty-role\",\n config: {\n assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json)\n }\n });\n\n const policy = app.addResource(aws.iam.Policy, {\n name: `fm-bucket-guardduty-role-policy`,\n config: {\n description: \"This policy enables GuardDuty to interact with the S3 bucket.\",\n policy: {\n Version: \"2012-10-17\",\n Statement: [\n {\n Sid: \"AllowManagedRuleToSendS3EventsToGuardDuty\",\n Effect: \"Allow\",\n Action: [\"events:PutRule\"],\n Resource: [\n pulumi.interpolate`arn:aws:events:${awsRegion}:${awsAccountId}:rule/DO-NOT-DELETE-AmazonGuardDutyMalwareProtectionS3*`\n ],\n Condition: {\n ...managedByGuardDuty,\n \"ForAllValues:StringEquals\": {\n \"events:source\": \"aws.s3\",\n \"events:detail-type\": [\n \"Object Created\",\n \"AWS API Call via CloudTrail\"\n ]\n },\n Null: {\n \"events:source\": \"false\",\n \"events:detail-type\": \"false\"\n }\n }\n },\n {\n Sid: \"AllowUpdateTargetAndDeleteManagedRule\",\n Effect: \"Allow\",\n Action: [\"events:DeleteRule\", \"events:PutTargets\", \"events:RemoveTargets\"],\n Resource: [\n pulumi.interpolate`arn:aws:events:${awsRegion}:${awsAccountId}:rule/DO-NOT-DELETE-AmazonGuardDutyMalwareProtectionS3*`\n ],\n Condition: {\n ...managedByGuardDuty\n }\n },\n {\n Sid: \"AllowGuardDutyToMonitorEventBridgeManagedRule\",\n Effect: \"Allow\",\n Action: [\"events:DescribeRule\", \"events:ListTargetsByRule\"],\n Resource: [\n pulumi.interpolate`arn:aws:events:${awsRegion}:${awsAccountId}:rule/DO-NOT-DELETE-AmazonGuardDutyMalwareProtectionS3*`\n ]\n },\n {\n Sid: \"AllowPostScanTag\",\n Effect: \"Allow\",\n Action: [\n \"s3:GetObjectTagging\",\n \"s3:GetObjectVersionTagging\",\n \"s3:PutObjectTagging\",\n \"s3:PutObjectVersionTagging\"\n ],\n Resource: [pulumi.interpolate`arn:aws:s3:::${bucket.bucket}/*`],\n Condition: {\n ...currentAccount\n }\n },\n {\n Sid: \"AllowEnableS3EventBridgeEvents\",\n Effect: \"Allow\",\n Action: [\"s3:PutBucketNotification\", \"s3:GetBucketNotification\"],\n Resource: [pulumi.interpolate`arn:aws:s3:::${bucket.bucket}`],\n Condition: {\n ...currentAccount\n }\n },\n {\n Sid: \"AllowPutValidationObject\",\n Effect: \"Allow\",\n Action: [\"s3:PutObject\"],\n Resource: [\n pulumi.interpolate`arn:aws:s3:::${bucket.bucket}/malware-protection-resource-validation-object`\n ],\n Condition: {\n ...currentAccount\n }\n },\n {\n Sid: \"AllowCheckBucketOwnership\",\n Effect: \"Allow\",\n Action: [\"s3:ListBucket\"],\n Resource: [pulumi.interpolate`arn:aws:s3:::${bucket.bucket}`],\n Condition: {\n ...currentAccount\n }\n },\n {\n Sid: \"AllowMalwareScan\",\n Effect: \"Allow\",\n Action: [\"s3:GetObject\", \"s3:GetObjectVersion\"],\n Resource: [pulumi.interpolate`arn:aws:s3:::${bucket.bucket}/*`],\n Condition: {\n ...currentAccount\n }\n }\n ]\n }\n }\n });\n\n app.addResource(aws.iam.RolePolicyAttachment, {\n name: `fm-bucket-malware-protection-role-policy-attachment`,\n config: {\n role: role.output.name,\n policyArn: policy.output.arn\n }\n });\n\n app.addResource(aws.guardduty.MalwareProtectionPlan, {\n name: `fm-bucket-malware-protection-plan`,\n config: {\n role: role.output.arn,\n protectedResource: {\n s3Bucket: {\n bucketName: bucket.bucket\n }\n }\n }\n });\n\n // FORWARD EVENTS FROM \"DEFAULT\" TO CUSTOM EVENT BUS.\n\n // Create an IAM Role for EventBridge to forward events\n const eventBridgeRole = app.addResource(aws.iam.Role, {\n name: \"guard-duty-forward-events-role\",\n config: {\n assumeRolePolicy: JSON.stringify({\n Version: \"2012-10-17\",\n Statement: [\n {\n Effect: \"Allow\",\n Principal: { Service: \"events.amazonaws.com\" },\n Action: \"sts:AssumeRole\"\n }\n ]\n })\n }\n });\n\n // Attach Policy to Allow EventBridge to PutEvents on Custom Event Bus\n app.addResource(aws.iam.RolePolicy, {\n name: \"guard-duty-forward-events-policy\",\n config: {\n role: eventBridgeRole.output,\n policy: pulumi.output(eventBus.output.arn).apply(arn =>\n JSON.stringify({\n Version: \"2012-10-17\",\n Statement: [\n {\n Effect: \"Allow\",\n Action: \"events:PutEvents\",\n Resource: arn\n }\n ]\n })\n )\n }\n });\n\n const forwardToCustomBusRule = app.addResource(aws.cloudwatch.EventRule, {\n name: \"forward-events-from-default-to-custom-bus-rule\",\n config: {\n eventBusName: \"default\",\n eventPattern: bucket.bucket.apply(name =>\n JSON.stringify({\n source: [\"aws.guardduty\"],\n \"detail-type\": [\"GuardDuty Malware Protection Object Scan Result\"],\n detail: {\n s3ObjectDetails: {\n bucketName: [name]\n }\n }\n })\n )\n }\n });\n\n // Target: Send events to the custom event bus\n app.addResource(aws.cloudwatch.EventTarget, {\n name: \"forward-events-from-default-to-custom-bus-target\",\n config: {\n rule: forwardToCustomBusRule.output.name,\n roleArn: eventBridgeRole.output.arn,\n eventBusName: \"default\",\n arn: eventBus.output.arn\n }\n });\n};\n"],"names":["configureS3BucketMalwareProtection","app","awsAccountId","getAwsAccountId","awsRegion","getAwsRegion","eventBus","bucket","currentAccount","managedByGuardDuty","assumeRole","aws","role","policy","pulumi","eventBridgeRole","JSON","arn","forwardToCustomBusRule","name"],"mappings":";;;AAKO,MAAMA,qCAAqC,CAACC;IAC/C,MAAMC,eAAeC,gBAAgBF;IACrC,MAAMG,YAAYC,aAAaJ;IAC/B,MAAMK,WAAWL,IAAI,SAAS,CAAC,QAAQ;IAEvC,MAAMM,SAASN,IAAI,SAAS,CAAC,iBAAiB,CAAC,MAAM;IAErD,MAAMO,iBAAiB;QACnB,cAAc;YACV,uBAAuBN;QAC3B;IACJ;IAEA,MAAMO,qBAAqB;QACvB,cAAc;YACV,oBAAoB;QACxB;IACJ;IAEA,MAAMC,aAAaC,uCAAAA,GAAAA,CAAAA,iBAAyB,CAAC;QACzC,YAAY;YACR;gBACI,QAAQ;gBACR,YAAY;oBACR;wBACI,MAAM;wBACN,aAAa;4BAAC;yBAAkD;oBACpE;iBACH;gBACD,SAAS;oBAAC;iBAAiB;YAC/B;SACH;IACL;IAEA,MAAMC,OAAOX,IAAI,WAAW,CAACU,uCAAAA,GAAAA,CAAAA,IAAY,EAAE;QACvC,MAAM;QACN,QAAQ;YACJ,kBAAkBD,WAAW,IAAI,CAACA,CAAAA,aAAcA,WAAW,IAAI;QACnE;IACJ;IAEA,MAAMG,SAASZ,IAAI,WAAW,CAACU,uCAAAA,GAAAA,CAAAA,MAAc,EAAE;QAC3C,MAAM;QACN,QAAQ;YACJ,aAAa;YACb,QAAQ;gBACJ,SAAS;gBACT,WAA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AAA,CAAAA,UAAkB,EAAE;QAChC,MAAM;QACN,QAAQ;YACJ,MAAMI,gBAAgB,MAAM;YAC5B,QAAQD,0CAAAA,MAAa,CAACR,SAAS,MAAM,CAAC,GAAG,EAAE,KAAK,CAACW,CAAAA,MAC7CD,KAAK,SAAS,CAAC;oBACX,SAAS;oBACT,WAAW;wBACP;4BACI,QAAQ;4BACR,QAAQ;4BACR,UAAUC;wBACd;qBACH;gBACL;QAER;IACJ;IAEA,MAAMC,yBAAyBjB,IAAI,WAAW,CAACU,uCAAAA,UAAAA,CAAAA,SAAwB,EAAE;QACrE,MAAM;QACN,QAAQ;YACJ,cAAc;YACd,cAAcJ,OAAO,MAAM,CAAC,KAAK,CAACY,CAAAA,OAC9BH,KAAK,SAAS,CAAC;oBACX,QAAQ;wBAAC;qBAAgB;oBACzB,eAAe;wBAAC;qBAAkD;oBAClE,QAAQ;wBACJ,iBAAiB;4BACb,YAAY;gCAACG;6BAAK;wBACtB;oBACJ;gBACJ;QAER;IACJ;IAGAlB,IAAI,WAAW,CAACU,uCAAAA,UAAAA,CAAAA,WAA0B,EAAE;QACxC,MAAM;QACN,QAAQ;YACJ,MAAMO,uBAAuB,MAAM,CAAC,IAAI;YACxC,SAASH,gBAAgB,MAAM,CAAC,GAAG;YACnC,cAAc;YACd,KAAKT,SAAS,MAAM,CAAC,GAAG;QAC5B;IACJ;AACJ"}
1
+ {"version":3,"file":"pulumi/apps/core/configureS3BucketMalwareProtection.js","sources":["../../../../src/pulumi/apps/core/configureS3BucketMalwareProtection.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport type { CorePulumiApp } from \"~/pulumi/apps/core/index.js\";\nimport { getAwsAccountId, getAwsRegion } from \"~/pulumi/apps/awsUtils.js\";\n\nexport const configureS3BucketMalwareProtection = (app: CorePulumiApp) => {\n const awsAccountId = getAwsAccountId(app);\n const awsRegion = getAwsRegion(app);\n const eventBus = app.resources.eventBus;\n\n const bucket = app.resources.fileManagerBucket.output;\n\n const currentAccount = {\n StringEquals: {\n \"aws:ResourceAccount\": awsAccountId\n }\n };\n\n const managedByGuardDuty = {\n StringEquals: {\n \"events:ManagedBy\": \"malware-protection-plan.guardduty.amazonaws.com\"\n }\n };\n\n const assumeRole = aws.iam.getPolicyDocument({\n statements: [\n {\n effect: \"Allow\",\n principals: [\n {\n type: \"Service\",\n identifiers: [\"malware-protection-plan.guardduty.amazonaws.com\"]\n }\n ],\n actions: [\"sts:AssumeRole\"]\n }\n ]\n });\n\n const role = app.addResource(aws.iam.Role, {\n name: \"fm-bucket-guardduty-role\",\n config: {\n assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json)\n }\n });\n\n const policy = app.addResource(aws.iam.Policy, {\n name: `fm-bucket-guardduty-role-policy`,\n config: {\n description: \"This policy enables GuardDuty to interact with the S3 bucket.\",\n policy: {\n Version: \"2012-10-17\",\n Statement: [\n {\n Sid: \"AllowManagedRuleToSendS3EventsToGuardDuty\",\n Effect: \"Allow\",\n Action: [\"events:PutRule\"],\n Resource: [\n pulumi.interpolate`arn:aws:events:${awsRegion}:${awsAccountId}:rule/DO-NOT-DELETE-AmazonGuardDutyMalwareProtectionS3*`\n ],\n Condition: {\n ...managedByGuardDuty,\n \"ForAllValues:StringEquals\": {\n \"events:source\": \"aws.s3\",\n \"events:detail-type\": [\n \"Object Created\",\n \"AWS API Call via CloudTrail\"\n ]\n },\n Null: {\n \"events:source\": \"false\",\n \"events:detail-type\": \"false\"\n }\n }\n },\n {\n Sid: \"AllowUpdateTargetAndDeleteManagedRule\",\n Effect: \"Allow\",\n Action: [\"events:DeleteRule\", \"events:PutTargets\", \"events:RemoveTargets\"],\n Resource: [\n pulumi.interpolate`arn:aws:events:${awsRegion}:${awsAccountId}:rule/DO-NOT-DELETE-AmazonGuardDutyMalwareProtectionS3*`\n ],\n Condition: {\n ...managedByGuardDuty\n }\n },\n {\n Sid: \"AllowGuardDutyToMonitorEventBridgeManagedRule\",\n Effect: \"Allow\",\n Action: [\"events:DescribeRule\", \"events:ListTargetsByRule\"],\n Resource: [\n pulumi.interpolate`arn:aws:events:${awsRegion}:${awsAccountId}:rule/DO-NOT-DELETE-AmazonGuardDutyMalwareProtectionS3*`\n ]\n },\n {\n Sid: \"AllowPostScanTag\",\n Effect: \"Allow\",\n Action: [\n \"s3:GetObjectTagging\",\n \"s3:GetObjectVersionTagging\",\n \"s3:PutObjectTagging\",\n \"s3:PutObjectVersionTagging\"\n ],\n Resource: [pulumi.interpolate`arn:aws:s3:::${bucket.bucket}/*`],\n Condition: {\n ...currentAccount\n }\n },\n {\n Sid: \"AllowEnableS3EventBridgeEvents\",\n Effect: \"Allow\",\n Action: [\"s3:PutBucketNotification\", \"s3:GetBucketNotification\"],\n Resource: [pulumi.interpolate`arn:aws:s3:::${bucket.bucket}`],\n Condition: {\n ...currentAccount\n }\n },\n {\n Sid: \"AllowPutValidationObject\",\n Effect: \"Allow\",\n Action: [\"s3:PutObject\"],\n Resource: [\n pulumi.interpolate`arn:aws:s3:::${bucket.bucket}/malware-protection-resource-validation-object`\n ],\n Condition: {\n ...currentAccount\n }\n },\n {\n Sid: \"AllowCheckBucketOwnership\",\n Effect: \"Allow\",\n Action: [\"s3:ListBucket\"],\n Resource: [pulumi.interpolate`arn:aws:s3:::${bucket.bucket}`],\n Condition: {\n ...currentAccount\n }\n },\n {\n Sid: \"AllowMalwareScan\",\n Effect: \"Allow\",\n Action: [\"s3:GetObject\", \"s3:GetObjectVersion\"],\n Resource: [pulumi.interpolate`arn:aws:s3:::${bucket.bucket}/*`],\n Condition: {\n ...currentAccount\n }\n }\n ]\n }\n }\n });\n\n const attachment = app.addResource(aws.iam.RolePolicyAttachment, {\n name: `fm-bucket-malware-protection-role-policy-attachment`,\n config: {\n role: role.output.name,\n policyArn: policy.output.arn\n }\n });\n\n app.addResource(aws.guardduty.MalwareProtectionPlan, {\n name: `fm-bucket-malware-protection-plan`,\n config: {\n role: role.output.arn,\n protectedResource: {\n s3Bucket: {\n bucketName: bucket.bucket\n }\n }\n },\n opts: {\n /**\n * The plan needs the role's permissions when it's created, and when it's deleted\n * (to remove its EventBridge rule). Without this dependency, Pulumi can create the\n * plan before the policy is attached, and delete the attachment before the plan.\n */\n dependsOn: [attachment.output]\n }\n });\n\n // FORWARD EVENTS FROM \"DEFAULT\" TO CUSTOM EVENT BUS.\n\n // Create an IAM Role for EventBridge to forward events\n const eventBridgeRole = app.addResource(aws.iam.Role, {\n name: \"guard-duty-forward-events-role\",\n config: {\n assumeRolePolicy: JSON.stringify({\n Version: \"2012-10-17\",\n Statement: [\n {\n Effect: \"Allow\",\n Principal: { Service: \"events.amazonaws.com\" },\n Action: \"sts:AssumeRole\"\n }\n ]\n })\n }\n });\n\n // Attach Policy to Allow EventBridge to PutEvents on Custom Event Bus\n const forwardEventsPolicy = app.addResource(aws.iam.RolePolicy, {\n name: \"guard-duty-forward-events-policy\",\n config: {\n role: eventBridgeRole.output,\n policy: pulumi.output(eventBus.output.arn).apply(arn =>\n JSON.stringify({\n Version: \"2012-10-17\",\n Statement: [\n {\n Effect: \"Allow\",\n Action: \"events:PutEvents\",\n Resource: arn\n }\n ]\n })\n )\n }\n });\n\n const forwardToCustomBusRule = app.addResource(aws.cloudwatch.EventRule, {\n name: \"forward-events-from-default-to-custom-bus-rule\",\n config: {\n eventBusName: \"default\",\n eventPattern: bucket.bucket.apply(name =>\n JSON.stringify({\n source: [\"aws.guardduty\"],\n \"detail-type\": [\"GuardDuty Malware Protection Object Scan Result\"],\n detail: {\n s3ObjectDetails: {\n bucketName: [name]\n }\n }\n })\n )\n }\n });\n\n // Target: Send events to the custom event bus\n app.addResource(aws.cloudwatch.EventTarget, {\n name: \"forward-events-from-default-to-custom-bus-target\",\n config: {\n rule: forwardToCustomBusRule.output.name,\n roleArn: eventBridgeRole.output.arn,\n eventBusName: \"default\",\n arn: eventBus.output.arn\n },\n opts: {\n // The target uses the role to forward events, so the role's policy must exist first.\n dependsOn: [forwardEventsPolicy.output]\n }\n });\n};\n"],"names":["configureS3BucketMalwareProtection","app","awsAccountId","getAwsAccountId","awsRegion","getAwsRegion","eventBus","bucket","currentAccount","managedByGuardDuty","assumeRole","aws","role","policy","pulumi","attachment","eventBridgeRole","JSON","forwardEventsPolicy","arn","forwardToCustomBusRule","name"],"mappings":";;;AAKO,MAAMA,qCAAqC,CAACC;IAC/C,MAAMC,eAAeC,gBAAgBF;IACrC,MAAMG,YAAYC,aAAaJ;IAC/B,MAAMK,WAAWL,IAAI,SAAS,CAAC,QAAQ;IAEvC,MAAMM,SAASN,IAAI,SAAS,CAAC,iBAAiB,CAAC,MAAM;IAErD,MAAMO,iBAAiB;QACnB,cAAc;YACV,uBAAuBN;QAC3B;IACJ;IAEA,MAAMO,qBAAqB;QACvB,cAAc;YACV,oBAAoB;QACxB;IACJ;IAEA,MAAMC,aAAaC,uCAAAA,GAAAA,CAAAA,iBAAyB,CAAC;QACzC,YAAY;YACR;gBACI,QAAQ;gBACR,YAAY;oBACR;wBACI,MAAM;wBACN,aAAa;4BAAC;yBAAkD;oBACpE;iBACH;gBACD,SAAS;oBAAC;iBAAiB;YAC/B;SACH;IACL;IAEA,MAAMC,OAAOX,IAAI,WAAW,CAACU,uCAAAA,GAAAA,CAAAA,IAAY,EAAE;QACvC,MAAM;QACN,QAAQ;YACJ,kBAAkBD,WAAW,IAAI,CAACA,CAAAA,aAAcA,WAAW,IAAI;QACnE;IACJ;IAEA,MAAMG,SAASZ,IAAI,WAAW,CAACU,uCAAAA,GAAAA,CAAAA,MAAc,EAAE;QAC3C,MAAM;QACN,QAAQ;YACJ,aAAa;YACb,QAAQ;gBACJ,SAAS;gBACT,WAAW;oBACP;wBACI,KAAK;wBACL,QAAQ;wBACR,QAAQ;4BAAC;yBAAiB;wBAC1B,UAAU;4BACNG,0CAAAA,WAAkB,CAAC,eAAe,EAAEV,UAAU,CAAC,EAAEF,aAAa,uDAAuD,CAAC;yBACzH;wBACD,WAAW;4BACP,GAAGO,kBAAkB;4B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MAAM,CAAC,GAAG,EAAE,KAAK,CAACa,CAAAA,MAC7CF,KAAK,SAAS,CAAC;oBACX,SAAS;oBACT,WAAW;wBACP;4BACI,QAAQ;4BACR,QAAQ;4BACR,UAAUE;wBACd;qBACH;gBACL;QAER;IACJ;IAEA,MAAMC,yBAAyBnB,IAAI,WAAW,CAACU,uCAAAA,UAAAA,CAAAA,SAAwB,EAAE;QACrE,MAAM;QACN,QAAQ;YACJ,cAAc;YACd,cAAcJ,OAAO,MAAM,CAAC,KAAK,CAACc,CAAAA,OAC9BJ,KAAK,SAAS,CAAC;oBACX,QAAQ;wBAAC;qBAAgB;oBACzB,eAAe;wBAAC;qBAAkD;oBAClE,QAAQ;wBACJ,iBAAiB;4BACb,YAAY;gCAACI;6BAAK;wBACtB;oBACJ;gBACJ;QAER;IACJ;IAGApB,IAAI,WAAW,CAACU,uCAAAA,UAAAA,CAAAA,WAA0B,EAAE;QACxC,MAAM;QACN,QAAQ;YACJ,MAAMS,uBAAuB,MAAM,CAAC,IAAI;YACxC,SAASJ,gBAAgB,MAAM,CAAC,GAAG;YACnC,cAAc;YACd,KAAKV,SAAS,MAAM,CAAC,GAAG;QAC5B;QACA,MAAM;YAEF,WAAW;gBAACY,oBAAoB,MAAM;aAAC;QAC3C;IACJ;AACJ"}
@@ -34,7 +34,7 @@ function withCommonLambdaEnvVariables(app) {
34
34
  app.decorateProgram(async (program, app)=>{
35
35
  const output = await program({
36
36
  ...app,
37
- setCommonLambdaEnvVariables: setCommonLambdaEnvVariables
37
+ setCommonLambdaEnvVariables
38
38
  });
39
39
  app.addHandler(()=>{
40
40
  sealEnvVariables();
@@ -43,7 +43,7 @@ function withCommonLambdaEnvVariables(app) {
43
43
  });
44
44
  return {
45
45
  ...app,
46
- setCommonLambdaEnvVariables: setCommonLambdaEnvVariables
46
+ setCommonLambdaEnvVariables
47
47
  };
48
48
  }
49
49
  export { getCommonLambdaEnvVariables, sealEnvVariables, withCommonLambdaEnvVariables };
@@ -1 +1 @@
1
- {"version":3,"file":"pulumi/utils/lambdaEnvVariables.js","sources":["../../../src/pulumi/utils/lambdaEnvVariables.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport type { PulumiApp } from \"@webiny/pulumi\";\n\ntype EnvVariables = Record<string, string | pulumi.Output<string>>;\n\nconst variablesRegistry: EnvVariables = {};\n\nif (process.env.DEBUG === \"true\") {\n variablesRegistry.NODE_OPTIONS = \"--enable-source-maps\";\n}\n\nexport let sealEnvVariables: () => void;\n\nconst magicPrefixes = [\n \"WEBINY_\",\n \"WEBINY_API_\",\n // Added WCP vars separately. We don't need any other `WCP_PROJECT_` variables, apart from these.\n // WEBINY_PROJECT_API_KEY is the new naming (preferred), WCP_PROJECT_ENVIRONMENT_API_KEY is for backward compatibility.\n // This will be later removed because we'll be using `Api.BuildParam` extension.\n \"WEBINY_PROJECT_API_KEY\",\n \"WCP_PROJECT_ENVIRONMENT\",\n \"WCP_PROJECT_ENVIRONMENT_API_KEY\",\n \"OKTA_\",\n \"AUTH0_\"\n];\n\nconst variablesPromise = new Promise<EnvVariables>(resolve => {\n sealEnvVariables = () => {\n // Apart from a couple of basic environment variables like DEBUG,\n // we also take into consideration variables that have `WEBINY_` and `WCP_` prefix in their names.\n const baseVariables = Object.keys(process.env).reduce<EnvVariables>(\n (current, environmentVariableName) => {\n const hasMagicPrefix = magicPrefixes.some(prefix =>\n environmentVariableName.startsWith(prefix)\n );\n\n if (hasMagicPrefix && process.env[environmentVariableName] !== undefined) {\n current[environmentVariableName] = String(process.env[environmentVariableName]);\n }\n return current;\n },\n {\n // Among other things, this determines the amount of information we reveal on runtime errors.\n // https://www.webiny.com/docs/how-to-guides/environment-variables/#debug-environment-variable\n DEBUG: String(process.env.DEBUG),\n // This flag means that Lambda was deployed using the new Pulumi Apps architecture.\n PULUMI_APPS: \"true\"\n }\n );\n\n resolve(Object.assign({}, baseVariables, variablesRegistry));\n };\n});\n\nexport function getCommonLambdaEnvVariables(): pulumi.Output<EnvVariables> {\n return pulumi.output(variablesPromise);\n}\n\nfunction setCommonLambdaEnvVariables(variables: EnvVariables) {\n Object.assign(variablesRegistry, variables);\n}\n\nexport interface SetCommonLambdaEnvVariables {\n (variables: EnvVariables): void;\n}\n\nexport interface WithCommonLambdaEnvVariables {\n /**\n * Set ENV variables that wil be assigned to all Lambda functions in the current Pulumi app.\n */\n setCommonLambdaEnvVariables: SetCommonLambdaEnvVariables;\n}\n\n/**\n * Augment the given app with `setCommonLambdaEnvVariables` functionality.\n * @param {PulumiApp} app\n */\nexport function withCommonLambdaEnvVariables<T extends PulumiApp>(\n app: T\n): T & WithCommonLambdaEnvVariables {\n app.decorateProgram<{ setCommonLambdaEnvVariables: typeof setCommonLambdaEnvVariables }>(\n async (program, app) => {\n const output = await program({\n ...app,\n setCommonLambdaEnvVariables\n });\n\n // Once the program is executed, we need to seal the variables (this will resolve the pulumi.output promise).\n app.addHandler(() => {\n sealEnvVariables();\n });\n\n return output;\n }\n );\n\n // Augment the original PulumiApp.\n return {\n ...app,\n setCommonLambdaEnvVariables\n };\n}\n"],"names":["variablesRegistry","process","sealEnvVariables","magicPrefixes","variablesPromise","Promise","resolve","baseVariables","Object","current","environmentVariableName","hasMagicPrefix","prefix","undefined","String","getCommonLambdaEnvVariables","pulumi","setCommonLambdaEnvVariables","variables","withCommonLambdaEnvVariables","app","program","output"],"mappings":";AAKA,MAAMA,oBAAkC,CAAC;AAEzC,IAAIC,AAAsB,WAAtBA,QAAQ,GAAG,CAAC,KAAK,EACjBD,kBAAkB,YAAY,GAAG;AAG9B,IAAIE;AAEX,MAAMC,gBAAgB;IAClB;IACA;IAIA;IACA;IACA;IACA;IACA;CACH;AAED,MAAMC,mBAAmB,IAAIC,QAAsBC,CAAAA;IAC/CJ,mBAAmB;QAGf,MAAMK,gBAAgBC,OAAO,IAAI,CAACP,QAAQ,GAAG,EAAE,MAAM,CACjD,CAACQ,SAASC;YACN,MAAMC,iBAAiBR,cAAc,IAAI,CAACS,CAAAA,SACtCF,wBAAwB,UAAU,CAACE;YAGvC,IAAID,kBAAkBV,AAAyCY,WAAzCZ,QAAQ,GAAG,CAACS,wBAAwB,EACtDD,OAAO,CAACC,wBAAwB,GAAGI,OAAOb,QAAQ,GAAG,CAACS,wBAAwB;YAElF,OAAOD;QACX,GACA;YAGI,OAAOK,OAAOb,QAAQ,GAAG,CAAC,KAAK;YAE/B,aAAa;QACjB;QAGJK,QAAQE,OAAO,MAAM,CAAC,CAAC,GAAGD,eAAeP;IAC7C;AACJ;AAEO,SAASe;IACZ,OAAOC,0CAAAA,MAAa,CAACZ;AACzB;AAEA,SAASa,4BAA4BC,SAAuB;IACxDV,OAAO,MAAM,CAACR,mBAAmBkB;AACrC;AAiBO,SAASC,6BACZC,GAAM;IAENA,IAAI,eAAe,CACf,OAAOC,SAASD;QACZ,MAAME,SAAS,MAAMD,QAAQ;YACzB,GAAGD,GAAG;YACNH,6BAAAA;QACJ;QAGAG,IAAI,UAAU,CAAC;YACXlB;QACJ;QAEA,OAAOoB;IACX;IAIJ,OAAO;QACH,GAAGF,GAAG;QACNH,6BAAAA;IACJ;AACJ"}
1
+ {"version":3,"file":"pulumi/utils/lambdaEnvVariables.js","sources":["../../../src/pulumi/utils/lambdaEnvVariables.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport type { PulumiApp } from \"@webiny/pulumi\";\n\ntype EnvVariables = Record<string, string | pulumi.Output<string>>;\n\nconst variablesRegistry: EnvVariables = {};\n\nif (process.env.DEBUG === \"true\") {\n variablesRegistry.NODE_OPTIONS = \"--enable-source-maps\";\n}\n\nexport let sealEnvVariables: () => void;\n\nconst magicPrefixes = [\n \"WEBINY_\",\n \"WEBINY_API_\",\n // Added WCP vars separately. We don't need any other `WCP_PROJECT_` variables, apart from these.\n // WEBINY_PROJECT_API_KEY is the new naming (preferred), WCP_PROJECT_ENVIRONMENT_API_KEY is for backward compatibility.\n // This will be later removed because we'll be using `Api.BuildParam` extension.\n \"WEBINY_PROJECT_API_KEY\",\n \"WCP_PROJECT_ENVIRONMENT\",\n \"WCP_PROJECT_ENVIRONMENT_API_KEY\",\n \"OKTA_\",\n \"AUTH0_\"\n];\n\nconst variablesPromise = new Promise<EnvVariables>(resolve => {\n sealEnvVariables = () => {\n // Apart from a couple of basic environment variables like DEBUG,\n // we also take into consideration variables that have `WEBINY_` and `WCP_` prefix in their names.\n const baseVariables = Object.keys(process.env).reduce<EnvVariables>(\n (current, environmentVariableName) => {\n const hasMagicPrefix = magicPrefixes.some(prefix =>\n environmentVariableName.startsWith(prefix)\n );\n\n if (hasMagicPrefix && process.env[environmentVariableName] !== undefined) {\n current[environmentVariableName] = String(process.env[environmentVariableName]);\n }\n return current;\n },\n {\n // Among other things, this determines the amount of information we reveal on runtime errors.\n // https://www.webiny.com/docs/how-to-guides/environment-variables/#debug-environment-variable\n DEBUG: String(process.env.DEBUG),\n // This flag means that Lambda was deployed using the new Pulumi Apps architecture.\n PULUMI_APPS: \"true\"\n }\n );\n\n resolve(Object.assign({}, baseVariables, variablesRegistry));\n };\n});\n\nexport function getCommonLambdaEnvVariables(): pulumi.Output<EnvVariables> {\n return pulumi.output(variablesPromise);\n}\n\nfunction setCommonLambdaEnvVariables(variables: EnvVariables) {\n Object.assign(variablesRegistry, variables);\n}\n\nexport interface SetCommonLambdaEnvVariables {\n (variables: EnvVariables): void;\n}\n\nexport interface WithCommonLambdaEnvVariables {\n /**\n * Set ENV variables that wil be assigned to all Lambda functions in the current Pulumi app.\n */\n setCommonLambdaEnvVariables: SetCommonLambdaEnvVariables;\n}\n\n/**\n * Augment the given app with `setCommonLambdaEnvVariables` functionality.\n * @param {PulumiApp} app\n */\nexport function withCommonLambdaEnvVariables<T extends PulumiApp>(\n app: T\n): T & WithCommonLambdaEnvVariables {\n app.decorateProgram<{ setCommonLambdaEnvVariables: typeof setCommonLambdaEnvVariables }>(\n async (program, app) => {\n const output = await program({\n ...app,\n setCommonLambdaEnvVariables\n });\n\n // Once the program is executed, we need to seal the variables (this will resolve the pulumi.output promise).\n app.addHandler(() => {\n sealEnvVariables();\n });\n\n return output;\n }\n );\n\n // Augment the original PulumiApp.\n return {\n ...app,\n setCommonLambdaEnvVariables\n };\n}\n"],"names":["variablesRegistry","process","sealEnvVariables","magicPrefixes","variablesPromise","Promise","resolve","baseVariables","Object","current","environmentVariableName","hasMagicPrefix","prefix","undefined","String","getCommonLambdaEnvVariables","pulumi","setCommonLambdaEnvVariables","variables","withCommonLambdaEnvVariables","app","program","output"],"mappings":";AAKA,MAAMA,oBAAkC,CAAC;AAEzC,IAAIC,AAAsB,WAAtBA,QAAQ,GAAG,CAAC,KAAK,EACjBD,kBAAkB,YAAY,GAAG;AAG9B,IAAIE;AAEX,MAAMC,gBAAgB;IAClB;IACA;IAIA;IACA;IACA;IACA;IACA;CACH;AAED,MAAMC,mBAAmB,IAAIC,QAAsBC,CAAAA;IAC/CJ,mBAAmB;QAGf,MAAMK,gBAAgBC,OAAO,IAAI,CAACP,QAAQ,GAAG,EAAE,MAAM,CACjD,CAACQ,SAASC;YACN,MAAMC,iBAAiBR,cAAc,IAAI,CAACS,CAAAA,SACtCF,wBAAwB,UAAU,CAACE;YAGvC,IAAID,kBAAkBV,AAAyCY,WAAzCZ,QAAQ,GAAG,CAACS,wBAAwB,EACtDD,OAAO,CAACC,wBAAwB,GAAGI,OAAOb,QAAQ,GAAG,CAACS,wBAAwB;YAElF,OAAOD;QACX,GACA;YAGI,OAAOK,OAAOb,QAAQ,GAAG,CAAC,KAAK;YAE/B,aAAa;QACjB;QAGJK,QAAQE,OAAO,MAAM,CAAC,CAAC,GAAGD,eAAeP;IAC7C;AACJ;AAEO,SAASe;IACZ,OAAOC,0CAAAA,MAAa,CAACZ;AACzB;AAEA,SAASa,4BAA4BC,SAAuB;IACxDV,OAAO,MAAM,CAACR,mBAAmBkB;AACrC;AAiBO,SAASC,6BACZC,GAAM;IAENA,IAAI,eAAe,CACf,OAAOC,SAASD;QACZ,MAAME,SAAS,MAAMD,QAAQ;YACzB,GAAGD,GAAG;YACNH;QACJ;QAGAG,IAAI,UAAU,CAAC;YACXlB;QACJ;QAEA,OAAOoB;IACX;IAIJ,OAAO;QACH,GAAGF,GAAG;QACNH;IACJ;AACJ"}