@webiny/project-aws 6.6.0-alpha.0 → 6.6.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (259) hide show
  1. package/_templates/appTemplates/api/graphql/src/index.ts +12 -1
  2. package/_templates/extensions/OpenSearch/api/graphql/src/index.ts +9 -1
  3. package/abstractions/pulumiTypes.d.ts +15 -0
  4. package/abstractions/pulumiTypes.js +0 -0
  5. package/api.js +1 -3
  6. package/api.js.map +1 -1
  7. package/apps/createApiApp.d.ts +8 -0
  8. package/exports/infra/admin.d.ts +1 -3
  9. package/exports/infra/admin.js +0 -3
  10. package/exports/infra/api.d.ts +1 -3
  11. package/exports/infra/api.js +0 -3
  12. package/exports/infra/core.d.ts +1 -2
  13. package/exports/infra/core.js +0 -2
  14. package/extensions/ApiLambdaFunction.js +3 -2
  15. package/extensions/ApiLambdaFunction.js.map +1 -1
  16. package/extensions/ApiRoute.d.ts +1 -1
  17. package/extensions/ApiRoute.js +20 -13
  18. package/extensions/ApiRoute.js.map +1 -1
  19. package/extensions/OpenSearch/EnsureOsWasDeployed.d.ts +2 -2
  20. package/extensions/OpenSearch/EnsureOsWasDeployed.js +1 -1
  21. package/extensions/OpenSearch/EnsureOsWasDeployed.js.map +1 -1
  22. package/extensions/OpenSearch.d.ts +9 -10
  23. package/extensions/OpenSearch.js +7 -15
  24. package/extensions/OpenSearch.js.map +1 -1
  25. package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.d.ts +2 -2
  26. package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js +2 -3
  27. package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js.map +1 -1
  28. package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js +1 -1
  29. package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js.map +1 -1
  30. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.d.ts +1 -1
  31. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.js +1 -1
  32. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.js.map +1 -1
  33. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeBuild.d.ts +1 -1
  34. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeBuild.js +1 -1
  35. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeBuild.js.map +1 -1
  36. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeWatch.d.ts +1 -1
  37. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeWatch.js +1 -1
  38. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeWatch.js.map +1 -1
  39. package/extensions/ProjectAws/SetDatabaseSetupOutput.d.ts +2 -2
  40. package/extensions/ProjectAws/SetDatabaseSetupOutput.js +1 -1
  41. package/extensions/ProjectAws/SetDatabaseSetupOutput.js.map +1 -1
  42. package/extensions/ProjectAws/UploadAdminAppToS3.d.ts +1 -1
  43. package/extensions/ProjectAws/UploadAdminAppToS3.js +2 -2
  44. package/extensions/ProjectAws/UploadAdminAppToS3.js.map +1 -1
  45. package/extensions/ProjectAws/definitions.js +1 -1
  46. package/extensions/ProjectAws/definitions.js.map +1 -1
  47. package/extensions/ProjectAws.d.ts +1 -0
  48. package/extensions/ProjectAws.js +1 -0
  49. package/extensions/ProjectAws.js.map +1 -1
  50. package/extensions/RegisterRoutesPulumi.d.ts +2 -2
  51. package/extensions/RegisterRoutesPulumi.js +4 -7
  52. package/extensions/RegisterRoutesPulumi.js.map +1 -1
  53. package/extensions/definitions.js +1 -3
  54. package/extensions/definitions.js.map +1 -1
  55. package/extensions/index.d.ts +2 -3
  56. package/extensions/index.js +2 -3
  57. package/extensions/registerExtensionImplementations.js +10 -0
  58. package/extensions/registerExtensionImplementations.js.map +1 -0
  59. package/extensions/routePath.d.ts +20 -0
  60. package/extensions/routePath.js +13 -0
  61. package/extensions/routePath.js.map +1 -0
  62. package/features/ApiGqlClient.d.ts +4 -4
  63. package/features/ApiGqlClient.js +3 -3
  64. package/features/ApiGqlClient.js.map +1 -1
  65. package/features/InvokeLambdaFunction.d.ts +2 -2
  66. package/features/InvokeLambdaFunction.js +2 -2
  67. package/features/InvokeLambdaFunction.js.map +1 -1
  68. package/features/Watch/AwsWatch.js +3 -3
  69. package/features/Watch/AwsWatch.js.map +1 -1
  70. package/index.d.ts +2 -1
  71. package/index.js +2 -1
  72. package/infra.d.ts +49 -2
  73. package/infra.js +16 -4
  74. package/infra.js.map +1 -1
  75. package/package.json +22 -22
  76. package/project.d.ts +27 -11
  77. package/project.js +3 -2
  78. package/project.js.map +1 -1
  79. package/pulumi/apps/admin/createAdminPulumiApp.js +7 -4
  80. package/pulumi/apps/admin/createAdminPulumiApp.js.map +1 -1
  81. package/pulumi/apps/api/ApiCloudfront.js +105 -2
  82. package/pulumi/apps/api/ApiCloudfront.js.map +1 -1
  83. package/pulumi/apps/api/ApiGraphqlStream.d.ts +29 -0
  84. package/pulumi/apps/api/ApiGraphqlStream.js +58 -0
  85. package/pulumi/apps/api/ApiGraphqlStream.js.map +1 -0
  86. package/pulumi/apps/api/ApiOutput.d.ts +6 -6
  87. package/pulumi/apps/api/createApiPulumiApp.d.ts +8 -0
  88. package/pulumi/apps/api/createApiPulumiApp.js +33 -24
  89. package/pulumi/apps/api/createApiPulumiApp.js.map +1 -1
  90. package/pulumi/apps/api/index.d.ts +1 -0
  91. package/pulumi/apps/api/index.js +1 -0
  92. package/pulumi/apps/awsUtils.d.ts +1 -1
  93. package/pulumi/apps/awsUtils.js +1 -1
  94. package/pulumi/apps/awsUtils.js.map +1 -1
  95. package/pulumi/apps/blueGreen/domains/resolveDomains.js +1 -1
  96. package/pulumi/apps/blueGreen/domains/resolveDomains.js.map +1 -1
  97. package/pulumi/apps/blueGreen/types.d.ts +0 -3
  98. package/pulumi/apps/common/CoreOutput.d.ts +2 -1
  99. package/pulumi/apps/common/CoreOutput.js.map +1 -1
  100. package/pulumi/apps/core/CoreAuditLogsDynamo.d.ts +1 -0
  101. package/pulumi/apps/core/CoreAuditLogsDynamo.js +3 -0
  102. package/pulumi/apps/core/CoreAuditLogsDynamo.js.map +1 -1
  103. package/pulumi/apps/core/CoreCognito.d.ts +1 -0
  104. package/pulumi/apps/core/CoreCognito.js +4 -1
  105. package/pulumi/apps/core/CoreCognito.js.map +1 -1
  106. package/pulumi/apps/core/CoreDynamo.d.ts +1 -0
  107. package/pulumi/apps/core/CoreDynamo.js +3 -0
  108. package/pulumi/apps/core/CoreDynamo.js.map +1 -1
  109. package/pulumi/apps/core/CoreFileManager.d.ts +2 -0
  110. package/pulumi/apps/core/CoreFileManager.js +11 -1
  111. package/pulumi/apps/core/CoreFileManager.js.map +1 -1
  112. package/pulumi/apps/core/CoreOpenSearch.d.ts +1 -0
  113. package/pulumi/apps/core/CoreOpenSearch.js +3 -0
  114. package/pulumi/apps/core/CoreOpenSearch.js.map +1 -1
  115. package/pulumi/apps/core/cognitoIdentityProviders/configure.js +9 -1
  116. package/pulumi/apps/core/cognitoIdentityProviders/configure.js.map +1 -1
  117. package/pulumi/apps/core/configureS3BucketMalwareProtection.js +12 -2
  118. package/pulumi/apps/core/configureS3BucketMalwareProtection.js.map +1 -1
  119. package/pulumi/apps/core/createCorePulumiApp.js +34 -9
  120. package/pulumi/apps/core/createCorePulumiApp.js.map +1 -1
  121. package/pulumi/apps/customDomain.d.ts +10 -0
  122. package/pulumi/apps/customDomain.js +5 -1
  123. package/pulumi/apps/customDomain.js.map +1 -1
  124. package/pulumi/apps/extensions/getAwsTagsFromExtension.js +1 -1
  125. package/pulumi/apps/extensions/getAwsTagsFromExtension.js.map +1 -1
  126. package/pulumi/apps/extensions/getBgDeploymentsConfigFromExtension.d.ts +2 -2
  127. package/pulumi/apps/extensions/getBgDeploymentsConfigFromExtension.js +1 -1
  128. package/pulumi/apps/extensions/getBgDeploymentsConfigFromExtension.js.map +1 -1
  129. package/pulumi/apps/extensions/getOsConfigFromExtension.js +2 -2
  130. package/pulumi/apps/extensions/getOsConfigFromExtension.js.map +1 -1
  131. package/pulumi/apps/extensions/getVpcConfigFromExtension.js +1 -1
  132. package/pulumi/apps/extensions/getVpcConfigFromExtension.js.map +1 -1
  133. package/pulumi/apps/extensions/isProductionDefaultEnabled.d.ts +16 -0
  134. package/pulumi/apps/extensions/isProductionDefaultEnabled.js +9 -0
  135. package/pulumi/apps/extensions/isProductionDefaultEnabled.js.map +1 -0
  136. package/pulumi/apps/extensions/isVpcEnabled.d.ts +14 -0
  137. package/pulumi/apps/extensions/isVpcEnabled.js +8 -0
  138. package/pulumi/apps/extensions/isVpcEnabled.js.map +1 -0
  139. package/pulumi/apps/syncSystem/SyncSystemLambda.d.ts +1 -1
  140. package/pulumi/apps/syncSystem/SyncSystemLambda.js +1 -1
  141. package/pulumi/apps/syncSystem/SyncSystemLambda.js.map +1 -1
  142. package/pulumi/extensions/AdminPulumi.js +3 -2
  143. package/pulumi/extensions/AdminPulumi.js.map +1 -1
  144. package/pulumi/extensions/ApiPulumi.js +3 -2
  145. package/pulumi/extensions/ApiPulumi.js.map +1 -1
  146. package/pulumi/extensions/CorePulumi.js +3 -2
  147. package/pulumi/extensions/CorePulumi.js.map +1 -1
  148. package/pulumi/extensions/index.d.ts +42 -11
  149. package/pulumi/extensions/index.js +12 -9
  150. package/pulumi/extensions/index.js.map +1 -1
  151. package/pulumi/features/AdminPulumi/AdminPulumi.d.ts +1 -1
  152. package/pulumi/features/AdminPulumi/AdminPulumi.js +1 -1
  153. package/pulumi/features/AdminPulumi/AdminPulumi.js.map +1 -1
  154. package/pulumi/features/ApiPulumi/ApiPulumi.d.ts +1 -1
  155. package/pulumi/features/ApiPulumi/ApiPulumi.js +1 -1
  156. package/pulumi/features/ApiPulumi/ApiPulumi.js.map +1 -1
  157. package/pulumi/features/CorePulumi/CorePulumi.d.ts +1 -1
  158. package/pulumi/features/CorePulumi/CorePulumi.js +1 -1
  159. package/pulumi/features/CorePulumi/CorePulumi.js.map +1 -1
  160. package/pulumi/features/DefaultSetAdminCustomDomains.d.ts +1 -1
  161. package/pulumi/features/DefaultSetAdminCustomDomains.js.map +1 -1
  162. package/pulumi/features/DefaultSetApiCustomDomains.d.ts +1 -1
  163. package/pulumi/features/DefaultSetApiCustomDomains.js.map +1 -1
  164. package/pulumi/types.d.ts +2 -1
  165. package/pulumi/utils/getDistributionUrl.d.ts +9 -0
  166. package/pulumi/utils/getDistributionUrl.js +8 -0
  167. package/pulumi/utils/getDistributionUrl.js.map +1 -0
  168. package/pulumi/utils/index.d.ts +1 -0
  169. package/pulumi/utils/index.js +1 -0
  170. package/pulumi/utils/lambdaEnvVariables.js.map +1 -1
  171. package/services/AdminStackOutputService.d.ts +2 -2
  172. package/services/AdminStackOutputService.js +1 -1
  173. package/services/AdminStackOutputService.js.map +1 -1
  174. package/services/ApiStackOutputService.d.ts +2 -2
  175. package/services/ApiStackOutputService.js +1 -1
  176. package/services/ApiStackOutputService.js.map +1 -1
  177. package/services/CoreStackOutputService.d.ts +2 -2
  178. package/services/CoreStackOutputService.js +1 -1
  179. package/services/CoreStackOutputService.js.map +1 -1
  180. package/services/GetPulumiService/GetPulumiService.d.ts +1 -2
  181. package/services/GetPulumiService/GetPulumiService.js +1 -1
  182. package/services/GetPulumiService/GetPulumiService.js.map +1 -1
  183. package/abstractions/ApiGqlClient.d.ts +0 -23
  184. package/abstractions/ApiGqlClient.js +0 -5
  185. package/abstractions/ApiGqlClient.js.map +0 -1
  186. package/abstractions/InvokeLambdaFunction.d.ts +0 -18
  187. package/abstractions/InvokeLambdaFunction.js +0 -5
  188. package/abstractions/InvokeLambdaFunction.js.map +0 -1
  189. package/abstractions/features/pulumi/AdminPulumi.d.ts +0 -9
  190. package/abstractions/features/pulumi/AdminPulumi.js +0 -5
  191. package/abstractions/features/pulumi/AdminPulumi.js.map +0 -1
  192. package/abstractions/features/pulumi/ApiPulumi.d.ts +0 -9
  193. package/abstractions/features/pulumi/ApiPulumi.js +0 -5
  194. package/abstractions/features/pulumi/ApiPulumi.js.map +0 -1
  195. package/abstractions/features/pulumi/CorePulumi.d.ts +0 -9
  196. package/abstractions/features/pulumi/CorePulumi.js +0 -5
  197. package/abstractions/features/pulumi/CorePulumi.js.map +0 -1
  198. package/abstractions/features/pulumi/SetAdminCustomDomains.d.ts +0 -9
  199. package/abstractions/features/pulumi/SetAdminCustomDomains.js +0 -5
  200. package/abstractions/features/pulumi/SetAdminCustomDomains.js.map +0 -1
  201. package/abstractions/features/pulumi/SetApiCustomDomains.d.ts +0 -9
  202. package/abstractions/features/pulumi/SetApiCustomDomains.js +0 -5
  203. package/abstractions/features/pulumi/SetApiCustomDomains.js.map +0 -1
  204. package/abstractions/features/pulumi/index.d.ts +0 -5
  205. package/abstractions/features/pulumi/index.js +0 -5
  206. package/abstractions/index.d.ts +0 -6
  207. package/abstractions/index.js +0 -6
  208. package/abstractions/services/AdminStackOutputService.d.ts +0 -13
  209. package/abstractions/services/AdminStackOutputService.js +0 -5
  210. package/abstractions/services/AdminStackOutputService.js.map +0 -1
  211. package/abstractions/services/ApiStackOutputService.d.ts +0 -29
  212. package/abstractions/services/ApiStackOutputService.js +0 -5
  213. package/abstractions/services/ApiStackOutputService.js.map +0 -1
  214. package/abstractions/services/CoreStackOutputService.d.ts +0 -16
  215. package/abstractions/services/CoreStackOutputService.js +0 -5
  216. package/abstractions/services/CoreStackOutputService.js.map +0 -1
  217. package/exports/extensions.d.ts +0 -5
  218. package/exports/extensions.js +0 -5
  219. package/exports/infra.d.ts +0 -1
  220. package/exports/infra.js +0 -1
  221. package/extensions/AwsDefaultRegion.d.ts +0 -4
  222. package/extensions/AwsDefaultRegion.js +0 -23
  223. package/extensions/AwsDefaultRegion.js.map +0 -1
  224. package/extensions/BackgroundTasks.d.ts +0 -4
  225. package/extensions/BackgroundTasks.js +0 -24
  226. package/extensions/BackgroundTasks.js.map +0 -1
  227. package/extensions/Cms/ModelFieldCompression.d.ts +0 -4
  228. package/extensions/Cms/ModelFieldCompression.js +0 -24
  229. package/extensions/Cms/ModelFieldCompression.js.map +0 -1
  230. package/extensions/Mailer/Smtp.d.ts +0 -8
  231. package/extensions/Mailer/Smtp.js +0 -21
  232. package/extensions/Mailer/Smtp.js.map +0 -1
  233. package/extensions/Mailer/Smtp.test.js +0 -127
  234. package/extensions/Mailer/Smtp.test.js.map +0 -1
  235. package/extensions/Mailer/SmtpParamsSchema.d.ts +0 -9
  236. package/extensions/Mailer/SmtpParamsSchema.js +0 -17
  237. package/extensions/Mailer/SmtpParamsSchema.js.map +0 -1
  238. package/extensions/ProjectAws/AutoInstall.d.ts +0 -9
  239. package/extensions/ProjectAws/AutoInstall.js +0 -20
  240. package/extensions/ProjectAws/AutoInstall.js.map +0 -1
  241. package/pulumi/extensions/AdminCustomDomains.d.ts +0 -9
  242. package/pulumi/extensions/AdminCustomDomains.js +0 -20
  243. package/pulumi/extensions/AdminCustomDomains.js.map +0 -1
  244. package/pulumi/extensions/ApiCustomDomains.d.ts +0 -9
  245. package/pulumi/extensions/ApiCustomDomains.js +0 -20
  246. package/pulumi/extensions/ApiCustomDomains.js.map +0 -1
  247. package/pulumi/extensions/AwsTags.d.ts +0 -4
  248. package/pulumi/extensions/AwsTags.js +0 -16
  249. package/pulumi/extensions/AwsTags.js.map +0 -1
  250. package/pulumi/extensions/BlueGreenDeployments.d.ts +0 -34
  251. package/pulumi/extensions/BlueGreenDeployments.js +0 -38
  252. package/pulumi/extensions/BlueGreenDeployments.js.map +0 -1
  253. package/pulumi/extensions/OpenSearch.d.ts +0 -10
  254. package/pulumi/extensions/OpenSearch.js +0 -21
  255. package/pulumi/extensions/OpenSearch.js.map +0 -1
  256. package/pulumi/extensions/Vpc.d.ts +0 -15
  257. package/pulumi/extensions/Vpc.js +0 -26
  258. package/pulumi/extensions/Vpc.js.map +0 -1
  259. /package/extensions/{Mailer/Smtp.test.d.ts → registerExtensionImplementations.d.ts} +0 -0
@@ -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}\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: \"OFF\",\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":";;AAUO,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,kBAAkB;gBAClB,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 { 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"}
@@ -2,4 +2,5 @@ import { type PulumiAppModule } from "@webiny/pulumi";
2
2
  export type CoreDynamo = PulumiAppModule<typeof CoreDynamo>;
3
3
  export declare const CoreDynamo: import("@webiny/pulumi").PulumiAppModuleDefinition<import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/dynamodb/table").Table>, {
4
4
  protect: boolean;
5
+ pointInTimeRecovery: boolean;
5
6
  }>;
@@ -82,6 +82,9 @@ const CoreDynamo = createAppModule({
82
82
  ttl: {
83
83
  attributeName: "expiresAt",
84
84
  enabled: true
85
+ },
86
+ pointInTimeRecovery: {
87
+ enabled: params.pointInTimeRecovery
85
88
  }
86
89
  },
87
90
  opts: {
@@ -1 +1 @@
1
- {"version":3,"file":"pulumi/apps/core/CoreDynamo.js","sources":["../../../../src/pulumi/apps/core/CoreDynamo.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { createAppModule, type PulumiApp, type PulumiAppModule } from \"@webiny/pulumi\";\n\nexport type CoreDynamo = PulumiAppModule<typeof CoreDynamo>;\n\nexport const CoreDynamo = createAppModule({\n name: \"DynamoDb\",\n config(app: PulumiApp, params: { protect: boolean }) {\n return app.addResource(aws.dynamodb.Table, {\n name: \"webiny\",\n config: {\n attributes: [\n { name: \"PK\", type: \"S\" },\n { name: \"SK\", type: \"S\" },\n { name: \"GSI_TENANT\", type: \"S\" },\n { name: \"GSI1_PK\", type: \"S\" },\n { name: \"GSI1_SK\", type: \"S\" },\n { name: \"GSI2_PK\", type: \"S\" },\n { name: \"GSI2_SK\", type: \"S\" }\n ],\n billingMode: \"PAY_PER_REQUEST\",\n hashKey: \"PK\",\n rangeKey: \"SK\",\n globalSecondaryIndexes: [\n {\n name: \"GSI_TENANT\",\n keySchemas: [\n {\n attributeName: \"GSI_TENANT\",\n keyType: \"HASH\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI1\",\n keySchemas: [\n {\n attributeName: \"GSI1_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI1_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"ALL\"\n },\n {\n name: \"GSI2\",\n keySchemas: [\n {\n attributeName: \"GSI2_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI2_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"ALL\"\n }\n ],\n ttl: {\n attributeName: \"expiresAt\",\n enabled: true\n }\n },\n opts: {\n protect: params.protect\n }\n });\n }\n});\n"],"names":["CoreDynamo","createAppModule","app","params","aws"],"mappings":";;AAKO,MAAMA,aAAaC,gBAAgB;IACtC,MAAM;IACN,QAAOC,GAAc,EAAEC,MAA4B;QAC/C,OAAOD,IAAI,WAAW,CAACE,uCAAAA,QAAAA,CAAAA,KAAkB,EAAE;YACvC,MAAM;YACN,QAAQ;gBACJ,YAAY;oBACR;wBAAE,MAAM;wBAAM,MAAM;oBAAI;oBACxB;wBAAE,MAAM;wBAAM,MAAM;oBAAI;oBACxB;wBAAE,MAAM;wBAAc,MAAM;oBAAI;oBAChC;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;iBAChC;gBACD,aAAa;gBACb,SAAS;gBACT,UAAU;gBACV,wBAAwB;oBACpB;wBACI,MAAM;wBACN,YAAY;4BACR;gCACI,eAAe;gCACf,SAAS;4BACb;yBACH;wBACD,gBAAgB;oBACpB;oBACA;wBACI,MAAM;wBACN,YAAY;4BACR;gCACI,eAAe;gCACf,SAAS;4BACb;4BACA;gCACI,eAAe;gCACf,SAAS;4BACb;yBACH;wBACD,gBAAgB;oBACpB;oBACA;wBACI,MAAM;wBACN,YAAY;4BACR;gCACI,eAAe;gCACf,SAAS;4BACb;4BACA;gCACI,eAAe;gCACf,SAAS;4BACb;yBACH;wBACD,gBAAgB;oBACpB;iBACH;gBACD,KAAK;oBACD,eAAe;oBACf,SAAS;gBACb;YACJ;YACA,MAAM;gBACF,SAASD,OAAO,OAAO;YAC3B;QACJ;IACJ;AACJ"}
1
+ {"version":3,"file":"pulumi/apps/core/CoreDynamo.js","sources":["../../../../src/pulumi/apps/core/CoreDynamo.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { createAppModule, type PulumiApp, type PulumiAppModule } from \"@webiny/pulumi\";\n\nexport type CoreDynamo = PulumiAppModule<typeof CoreDynamo>;\n\nexport const CoreDynamo = createAppModule({\n name: \"DynamoDb\",\n config(app: PulumiApp, params: { protect: boolean; pointInTimeRecovery: boolean }) {\n return app.addResource(aws.dynamodb.Table, {\n name: \"webiny\",\n config: {\n attributes: [\n { name: \"PK\", type: \"S\" },\n { name: \"SK\", type: \"S\" },\n { name: \"GSI_TENANT\", type: \"S\" },\n { name: \"GSI1_PK\", type: \"S\" },\n { name: \"GSI1_SK\", type: \"S\" },\n { name: \"GSI2_PK\", type: \"S\" },\n { name: \"GSI2_SK\", type: \"S\" }\n ],\n billingMode: \"PAY_PER_REQUEST\",\n hashKey: \"PK\",\n rangeKey: \"SK\",\n globalSecondaryIndexes: [\n {\n name: \"GSI_TENANT\",\n keySchemas: [\n {\n attributeName: \"GSI_TENANT\",\n keyType: \"HASH\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI1\",\n keySchemas: [\n {\n attributeName: \"GSI1_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI1_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"ALL\"\n },\n {\n name: \"GSI2\",\n keySchemas: [\n {\n attributeName: \"GSI2_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI2_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"ALL\"\n }\n ],\n ttl: {\n attributeName: \"expiresAt\",\n enabled: true\n },\n pointInTimeRecovery: {\n enabled: params.pointInTimeRecovery\n }\n },\n opts: {\n protect: params.protect\n }\n });\n }\n});\n"],"names":["CoreDynamo","createAppModule","app","params","aws"],"mappings":";;AAKO,MAAMA,aAAaC,gBAAgB;IACtC,MAAM;IACN,QAAOC,GAAc,EAAEC,MAA0D;QAC7E,OAAOD,IAAI,WAAW,CAACE,uCAAAA,QAAAA,CAAAA,KAAkB,EAAE;YACvC,MAAM;YACN,QAAQ;gBACJ,YAAY;oBACR;wBAAE,MAAM;wBAAM,MAAM;oBAAI;oBACxB;wBAAE,MAAM;wBAAM,MAAM;oBAAI;oBACxB;wBAAE,MAAM;wBAAc,MAAM;oBAAI;oBAChC;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;iBAChC;gBACD,aAAa;gBACb,SAAS;gBACT,UAAU;gBACV,wBAAwB;oBACpB;wBACI,MAAM;wBACN,YAAY;4BACR;gCACI,eAAe;gCACf,SAAS;4BACb;yBACH;wBACD,gBAAgB;oBACpB;oBACA;wBACI,MAAM;wBACN,YAAY;4BACR;gCACI,eAAe;gCACf,SAAS;4BACb;4BACA;gCACI,eAAe;gCACf,SAAS;4BACb;yBACH;wBACD,gBAAgB;oBACpB;oBACA;wBACI,MAAM;wBACN,YAAY;4BACR;gCACI,eAAe;gCACf,SAAS;4BACb;4BACA;gCACI,eAAe;gCACf,SAAS;4BACb;yBACH;wBACD,gBAAgB;oBACpB;iBACH;gBACD,KAAK;oBACD,eAAe;oBACf,SAAS;gBACb;gBACA,qBAAqB;oBACjB,SAASD,OAAO,mBAAmB;gBACvC;YACJ;YACA,MAAM;gBACF,SAASA,OAAO,OAAO;YAC3B;QACJ;IACJ;AACJ"}
@@ -6,6 +6,8 @@ export declare const CoreFileManger: import("@webiny/pulumi").PulumiAppModuleDef
6
6
  bucketAcl: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/s3/bucketAcl").BucketAcl>;
7
7
  blockPublicAccessBlock: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/s3/bucketPublicAccessBlock").BucketPublicAccessBlock>;
8
8
  bucketCorsConfiguration: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/s3/bucketCorsConfiguration").BucketCorsConfiguration>;
9
+ bucketVersioning: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/s3/bucketVersioning").BucketVersioning> | null;
9
10
  }, {
10
11
  protect: boolean;
12
+ versioning: boolean;
11
13
  }>;
@@ -66,12 +66,22 @@ const CoreFileManger = createAppModule({
66
66
  restrictPublicBuckets: true
67
67
  }
68
68
  });
69
+ const bucketVersioning = params.versioning ? app.addResource(__rspack_external__pulumi_aws_9e2bee2d.s3.BucketVersioning, {
70
+ name: `${name}-versioning`,
71
+ config: {
72
+ bucket: bucket.output.id,
73
+ versioningConfiguration: {
74
+ status: "Enabled"
75
+ }
76
+ }
77
+ }) : null;
69
78
  return {
70
79
  bucket,
71
80
  bucketOwnershipControls,
72
81
  bucketAcl,
73
82
  blockPublicAccessBlock,
74
- bucketCorsConfiguration
83
+ bucketCorsConfiguration,
84
+ bucketVersioning
75
85
  };
76
86
  }
77
87
  });
@@ -1 +1 @@
1
- {"version":3,"file":"pulumi/apps/core/CoreFileManager.js","sources":["../../../../src/pulumi/apps/core/CoreFileManager.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { createAppModule, type PulumiApp, type PulumiAppModule } from \"@webiny/pulumi\";\n\nexport type CoreFileManger = PulumiAppModule<typeof CoreFileManger>;\n\nexport const CoreFileManger = createAppModule({\n name: \"FileManagerBucket\",\n config(app: PulumiApp, params: { protect: boolean }) {\n const name = \"fm-bucket\";\n\n const bucket = app.addResource(aws.s3.Bucket, {\n name,\n config: {\n // We definitely don't want to force-destroy if \"protected\" flag is true.\n forceDestroy: !params.protect\n },\n opts: {\n protect: params.protect\n }\n });\n\n const bucketOwnershipControls = app.addResource(aws.s3.BucketOwnershipControls, {\n name: `${name}-ownership-controls`,\n config: {\n bucket: bucket.output.id,\n rule: {\n objectOwnership: \"BucketOwnerPreferred\"\n }\n }\n });\n\n const bucketAcl = app.addResource(aws.s3.BucketAcl, {\n name: `${name}-acl`,\n config: {\n bucket: bucket.output.id,\n acl: aws.s3.CannedAcl.Private\n },\n opts: {\n dependsOn: [bucketOwnershipControls.output]\n }\n });\n\n // We need these rules to be able to upload to this bucket from the browser.\n const bucketCorsConfiguration = app.addResource(aws.s3.BucketCorsConfiguration, {\n name: `${name}-cors`,\n config: {\n bucket: bucket.output.id,\n corsRules: [\n {\n allowedHeaders: [\"*\"],\n allowedMethods: [\"POST\", \"GET\", \"PUT\"],\n allowedOrigins: [\"*\"],\n maxAgeSeconds: 3000\n }\n ]\n }\n });\n\n // Block any public access\n const blockPublicAccessBlock = app.addResource(aws.s3.BucketPublicAccessBlock, {\n name: `${name}-block-public-access`,\n config: {\n bucket: bucket.output.id,\n blockPublicAcls: true,\n blockPublicPolicy: true,\n ignorePublicAcls: true,\n restrictPublicBuckets: true\n }\n });\n\n return {\n bucket,\n bucketOwnershipControls,\n bucketAcl,\n blockPublicAccessBlock,\n bucketCorsConfiguration\n };\n }\n});\n"],"names":["CoreFileManger","createAppModule","app","params","name","bucket","aws","bucketOwnershipControls","bucketAcl","bucketCorsConfiguration","blockPublicAccessBlock"],"mappings":";;AAKO,MAAMA,iBAAiBC,gBAAgB;IAC1C,MAAM;IACN,QAAOC,GAAc,EAAEC,MAA4B;QAC/C,MAAMC,OAAO;QAEb,MAAMC,SAASH,IAAI,WAAW,CAACI,uCAAAA,EAAAA,CAAAA,MAAa,EAAE;YAC1CF;YACA,QAAQ;gBAEJ,cAAc,CAACD,OAAO,OAAO;YACjC;YACA,MAAM;gBACF,SAASA,OAAO,OAAO;YAC3B;QACJ;QAEA,MAAMI,0BAA0BL,IAAI,WAAW,CAACI,uCAAAA,EAAAA,CAAAA,uBAA8B,EAAE;YAC5E,MAAM,GAAGF,KAAK,mBAAmB,CAAC;YAClC,QAAQ;gBACJ,QAAQC,OAAO,MAAM,CAAC,EAAE;gBACxB,MAAM;oBACF,iBAAiB;gBACrB;YACJ;QACJ;QAEA,MAAMG,YAAYN,IAAI,WAAW,CAACI,uCAAAA,EAAAA,CAAAA,SAAgB,EAAE;YAChD,MAAM,GAAGF,KAAK,IAAI,CAAC;YACnB,QAAQ;gBACJ,QAAQC,OAAO,MAAM,CAAC,EAAE;gBACxB,KAAKC,uCAAAA,EAAAA,CAAAA,SAAAA,CAAAA,OAAwB;YACjC;YACA,MAAM;gBACF,WAAW;oBAACC,wBAAwB,MAAM;iBAAC;YAC/C;QACJ;QAGA,MAAME,0BAA0BP,IAAI,WAAW,CAACI,uCAAAA,EAAAA,CAAAA,uBAA8B,EAAE;YAC5E,MAAM,GAAGF,KAAK,KAAK,CAAC;YACpB,QAAQ;gBACJ,QAAQC,OAAO,MAAM,CAAC,EAAE;gBACxB,WAAW;oBACP;wBACI,gBAAgB;4BAAC;yBAAI;wBACrB,gBAAgB;4BAAC;4BAAQ;4BAAO;yBAAM;wBACtC,gBAAgB;4BAAC;yBAAI;wBACrB,eAAe;oBACnB;iBACH;YACL;QACJ;QAGA,MAAMK,yBAAyBR,IAAI,WAAW,CAACI,uCAAAA,EAAAA,CAAAA,uBAA8B,EAAE;YAC3E,MAAM,GAAGF,KAAK,oBAAoB,CAAC;YACnC,QAAQ;gBACJ,QAAQC,OAAO,MAAM,CAAC,EAAE;gBACxB,iBAAiB;gBACjB,mBAAmB;gBACnB,kBAAkB;gBAClB,uBAAuB;YAC3B;QACJ;QAEA,OAAO;YACHA;YACAE;YACAC;YACAE;YACAD;QACJ;IACJ;AACJ"}
1
+ {"version":3,"file":"pulumi/apps/core/CoreFileManager.js","sources":["../../../../src/pulumi/apps/core/CoreFileManager.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { createAppModule, type PulumiApp, type PulumiAppModule } from \"@webiny/pulumi\";\n\nexport type CoreFileManger = PulumiAppModule<typeof CoreFileManger>;\n\nexport const CoreFileManger = createAppModule({\n name: \"FileManagerBucket\",\n config(app: PulumiApp, params: { protect: boolean; versioning: boolean }) {\n const name = \"fm-bucket\";\n\n const bucket = app.addResource(aws.s3.Bucket, {\n name,\n config: {\n // We definitely don't want to force-destroy if \"protected\" flag is true.\n forceDestroy: !params.protect\n },\n opts: {\n protect: params.protect\n }\n });\n\n const bucketOwnershipControls = app.addResource(aws.s3.BucketOwnershipControls, {\n name: `${name}-ownership-controls`,\n config: {\n bucket: bucket.output.id,\n rule: {\n objectOwnership: \"BucketOwnerPreferred\"\n }\n }\n });\n\n const bucketAcl = app.addResource(aws.s3.BucketAcl, {\n name: `${name}-acl`,\n config: {\n bucket: bucket.output.id,\n acl: aws.s3.CannedAcl.Private\n },\n opts: {\n dependsOn: [bucketOwnershipControls.output]\n }\n });\n\n // We need these rules to be able to upload to this bucket from the browser.\n const bucketCorsConfiguration = app.addResource(aws.s3.BucketCorsConfiguration, {\n name: `${name}-cors`,\n config: {\n bucket: bucket.output.id,\n corsRules: [\n {\n allowedHeaders: [\"*\"],\n allowedMethods: [\"POST\", \"GET\", \"PUT\"],\n allowedOrigins: [\"*\"],\n maxAgeSeconds: 3000\n }\n ]\n }\n });\n\n // Block any public access\n const blockPublicAccessBlock = app.addResource(aws.s3.BucketPublicAccessBlock, {\n name: `${name}-block-public-access`,\n config: {\n bucket: bucket.output.id,\n blockPublicAcls: true,\n blockPublicPolicy: true,\n ignorePublicAcls: true,\n restrictPublicBuckets: true\n }\n });\n\n // Keeps previous versions of overwritten and deleted files, so they can be restored.\n const bucketVersioning = params.versioning\n ? app.addResource(aws.s3.BucketVersioning, {\n name: `${name}-versioning`,\n config: {\n bucket: bucket.output.id,\n versioningConfiguration: {\n status: \"Enabled\"\n }\n }\n })\n : null;\n\n return {\n bucket,\n bucketOwnershipControls,\n bucketAcl,\n blockPublicAccessBlock,\n bucketCorsConfiguration,\n bucketVersioning\n };\n }\n});\n"],"names":["CoreFileManger","createAppModule","app","params","name","bucket","aws","bucketOwnershipControls","bucketAcl","bucketCorsConfiguration","blockPublicAccessBlock","bucketVersioning"],"mappings":";;AAKO,MAAMA,iBAAiBC,gBAAgB;IAC1C,MAAM;IACN,QAAOC,GAAc,EAAEC,MAAiD;QACpE,MAAMC,OAAO;QAEb,MAAMC,SAASH,IAAI,WAAW,CAACI,uCAAAA,EAAAA,CAAAA,MAAa,EAAE;YAC1CF;YACA,QAAQ;gBAEJ,cAAc,CAACD,OAAO,OAAO;YACjC;YACA,MAAM;gBACF,SAASA,OAAO,OAAO;YAC3B;QACJ;QAEA,MAAMI,0BAA0BL,IAAI,WAAW,CAACI,uCAAAA,EAAAA,CAAAA,uBAA8B,EAAE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;YACJ;QACJ,KACA;QAEN,OAAO;YACHA;YACAE;YACAC;YACAE;YACAD;YACAE;QACJ;IACJ;AACJ"}
@@ -4,6 +4,7 @@ export interface OpenSearchParams {
4
4
  protect: boolean;
5
5
  namePrefix: string;
6
6
  prevDomainName: string | undefined;
7
+ pointInTimeRecovery: boolean;
7
8
  }
8
9
  export declare const OpenSearch: import("@webiny/pulumi").PulumiAppModuleDefinition<{
9
10
  domain: PulumiAppRemoteResource<aws.opensearch.GetDomainResult> | PulumiAppResource<PulumiAppResourceConstructor<import("@pulumi/aws/opensearch/domain.js").Domain, any>>;
@@ -144,6 +144,9 @@ const OpenSearch = createAppModule({
144
144
  ttl: {
145
145
  attributeName: "expiresAt",
146
146
  enabled: true
147
+ },
148
+ pointInTimeRecovery: {
149
+ enabled: params.pointInTimeRecovery
147
150
  }
148
151
  },
149
152
  opts: {
@@ -1 +1 @@
1
- {"version":3,"file":"pulumi/apps/core/CoreOpenSearch.js","sources":["../../../../src/pulumi/apps/core/CoreOpenSearch.ts"],"sourcesContent":["/**\n * Important documents to read:\n *\n * https://docs.aws.amazon.com/opensearch-service/latest/developerguide/limits.html#network-limits\n */\nimport path from \"path\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport * as random from \"@pulumi/random\";\nimport {\n createAppModule,\n type PulumiApp,\n type PulumiAppRemoteResource,\n type PulumiAppResource,\n type PulumiAppResourceConstructor\n} from \"@webiny/pulumi\";\n\nimport { getAwsAccountId } from \"../awsUtils.js\";\nimport { CoreVpc } from \"./CoreVpc.js\";\nimport { LAMBDA_RUNTIME } from \"~/pulumi/constants.js\";\n\nexport interface OpenSearchParams {\n protect: boolean;\n namePrefix: string;\n prevDomainName: string | undefined;\n}\n\nfunction getDevClusterConfig(): aws.types.input.opensearch.DomainClusterConfig {\n return {\n instanceType: \"t3.small.search\"\n };\n}\n\nfunction getProdClusterConfig(): aws.types.input.opensearch.DomainClusterConfig {\n return {\n // For production deployments, we create 3 instances and configure multi-AZ across 3 zones.\n instanceType: \"t3.medium.search\",\n instanceCount: 3,\n zoneAwarenessEnabled: true,\n zoneAwarenessConfig: {\n availabilityZoneCount: 3\n }\n };\n}\n\nconst OS_ENGINE_VERSION = \"OpenSearch_3.3\";\n\nexport const OpenSearch = createAppModule({\n name: \"OpenSearch\",\n config(app, params: OpenSearchParams) {\n const isProduction = app.env.isProduction;\n\n const vpc = app.getModule(CoreVpc, { optional: true });\n\n let domain:\n | PulumiAppResource<PulumiAppResourceConstructor<aws.opensearch.Domain>>\n | PulumiAppRemoteResource<aws.opensearch.GetDomainResult>\n | null = null;\n\n let domainPolicy;\n let domainEndpoint: pulumi.Output<string> | string;\n let domainArn: pulumi.Output<string>;\n\n const providedEndpoint = process.env.OPENSEARCH_ENDPOINT;\n const providedDomainName = process.env.AWS_OS_DOMAIN_NAME;\n\n if (providedEndpoint && !providedDomainName) {\n throw new Error(\n \"OPENSEARCH_ENDPOINT was provided but AWS_OS_DOMAIN_NAME is missing. \" +\n \"A domain name is required to look up the domain ARN when using a custom endpoint.\"\n );\n }\n\n if (providedDomainName) {\n // Look up the existing domain by name to obtain its ARN and (if no explicit endpoint is\n // provided) its endpoint. This covers both the ephemeral-environment pattern and the\n // case where an external endpoint is supplied alongside a domain name.\n // https://www.webiny.com/docs/key-topics/ci-cd/testing/slow-ephemeral-environments\n domain = app.addRemoteResource(providedDomainName, () => {\n return aws.opensearch.getDomain(\n { domainName: providedDomainName },\n { async: true }\n );\n });\n domainArn = domain.output.arn;\n // Prefer an explicitly provided endpoint; fall back to the one reported by AWS.\n domainEndpoint = providedEndpoint ?? domain.output.endpoint;\n } else {\n const randomId = new random.RandomId(\"osDomainRandomId\", { byteLength: 8 });\n\n const domainLogicalName = \"webiny-js\";\n\n /**\n * The physical domain name must remain stable across re-deploys. Changing it causes\n * Pulumi to delete and recreate the cluster, which is a destructive operation.\n *\n * To avoid this, we read the domain name that was stored in the previous deploy's\n * stack output (via `sdk.getAppStackOutput`) and reuse it unchanged. Only on the\n * very first deploy, when there is no previous output, do we generate a new name\n * (with the resource name prefix applied for consistent naming going forward).\n *\n * NOTE: `params.namePrefix` may be \"\" when upgrading from old code that never stored\n * the domain name in the stack output. In that case the caller passes \"\" explicitly so\n * the fallback formula reproduces the legacy name (`webiny-js-<hex>`) rather than\n * prepending the SDK default prefix and triggering an unintended cluster replacement.\n * See `createCorePulumiApp.ts` → `isUpgradeFromOldCode` for details.\n */\n const domainPhysicalName = randomId.hex.apply(\n hex =>\n params.prevDomainName ??\n `${params.namePrefix}${domainLogicalName}-${hex.slice(-7)}`\n );\n\n domain = app.addResource(aws.opensearch.Domain, {\n name: domainLogicalName,\n config: {\n domainName: domainPhysicalName,\n engineVersion: OS_ENGINE_VERSION,\n clusterConfig: isProduction ? getProdClusterConfig() : getDevClusterConfig(),\n vpcOptions: vpc\n ? {\n subnetIds: vpc.subnets.private.map(s => s.output.id),\n securityGroupIds: [vpc.vpc.output.defaultSecurityGroupId]\n }\n : undefined,\n ebsOptions: {\n ebsEnabled: true,\n volumeSize: 10,\n volumeType: \"gp2\"\n },\n advancedOptions: {\n \"rest.action.multi.allow_explicit_index\": \"true\"\n },\n snapshotOptions: {\n automatedSnapshotStartHour: 23\n }\n },\n opts: { protect: params.protect }\n });\n\n domainEndpoint = domain.output.endpoint;\n domainArn = domain.output.arn;\n\n /**\n * Domain policy defines who can access your OpenSearch Domain.\n * For details on OpenSearch security, read the official documentation:\n * https://docs.aws.amazon.com/openSearch-service/latest/developerguide/security.html\n */\n const accountId = getAwsAccountId(app);\n\n domainPolicy = app.addResource(aws.opensearch.DomainPolicy, {\n name: `${domainLogicalName}-policy`,\n config: {\n domainName: domain.output.domainName,\n accessPolicies: pulumi\n .all([accountId, domainArn])\n .apply(([accountId, domainArn]) => {\n return JSON.stringify({\n Version: \"2012-10-17\",\n Statement: [\n /**\n * Allow requests signed with current account\n */\n {\n Effect: \"Allow\",\n Principal: {\n AWS: accountId\n },\n Action: \"es:*\",\n Resource: `${domainArn}/*`\n }\n ]\n });\n })\n },\n opts: { protect: params.protect }\n });\n }\n\n /**\n * Create a table for OpenSearch records. All ES records are stored in this table to dramatically improve\n * performance and stability on write operations (especially massive data imports). This table also serves as a backup and\n * a single source of truth for your OpenSearch domain. Streaming is enabled on this table, and it will\n * allow asynchronous synchronization of data with OpenSearch domain.\n */\n const table = app.addResource(aws.dynamodb.Table, {\n name: \"webiny-es\",\n config: {\n attributes: [\n { name: \"PK\", type: \"S\" },\n { name: \"SK\", type: \"S\" },\n { name: \"GSI_TENANT\", type: \"S\" }\n ],\n streamEnabled: true,\n streamViewType: \"NEW_AND_OLD_IMAGES\",\n billingMode: \"PAY_PER_REQUEST\",\n hashKey: \"PK\",\n rangeKey: \"SK\",\n globalSecondaryIndexes: [\n {\n name: \"GSI_TENANT\",\n keySchemas: [\n {\n attributeName: \"GSI_TENANT\",\n keyType: \"HASH\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n }\n ],\n ttl: {\n attributeName: \"expiresAt\",\n enabled: true\n }\n },\n opts: { protect: params.protect }\n });\n\n const roleName = \"dynamo-to-elastic-lambda-role\";\n\n const role = app.addResource(aws.iam.Role, {\n name: roleName,\n config: {\n assumeRolePolicy: {\n Version: \"2012-10-17\",\n Statement: [\n {\n Action: \"sts:AssumeRole\",\n Principal: {\n Service: \"lambda.amazonaws.com\"\n },\n Effect: \"Allow\"\n }\n ]\n }\n },\n meta: { isLambdaFunctionRole: true }\n });\n\n const policy = getDynamoDbToElasticLambdaPolicy(app, domainArn);\n\n app.addResource(aws.iam.RolePolicyAttachment, {\n name: `${roleName}-DynamoDbToElasticLambdaPolicy`,\n config: {\n role: role.output,\n policyArn: policy.output.arn\n }\n });\n\n // Only use `AWSLambdaVPCAccessExecutionRole` policy if VPC feature is enabled.\n if (vpc) {\n app.addResource(aws.iam.RolePolicyAttachment, {\n name: `${roleName}-AWSLambdaVPCAccessExecutionRole`,\n config: {\n role: role.output,\n policyArn: aws.iam.ManagedPolicy.AWSLambdaVPCAccessExecutionRole\n }\n });\n } else {\n app.addResource(aws.iam.RolePolicyAttachment, {\n name: `${roleName}-AWSLambdaBasicExecutionRole`,\n config: {\n role: role.output,\n policyArn: aws.iam.ManagedPolicy.AWSLambdaBasicExecutionRole\n }\n });\n }\n\n app.addResource(aws.iam.RolePolicyAttachment, {\n name: `${roleName}-AWSLambdaDynamoDBExecutionRole`,\n config: {\n role: role.output,\n policyArn: aws.iam.ManagedPolicy.AWSLambdaDynamoDBExecutionRole\n }\n });\n\n /**\n * This Lambda will process the stream events from DynamoDB table that contains OpenSearch items.\n * OpenSearch can't take large amount of individual writes in a short period of time, so this way\n * we store data for OpenSearch in a DynamoDB table, and asynchronously insert it into OpenSearch\n * using batching.\n */\n const lambda = app.addResource(aws.lambda.Function, {\n name: \"dynamo-to-elastic\",\n config: {\n role: role.output.arn,\n runtime: LAMBDA_RUNTIME,\n handler: \"handler.handler\",\n timeout: 900,\n memorySize: 1024,\n environment: {\n variables: {\n DEBUG: String(process.env.DEBUG),\n OPENSEARCH_ENDPOINT: domainEndpoint,\n OPENSEARCH_USERNAME: process.env.OPENSEARCH_USERNAME ?? \"\",\n OPENSEARCH_PASSWORD: process.env.OPENSEARCH_PASSWORD ?? \"\"\n }\n },\n description: \"Process DynamoDB Stream.\",\n code: new pulumi.asset.AssetArchive({\n \".\": new pulumi.asset.FileArchive(\n path.join(app.paths.workspace, \"dynamoToElastic/build\")\n )\n }),\n vpcConfig: vpc\n ? {\n subnetIds: vpc.subnets.private.map(s => s.output.id),\n securityGroupIds: [vpc.vpc.output.defaultSecurityGroupId]\n }\n : undefined,\n loggingConfig: {\n logFormat: \"JSON\"\n }\n }\n });\n\n const eventSourceMapping = app.addResource(aws.lambda.EventSourceMapping, {\n name: \"dynamo-to-elastic\",\n config: {\n eventSourceArn: table.output.streamArn,\n functionName: lambda.output.arn,\n startingPosition: \"LATEST\",\n maximumRetryAttempts: 3,\n batchSize: 50,\n maximumBatchingWindowInSeconds: 1\n }\n });\n\n app.addOutputs({\n opensearchDomainArn: domainArn,\n opensearchDomainEndpoint: domainEndpoint,\n opensearchDomainName: domain!.output.domainName,\n opensearchDynamodbTableArn: table.output.arn,\n opensearchDynamodbTableName: table.output.name\n });\n\n return {\n domain,\n domainPolicy,\n table,\n dynamoToElastic: {\n role,\n policy,\n lambda,\n eventSourceMapping\n }\n };\n }\n});\n\nfunction getDynamoDbToElasticLambdaPolicy(app: PulumiApp, domainArn: pulumi.Output<string>) {\n return app.addResource(aws.iam.Policy, {\n name: \"DynamoDbToElasticLambdaPolicy-updated\",\n config: {\n description: \"This policy enables access to ES and Dynamodb streams\",\n policy: {\n Version: \"2012-10-17\",\n Statement: [\n {\n Sid: \"PermissionForES\",\n Effect: \"Allow\",\n Action: [\n \"es:ESHttpGet\",\n \"es:ESHttpDelete\",\n \"es:ESHttpPatch\",\n \"es:ESHttpPost\",\n \"es:ESHttpPut\",\n \"dynamodb:BatchGetItem\",\n \"dynamodb:BatchWriteItem\",\n \"dynamodb:PutItem\",\n \"dynamodb:GetItem\",\n \"dynamodb:DeleteItem\",\n \"dynamodb:Query\",\n \"dynamodb:UpdateItem\"\n ],\n Resource: [\n pulumi.interpolate`${domainArn}`,\n pulumi.interpolate`${domainArn}/*`\n ]\n }\n ]\n }\n }\n });\n}\n"],"names":["getDevClusterConfig","getProdClusterConfig","OS_ENGINE_VERSION","OpenSearch","createAppModule","app","params","isProduction","vpc","CoreVpc","domain","domainPolicy","domainEndpoint","domainArn","providedEndpoint","process","providedDomainName","Error","aws","randomId","random","domainLogicalName","domainPhysicalName","hex","s","undefined","accountId","getAwsAccountId","pulumi","JSON","table","roleName","role","policy","getDynamoDbToElasticLambdaPolicy","lambda","LAMBDA_RUNTIME","String","path","eventSourceMapping"],"mappings":";;;;;;;;AA2BA,SAASA;IACL,OAAO;QACH,cAAc;IAClB;AACJ;AAEA,SAASC;IACL,OAAO;QAEH,cAAc;QACd,eAAe;QACf,sBAAsB;QACtB,qBAAqB;YACjB,uBAA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,CAAC;YACX,qBAAqBQ;YACrB,0BAA0BD;YAC1B,sBAAsBF,OAAQ,MAAM,CAAC,UAAU;YAC/C,4BAA4BoB,MAAM,MAAM,CAAC,GAAG;YAC5C,6BAA6BA,MAAM,MAAM,CAAC,IAAI;QAClD;QAEA,OAAO;YACHpB;YACAC;YACAmB;YACA,iBAAiB;gBACbE;gBACAC;gBACAE;gBACAI;YACJ;QACJ;IACJ;AACJ;AAEA,SAASL,iCAAiC7B,GAAc,EAAEQ,SAAgC;IACtF,OAAOR,IAAI,WAAW,CAACa,uCAAAA,GAAAA,CAAAA,MAAc,EAAE;QACnC,MAAM;QACN,QAAQ;YACJ,aAAa;YACb,QAAQ;gBACJ,SAAS;gBACT,WAAW;oBACP;wBACI,KAAK;wBACL,QAAQ;wBACR,QAAQ;4BACJ;4BACA;4BACA;4BACA;4BACA;4BACA;4BACA;4BACA;4BACA;4BACA;4BACA;4BACA;yBACH;wBACD,UAAU;4BACNU,0CAAAA,WAAkB,CAAC,EAAEf,UAAU,CAAC;4BAChCe,0CAAAA,WAAkB,CAAC,EAAEf,UAAU,EAAE,CAAC;yBACrC;oBACL;iBACH;YACL;QACJ;IACJ;AACJ"}
1
+ {"version":3,"file":"pulumi/apps/core/CoreOpenSearch.js","sources":["../../../../src/pulumi/apps/core/CoreOpenSearch.ts"],"sourcesContent":["/**\n * Important documents to read:\n *\n * https://docs.aws.amazon.com/opensearch-service/latest/developerguide/limits.html#network-limits\n */\nimport path from \"path\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport * as random from \"@pulumi/random\";\nimport {\n createAppModule,\n type PulumiApp,\n type PulumiAppRemoteResource,\n type PulumiAppResource,\n type PulumiAppResourceConstructor\n} from \"@webiny/pulumi\";\n\nimport { getAwsAccountId } from \"../awsUtils.js\";\nimport { CoreVpc } from \"./CoreVpc.js\";\nimport { LAMBDA_RUNTIME } from \"~/pulumi/constants.js\";\n\nexport interface OpenSearchParams {\n protect: boolean;\n namePrefix: string;\n prevDomainName: string | undefined;\n pointInTimeRecovery: boolean;\n}\n\nfunction getDevClusterConfig(): aws.types.input.opensearch.DomainClusterConfig {\n return {\n instanceType: \"t3.small.search\"\n };\n}\n\nfunction getProdClusterConfig(): aws.types.input.opensearch.DomainClusterConfig {\n return {\n // For production deployments, we create 3 instances and configure multi-AZ across 3 zones.\n instanceType: \"t3.medium.search\",\n instanceCount: 3,\n zoneAwarenessEnabled: true,\n zoneAwarenessConfig: {\n availabilityZoneCount: 3\n }\n };\n}\n\nconst OS_ENGINE_VERSION = \"OpenSearch_3.3\";\n\nexport const OpenSearch = createAppModule({\n name: \"OpenSearch\",\n config(app, params: OpenSearchParams) {\n const isProduction = app.env.isProduction;\n\n const vpc = app.getModule(CoreVpc, { optional: true });\n\n let domain:\n | PulumiAppResource<PulumiAppResourceConstructor<aws.opensearch.Domain>>\n | PulumiAppRemoteResource<aws.opensearch.GetDomainResult>\n | null = null;\n\n let domainPolicy;\n let domainEndpoint: pulumi.Output<string> | string;\n let domainArn: pulumi.Output<string>;\n\n const providedEndpoint = process.env.OPENSEARCH_ENDPOINT;\n const providedDomainName = process.env.AWS_OS_DOMAIN_NAME;\n\n if (providedEndpoint && !providedDomainName) {\n throw new Error(\n \"OPENSEARCH_ENDPOINT was provided but AWS_OS_DOMAIN_NAME is missing. \" +\n \"A domain name is required to look up the domain ARN when using a custom endpoint.\"\n );\n }\n\n if (providedDomainName) {\n // Look up the existing domain by name to obtain its ARN and (if no explicit endpoint is\n // provided) its endpoint. This covers both the ephemeral-environment pattern and the\n // case where an external endpoint is supplied alongside a domain name.\n // https://www.webiny.com/docs/key-topics/ci-cd/testing/slow-ephemeral-environments\n domain = app.addRemoteResource(providedDomainName, () => {\n return aws.opensearch.getDomain(\n { domainName: providedDomainName },\n { async: true }\n );\n });\n domainArn = domain.output.arn;\n // Prefer an explicitly provided endpoint; fall back to the one reported by AWS.\n domainEndpoint = providedEndpoint ?? domain.output.endpoint;\n } else {\n const randomId = new random.RandomId(\"osDomainRandomId\", { byteLength: 8 });\n\n const domainLogicalName = \"webiny-js\";\n\n /**\n * The physical domain name must remain stable across re-deploys. Changing it causes\n * Pulumi to delete and recreate the cluster, which is a destructive operation.\n *\n * To avoid this, we read the domain name that was stored in the previous deploy's\n * stack output (via `sdk.getAppStackOutput`) and reuse it unchanged. Only on the\n * very first deploy, when there is no previous output, do we generate a new name\n * (with the resource name prefix applied for consistent naming going forward).\n *\n * NOTE: `params.namePrefix` may be \"\" when upgrading from old code that never stored\n * the domain name in the stack output. In that case the caller passes \"\" explicitly so\n * the fallback formula reproduces the legacy name (`webiny-js-<hex>`) rather than\n * prepending the SDK default prefix and triggering an unintended cluster replacement.\n * See `createCorePulumiApp.ts` → `isUpgradeFromOldCode` for details.\n */\n const domainPhysicalName = randomId.hex.apply(\n hex =>\n params.prevDomainName ??\n `${params.namePrefix}${domainLogicalName}-${hex.slice(-7)}`\n );\n\n domain = app.addResource(aws.opensearch.Domain, {\n name: domainLogicalName,\n config: {\n domainName: domainPhysicalName,\n engineVersion: OS_ENGINE_VERSION,\n clusterConfig: isProduction ? getProdClusterConfig() : getDevClusterConfig(),\n vpcOptions: vpc\n ? {\n subnetIds: vpc.subnets.private.map(s => s.output.id),\n securityGroupIds: [vpc.vpc.output.defaultSecurityGroupId]\n }\n : undefined,\n ebsOptions: {\n ebsEnabled: true,\n volumeSize: 10,\n volumeType: \"gp2\"\n },\n advancedOptions: {\n \"rest.action.multi.allow_explicit_index\": \"true\"\n },\n snapshotOptions: {\n automatedSnapshotStartHour: 23\n }\n },\n opts: { protect: params.protect }\n });\n\n domainEndpoint = domain.output.endpoint;\n domainArn = domain.output.arn;\n\n /**\n * Domain policy defines who can access your OpenSearch Domain.\n * For details on OpenSearch security, read the official documentation:\n * https://docs.aws.amazon.com/openSearch-service/latest/developerguide/security.html\n */\n const accountId = getAwsAccountId(app);\n\n domainPolicy = app.addResource(aws.opensearch.DomainPolicy, {\n name: `${domainLogicalName}-policy`,\n config: {\n domainName: domain.output.domainName,\n accessPolicies: pulumi\n .all([accountId, domainArn])\n .apply(([accountId, domainArn]) => {\n return JSON.stringify({\n Version: \"2012-10-17\",\n Statement: [\n /**\n * Allow requests signed with current account\n */\n {\n Effect: \"Allow\",\n Principal: {\n AWS: accountId\n },\n Action: \"es:*\",\n Resource: `${domainArn}/*`\n }\n ]\n });\n })\n },\n opts: { protect: params.protect }\n });\n }\n\n /**\n * Create a table for OpenSearch records. All ES records are stored in this table to dramatically improve\n * performance and stability on write operations (especially massive data imports). This table also serves as a backup and\n * a single source of truth for your OpenSearch domain. Streaming is enabled on this table, and it will\n * allow asynchronous synchronization of data with OpenSearch domain.\n */\n const table = app.addResource(aws.dynamodb.Table, {\n name: \"webiny-es\",\n config: {\n attributes: [\n { name: \"PK\", type: \"S\" },\n { name: \"SK\", type: \"S\" },\n { name: \"GSI_TENANT\", type: \"S\" }\n ],\n streamEnabled: true,\n streamViewType: \"NEW_AND_OLD_IMAGES\",\n billingMode: \"PAY_PER_REQUEST\",\n hashKey: \"PK\",\n rangeKey: \"SK\",\n globalSecondaryIndexes: [\n {\n name: \"GSI_TENANT\",\n keySchemas: [\n {\n attributeName: \"GSI_TENANT\",\n keyType: \"HASH\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n }\n ],\n ttl: {\n attributeName: \"expiresAt\",\n enabled: true\n },\n pointInTimeRecovery: {\n enabled: params.pointInTimeRecovery\n }\n },\n opts: { protect: params.protect }\n });\n\n const roleName = \"dynamo-to-elastic-lambda-role\";\n\n const role = app.addResource(aws.iam.Role, {\n name: roleName,\n config: {\n assumeRolePolicy: {\n Version: \"2012-10-17\",\n Statement: [\n {\n Action: \"sts:AssumeRole\",\n Principal: {\n Service: \"lambda.amazonaws.com\"\n },\n Effect: \"Allow\"\n }\n ]\n }\n },\n meta: { isLambdaFunctionRole: true }\n });\n\n const policy = getDynamoDbToElasticLambdaPolicy(app, domainArn);\n\n app.addResource(aws.iam.RolePolicyAttachment, {\n name: `${roleName}-DynamoDbToElasticLambdaPolicy`,\n config: {\n role: role.output,\n policyArn: policy.output.arn\n }\n });\n\n // Only use `AWSLambdaVPCAccessExecutionRole` policy if VPC feature is enabled.\n if (vpc) {\n app.addResource(aws.iam.RolePolicyAttachment, {\n name: `${roleName}-AWSLambdaVPCAccessExecutionRole`,\n config: {\n role: role.output,\n policyArn: aws.iam.ManagedPolicy.AWSLambdaVPCAccessExecutionRole\n }\n });\n } else {\n app.addResource(aws.iam.RolePolicyAttachment, {\n name: `${roleName}-AWSLambdaBasicExecutionRole`,\n config: {\n role: role.output,\n policyArn: aws.iam.ManagedPolicy.AWSLambdaBasicExecutionRole\n }\n });\n }\n\n app.addResource(aws.iam.RolePolicyAttachment, {\n name: `${roleName}-AWSLambdaDynamoDBExecutionRole`,\n config: {\n role: role.output,\n policyArn: aws.iam.ManagedPolicy.AWSLambdaDynamoDBExecutionRole\n }\n });\n\n /**\n * This Lambda will process the stream events from DynamoDB table that contains OpenSearch items.\n * OpenSearch can't take large amount of individual writes in a short period of time, so this way\n * we store data for OpenSearch in a DynamoDB table, and asynchronously insert it into OpenSearch\n * using batching.\n */\n const lambda = app.addResource(aws.lambda.Function, {\n name: \"dynamo-to-elastic\",\n config: {\n role: role.output.arn,\n runtime: LAMBDA_RUNTIME,\n handler: \"handler.handler\",\n timeout: 900,\n memorySize: 1024,\n environment: {\n variables: {\n DEBUG: String(process.env.DEBUG),\n OPENSEARCH_ENDPOINT: domainEndpoint,\n OPENSEARCH_USERNAME: process.env.OPENSEARCH_USERNAME ?? \"\",\n OPENSEARCH_PASSWORD: process.env.OPENSEARCH_PASSWORD ?? \"\"\n }\n },\n description: \"Process DynamoDB Stream.\",\n code: new pulumi.asset.AssetArchive({\n \".\": new pulumi.asset.FileArchive(\n path.join(app.paths.workspace, \"dynamoToElastic/build\")\n )\n }),\n vpcConfig: vpc\n ? {\n subnetIds: vpc.subnets.private.map(s => s.output.id),\n securityGroupIds: [vpc.vpc.output.defaultSecurityGroupId]\n }\n : undefined,\n loggingConfig: {\n logFormat: \"JSON\"\n }\n }\n });\n\n const eventSourceMapping = app.addResource(aws.lambda.EventSourceMapping, {\n name: \"dynamo-to-elastic\",\n config: {\n eventSourceArn: table.output.streamArn,\n functionName: lambda.output.arn,\n startingPosition: \"LATEST\",\n maximumRetryAttempts: 3,\n batchSize: 50,\n maximumBatchingWindowInSeconds: 1\n }\n });\n\n app.addOutputs({\n opensearchDomainArn: domainArn,\n opensearchDomainEndpoint: domainEndpoint,\n opensearchDomainName: domain!.output.domainName,\n opensearchDynamodbTableArn: table.output.arn,\n opensearchDynamodbTableName: table.output.name\n });\n\n return {\n domain,\n domainPolicy,\n table,\n dynamoToElastic: {\n role,\n policy,\n lambda,\n eventSourceMapping\n }\n };\n }\n});\n\nfunction getDynamoDbToElasticLambdaPolicy(app: PulumiApp, domainArn: pulumi.Output<string>) {\n return app.addResource(aws.iam.Policy, {\n name: \"DynamoDbToElasticLambdaPolicy-updated\",\n config: {\n description: \"This policy enables access to ES and Dynamodb streams\",\n policy: {\n Version: \"2012-10-17\",\n Statement: [\n {\n Sid: \"PermissionForES\",\n Effect: \"Allow\",\n Action: [\n \"es:ESHttpGet\",\n \"es:ESHttpDelete\",\n \"es:ESHttpPatch\",\n \"es:ESHttpPost\",\n \"es:ESHttpPut\",\n \"dynamodb:BatchGetItem\",\n \"dynamodb:BatchWriteItem\",\n \"dynamodb:PutItem\",\n \"dynamodb:GetItem\",\n \"dynamodb:DeleteItem\",\n \"dynamodb:Query\",\n \"dynamodb:UpdateItem\"\n ],\n Resource: [\n pulumi.interpolate`${domainArn}`,\n pulumi.interpolate`${domainArn}/*`\n ]\n }\n ]\n }\n }\n });\n}\n"],"names":["getDevClusterConfig","getProdClusterConfig","OS_ENGINE_VERSION","OpenSearch","createAppModule","app","params","isProduction","vpc","CoreVpc","domain","domainPolicy","domainEndpoint","domainArn","providedEndpoint","process","providedDomainName","Error","aws","randomId","random","domainLogicalName","domainPhysicalName","hex","s","undefined","accountId","getAwsAccountId","pulumi","JSON","table","roleName","role","policy","getDynamoDbToElasticLambdaPolicy","lambda","LAMBDA_RUNTIME","String","path","eventSourceMapping"],"mappings":";;;;;;;;AA4BA,SAASA;IACL,OAAO;QACH,cAAc;IAClB;AACJ;AAEA,SAASC;IACL,OAAO;QAEH,cAAc;QACd,eAAe;QACf,sBAAsB;QACtB,qBAAqB;YACjB,uBAAuB;QAC3B;IACJ;AACJ;AAEA,MAAMC,oBAAoB;AAEnB,MAAMC,aAAaC,gBAAgB;IACtC,MAAM;IACN,QAAOC,GAAG,EAAEC,MAAwB;QAChC,MAAMC,eAAeF,IAAI,GAAG,CAAC,YAAY;QAEzC,MAAMG,MAAMH,IAAI,SAAS,CAACI,SAAS;YAAE,UAAU;QAAK;QAEpD,IAAIC,SAGS;QAEb,IAAIC;QACJ,IAAIC;QACJ,IAAIC;QAEJ,MAAMC,mBAAmBC,QAAQ,GAAG,CAAC,mBAAmB;QACxD,MAAMC,qBAAqBD,QAAQ,GAAG,CAAC,kBAAkB;QAEzD,IAAID,oBAAoB,CAACE,oBACrB,MAAM,IAAIC,MACN;QAKR,IAAID,oBAAoB;YAKpBN,SAASL,IAAI,iBAAiB,CAACW,oBAAoB,IACxCE,uCAAAA,UAAAA,CAAAA,SAAwB,CAC3B;oBAAE,YAAYF;gBAAmB,GACjC;oBAAE,OAAO;gBAAK;YAGtBH,YAAYH,OAAO,MAAM,CAAC,GAAG;YAE7BE,iBAAiBE,oBAAoBJ,OAAO,MAAM,CAAC,QAAQ;QAC/D,OAAO;YACH,MAAMS,WAAW,IAAIC,0CAAAA,QAAe,CAAC,oBAAoB;gBAAE,YAAY;YAAE;YAEzE,MAAMC,oBAAoB;YAiB1B,MAAMC,qBAAqBH,SAAS,GAAG,CAAC,KAAK,CACzCI,CAAAA,MACIjB,OAAO,cAAc,IACrB,GAAGA,OAAO,UAAU,GAAGe,kBAAkB,CAAC,EAAEE,IAAI,KAAK,CAAC,KAAK;YAGnEb,SAASL,IAAI,W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W;gBACf;YACJ;QACJ;QAEA,MAAMc,qBAAqBlC,IAAI,WAAW,CAACa,uCAAAA,MAAAA,CAAAA,kBAA6B,EAAE;YACtE,MAAM;YACN,QAAQ;gBACJ,gBAAgBY,MAAM,MAAM,CAAC,SAAS;gBACtC,cAAcK,OAAO,MAAM,CAAC,GAAG;gBAC/B,kBAAkB;gBAClB,sBAAsB;gBACtB,WAAW;gBACX,gCAAgC;YACpC;QACJ;QAEA9B,IAAI,UAAU,CAAC;YACX,qBAAqBQ;YACrB,0BAA0BD;YAC1B,sBAAsBF,OAAQ,MAAM,CAAC,UAAU;YAC/C,4BAA4BoB,MAAM,MAAM,CAAC,GAAG;YAC5C,6BAA6BA,MAAM,MAAM,CAAC,IAAI;QAClD;QAEA,OAAO;YACHpB;YACAC;YACAmB;YACA,iBAAiB;gBACbE;gBACAC;gBACAE;gBACAI;YACJ;QACJ;IACJ;AACJ;AAEA,SAASL,iCAAiC7B,GAAc,EAAEQ,SAAgC;IACtF,OAAOR,IAAI,WAAW,CAACa,uCAAAA,GAAAA,CAAAA,MAAc,EAAE;QACnC,MAAM;QACN,QAAQ;YACJ,aAAa;YACb,QAAQ;gBACJ,SAAS;gBACT,WAAW;oBACP;wBACI,KAAK;wBACL,QAAQ;wBACR,QAAQ;4BACJ;4BACA;4BACA;4BACA;4BACA;4BACA;4BACA;4BACA;4BACA;4BACA;4BACA;4BACA;yBACH;wBACD,UAAU;4BACNU,0CAAAA,WAAkB,CAAC,EAAEf,UAAU,CAAC;4BAChCe,0CAAAA,WAAkB,CAAC,EAAEf,UAAU,EAAE,CAAC;yBACrC;oBACL;iBACH;YACL;QACJ;IACJ;AACJ"}
@@ -17,15 +17,23 @@ const configureAdminCognitoFederation = (app, config)=>{
17
17
  });
18
18
  app.addOutput("cognitoUserPoolDomain", __rspack_external__pulumi_pulumi_f3e773ed.interpolate`${userPoolDomain.output.domain}.auth.${region}.amazoncognito.com`);
19
19
  const idpConfigs = [];
20
+ const idpOutputs = [];
20
21
  for (const idp of config.identityProviders){
21
22
  const config = getIdpConfig(idp.type, userPool.output.id, idp);
22
23
  const name = config.providerName.toString().toLowerCase();
23
- app.addResource(__rspack_external__pulumi_aws_9e2bee2d.cognito.IdentityProvider, {
24
+ const idpResource = app.addResource(__rspack_external__pulumi_aws_9e2bee2d.cognito.IdentityProvider, {
24
25
  name,
25
26
  config
26
27
  });
28
+ idpOutputs.push(idpResource.output);
27
29
  idpConfigs.push(config);
28
30
  }
31
+ appClient.opts.dependsOn = [
32
+ ...appClient.opts.dependsOn ? Array.isArray(appClient.opts.dependsOn) ? appClient.opts.dependsOn : [
33
+ appClient.opts.dependsOn
34
+ ] : [],
35
+ ...idpOutputs
36
+ ];
29
37
  appClient.config.supportedIdentityProviders([
30
38
  "COGNITO",
31
39
  ...idpConfigs.map((config)=>{
@@ -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\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 app.addResource(aws.cognito.IdentityProvider, { name, config });\n\n idpConfigs.push(config);\n }\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","idp","getIdpConfig","name"],"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,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,CAAC,EAAE;QAClC;IACJ;IAEAJ,IAAI,SAAS,CACT,yBACAS,0CAAAA,WAAkB,CAAC,EAAEH,eAAe,MAAM,CAAC,MAAM,CAAC,MAAM,EAAEJ,OAAO,kBAAkB,CAAC;IAGxF,MAAMQ,aAAiD,EAAE;IAEzD,KAAK,MAAMC,OAAOV,OAAO,iBAAiB,CAAE;QACxC,MAAMA,SAASW,aAAaD,IAAI,IAAI,EAAEP,SAAS,MAAM,CAAC,EAAE,EAAEO;QAQ1D,MAAME,OAAOZ,OAAO,YAAY,CAAC,QAAQ,GAAG,WAAW;QAEvDD,IAAI,WAAW,CAACO,uCAAAA,OAAAA,CAAAA,gBAA4B,EAAE;YAAEM;YAAMZ;QAAO;QAE7DS,WAAW,IAAI,CAACT;IACpB;IAEAI,UAAU,MAAM,CAAC,0BAA0B,CAAC;QACxC;WACGK,WAAW,GAAG,CAACT,CAAAA;YAGd,IAAIA,AAAwB,WAAxBA,OAAO,YAAY,EACnB,OAAOA,OAAO,YAAY;YAE9B,OAAOA,OAAO,YAAY;QAC9B;KACH;IAEDI,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"}
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,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,YA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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,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;4BACrB,6BAA6B;gCACzB,iBAAiB;gCACjB,sBAAsB;oCAClB;oCACA;iCACH;4BACL;4BACA,MAAM;gCACF,iBAAiB;gCACjB,sBAAsB;4BAC1B;wBAC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U,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,Q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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"}
@@ -9,10 +9,14 @@ import { WatchCommand } from "./WatchCommand.js";
9
9
  import { withServiceManifest } from "../../utils/withServiceManifest.js";
10
10
  import { addServiceManifestTableItem } from "../../utils/addServiceManifestTableItem.js";
11
11
  import { getAwsProjectSdk } from "../../getAwsProjectSdk.js";
12
- import { CorePulumi } from "../../../abstractions/features/pulumi/index.js";
12
+ import { CorePulumi } from "@webiny/project-extensions-aws/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";
17
+ import { isProductionDefaultEnabled } from "../extensions/isProductionDefaultEnabled.js";
18
+ import { DynamoDbPitr } from "@webiny/project-extensions-aws/extensions/DynamoDbPitr.js";
19
+ import { S3BucketVersioning } from "@webiny/project-extensions-aws/extensions/S3BucketVersioning.js";
16
20
  import { applyAwsResourceTags, getAwsRegion } from "../awsUtils.js";
17
21
  import { configureS3BucketMalwareProtection } from "./configureS3BucketMalwareProtection.js";
18
22
  import { CoreAuditLogsDynamo } from "../../index.js";
@@ -56,7 +60,7 @@ function createCorePulumiApp() {
56
60
  app.addHandler(async ()=>{
57
61
  const usingAdvancedVpcParams = vpcExtensionsConfig && "boolean" != typeof vpcExtensionsConfig;
58
62
  const featureFlags = await sdk.getFeatureFlags();
59
- if (featureFlags.isFileManagerThreatDetectionEnabled()) configureS3BucketMalwareProtection(app);
63
+ if (featureFlags.isEnabled("fileManager.threatDetection")) configureS3BucketMalwareProtection(app);
60
64
  if (!usingAdvancedVpcParams) return;
61
65
  const { resources, addResource, onResource } = app;
62
66
  const { useExistingVpc, useVpcEndpoints } = vpcExtensionsConfig;
@@ -148,21 +152,41 @@ function createCorePulumiApp() {
148
152
  app.addHandler(()=>pulumiHandlers.execute(app));
149
153
  const isProduction = app.env.isProduction;
150
154
  const protect = isProduction;
155
+ const pointInTimeRecovery = isProductionDefaultEnabled(projectConfig, DynamoDbPitr, isProduction);
156
+ const s3BucketVersioning = isProductionDefaultEnabled(projectConfig, S3BucketVersioning, isProduction);
151
157
  const dynamoDbTable = app.addModule(CoreDynamo, {
152
- protect
158
+ protect,
159
+ pointInTimeRecovery
153
160
  });
154
161
  const auditLogsDynamoDbTable = app.addModule(CoreAuditLogsDynamo, {
155
- protect
162
+ protect,
163
+ pointInTimeRecovery
156
164
  });
157
- const vpcEnabled = true === vpcExtensionsConfig || "object" == typeof vpcExtensionsConfig || isProduction;
158
- const vpc = vpcEnabled ? app.addModule(CoreVpc) : null;
165
+ const vpc = isVpcEnabled(vpcExtensionsConfig, isProduction) ? app.addModule(CoreVpc) : null;
159
166
  const cognito = app.addModule(CoreCognito, {
160
167
  protect,
161
- useEmailAsUsername: false
168
+ useEmailAsUsername: false,
169
+ mfa: "true" === process.env.COGNITO_MFA
162
170
  });
171
+ const isNewDeployment = !coreStackOutput || 0 === Object.keys(coreStackOutput).length;
172
+ if (isNewDeployment) cognito.userPool.config.schemas((schemas)=>schemas?.map((schema)=>{
173
+ if ("id" === schema.name) return {
174
+ ...schema,
175
+ stringAttributeConstraints: {
176
+ ...schema.stringAttributeConstraints,
177
+ maxLength: "256"
178
+ }
179
+ };
180
+ return schema;
181
+ }));
182
+ else cognito.userPool.opts.ignoreChanges = [
183
+ ...cognito.userPool.opts.ignoreChanges || [],
184
+ "schemas"
185
+ ];
163
186
  const eventBus = app.addModule(CoreEventBus);
164
187
  const { bucket: fileManagerBucket } = app.addModule(CoreFileManger, {
165
- protect
188
+ protect,
189
+ versioning: s3BucketVersioning
166
190
  });
167
191
  let opensearch;
168
192
  if ("opensearch" === searchEngineType) {
@@ -172,7 +196,8 @@ function createCorePulumiApp() {
172
196
  opensearch = app.addModule(OpenSearch, {
173
197
  protect,
174
198
  namePrefix: namePrefixForOs,
175
- prevDomainName
199
+ prevDomainName,
200
+ pointInTimeRecovery
176
201
  });
177
202
  }
178
203
  app.addModule(WatchCommand, {