@webiny/project-aws 6.6.0-alpha.1 → 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 (237) hide show
  1. package/abstractions/pulumiTypes.d.ts +15 -0
  2. package/abstractions/pulumiTypes.js +0 -0
  3. package/api.js +1 -3
  4. package/api.js.map +1 -1
  5. package/exports/infra/admin.d.ts +1 -3
  6. package/exports/infra/admin.js +0 -3
  7. package/exports/infra/api.d.ts +1 -3
  8. package/exports/infra/api.js +0 -3
  9. package/exports/infra/core.d.ts +1 -2
  10. package/exports/infra/core.js +0 -2
  11. package/extensions/ApiLambdaFunction.js +3 -2
  12. package/extensions/ApiLambdaFunction.js.map +1 -1
  13. package/extensions/ApiRoute.js +6 -12
  14. package/extensions/ApiRoute.js.map +1 -1
  15. package/extensions/OpenSearch/EnsureOsWasDeployed.d.ts +2 -2
  16. package/extensions/OpenSearch/EnsureOsWasDeployed.js +1 -1
  17. package/extensions/OpenSearch/EnsureOsWasDeployed.js.map +1 -1
  18. package/extensions/OpenSearch.d.ts +9 -10
  19. package/extensions/OpenSearch.js +7 -15
  20. package/extensions/OpenSearch.js.map +1 -1
  21. package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.d.ts +1 -1
  22. package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js +1 -1
  23. package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js.map +1 -1
  24. package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js +1 -1
  25. package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js.map +1 -1
  26. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.d.ts +1 -1
  27. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.js +1 -1
  28. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.js.map +1 -1
  29. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeBuild.d.ts +1 -1
  30. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeBuild.js +1 -1
  31. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeBuild.js.map +1 -1
  32. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeWatch.d.ts +1 -1
  33. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeWatch.js +1 -1
  34. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeWatch.js.map +1 -1
  35. package/extensions/ProjectAws/SetDatabaseSetupOutput.d.ts +2 -2
  36. package/extensions/ProjectAws/SetDatabaseSetupOutput.js +1 -1
  37. package/extensions/ProjectAws/SetDatabaseSetupOutput.js.map +1 -1
  38. package/extensions/ProjectAws/UploadAdminAppToS3.d.ts +1 -1
  39. package/extensions/ProjectAws/UploadAdminAppToS3.js +2 -2
  40. package/extensions/ProjectAws/UploadAdminAppToS3.js.map +1 -1
  41. package/extensions/ProjectAws/definitions.js +1 -1
  42. package/extensions/ProjectAws/definitions.js.map +1 -1
  43. package/extensions/ProjectAws.d.ts +1 -0
  44. package/extensions/ProjectAws.js +1 -0
  45. package/extensions/ProjectAws.js.map +1 -1
  46. package/extensions/RegisterRoutesPulumi.d.ts +2 -2
  47. package/extensions/RegisterRoutesPulumi.js +2 -2
  48. package/extensions/RegisterRoutesPulumi.js.map +1 -1
  49. package/extensions/definitions.js +1 -3
  50. package/extensions/definitions.js.map +1 -1
  51. package/extensions/index.d.ts +2 -3
  52. package/extensions/index.js +2 -3
  53. package/extensions/registerExtensionImplementations.js +10 -0
  54. package/extensions/registerExtensionImplementations.js.map +1 -0
  55. package/features/ApiGqlClient.d.ts +4 -4
  56. package/features/ApiGqlClient.js +3 -3
  57. package/features/ApiGqlClient.js.map +1 -1
  58. package/features/InvokeLambdaFunction.d.ts +2 -2
  59. package/features/InvokeLambdaFunction.js +2 -2
  60. package/features/InvokeLambdaFunction.js.map +1 -1
  61. package/features/Watch/AwsWatch.js +3 -3
  62. package/features/Watch/AwsWatch.js.map +1 -1
  63. package/index.d.ts +2 -1
  64. package/index.js +2 -1
  65. package/infra.d.ts +49 -2
  66. package/infra.js +16 -4
  67. package/infra.js.map +1 -1
  68. package/package.json +22 -22
  69. package/project.d.ts +12 -1
  70. package/project.js +3 -2
  71. package/project.js.map +1 -1
  72. package/pulumi/apps/admin/createAdminPulumiApp.js +7 -4
  73. package/pulumi/apps/admin/createAdminPulumiApp.js.map +1 -1
  74. package/pulumi/apps/api/ApiCloudfront.js +2 -1
  75. package/pulumi/apps/api/ApiCloudfront.js.map +1 -1
  76. package/pulumi/apps/api/ApiOutput.d.ts +6 -6
  77. package/pulumi/apps/api/createApiPulumiApp.js +9 -7
  78. package/pulumi/apps/api/createApiPulumiApp.js.map +1 -1
  79. package/pulumi/apps/awsUtils.js +1 -1
  80. package/pulumi/apps/awsUtils.js.map +1 -1
  81. package/pulumi/apps/blueGreen/domains/resolveDomains.js +1 -1
  82. package/pulumi/apps/blueGreen/domains/resolveDomains.js.map +1 -1
  83. package/pulumi/apps/blueGreen/types.d.ts +0 -3
  84. package/pulumi/apps/common/CoreOutput.d.ts +2 -1
  85. package/pulumi/apps/common/CoreOutput.js.map +1 -1
  86. package/pulumi/apps/core/CoreAuditLogsDynamo.d.ts +1 -0
  87. package/pulumi/apps/core/CoreAuditLogsDynamo.js +3 -0
  88. package/pulumi/apps/core/CoreAuditLogsDynamo.js.map +1 -1
  89. package/pulumi/apps/core/CoreDynamo.d.ts +1 -0
  90. package/pulumi/apps/core/CoreDynamo.js +3 -0
  91. package/pulumi/apps/core/CoreDynamo.js.map +1 -1
  92. package/pulumi/apps/core/CoreFileManager.d.ts +2 -0
  93. package/pulumi/apps/core/CoreFileManager.js +11 -1
  94. package/pulumi/apps/core/CoreFileManager.js.map +1 -1
  95. package/pulumi/apps/core/CoreOpenSearch.d.ts +1 -0
  96. package/pulumi/apps/core/CoreOpenSearch.js +3 -0
  97. package/pulumi/apps/core/CoreOpenSearch.js.map +1 -1
  98. package/pulumi/apps/core/configureS3BucketMalwareProtection.js +12 -2
  99. package/pulumi/apps/core/configureS3BucketMalwareProtection.js.map +1 -1
  100. package/pulumi/apps/core/createCorePulumiApp.js +16 -7
  101. package/pulumi/apps/core/createCorePulumiApp.js.map +1 -1
  102. package/pulumi/apps/customDomain.d.ts +10 -0
  103. package/pulumi/apps/customDomain.js +5 -1
  104. package/pulumi/apps/customDomain.js.map +1 -1
  105. package/pulumi/apps/extensions/getAwsTagsFromExtension.js +1 -1
  106. package/pulumi/apps/extensions/getAwsTagsFromExtension.js.map +1 -1
  107. package/pulumi/apps/extensions/getBgDeploymentsConfigFromExtension.d.ts +2 -2
  108. package/pulumi/apps/extensions/getBgDeploymentsConfigFromExtension.js +1 -1
  109. package/pulumi/apps/extensions/getBgDeploymentsConfigFromExtension.js.map +1 -1
  110. package/pulumi/apps/extensions/getOsConfigFromExtension.js +2 -2
  111. package/pulumi/apps/extensions/getOsConfigFromExtension.js.map +1 -1
  112. package/pulumi/apps/extensions/getVpcConfigFromExtension.js +1 -1
  113. package/pulumi/apps/extensions/getVpcConfigFromExtension.js.map +1 -1
  114. package/pulumi/apps/extensions/isProductionDefaultEnabled.d.ts +16 -0
  115. package/pulumi/apps/extensions/isProductionDefaultEnabled.js +9 -0
  116. package/pulumi/apps/extensions/isProductionDefaultEnabled.js.map +1 -0
  117. package/pulumi/apps/extensions/isVpcEnabled.d.ts +14 -0
  118. package/pulumi/apps/extensions/isVpcEnabled.js +8 -0
  119. package/pulumi/apps/extensions/isVpcEnabled.js.map +1 -0
  120. package/pulumi/extensions/AdminPulumi.js +3 -2
  121. package/pulumi/extensions/AdminPulumi.js.map +1 -1
  122. package/pulumi/extensions/ApiPulumi.js +3 -2
  123. package/pulumi/extensions/ApiPulumi.js.map +1 -1
  124. package/pulumi/extensions/CorePulumi.js +3 -2
  125. package/pulumi/extensions/CorePulumi.js.map +1 -1
  126. package/pulumi/extensions/index.d.ts +53 -22
  127. package/pulumi/extensions/index.js +12 -9
  128. package/pulumi/extensions/index.js.map +1 -1
  129. package/pulumi/features/AdminPulumi/AdminPulumi.d.ts +1 -1
  130. package/pulumi/features/AdminPulumi/AdminPulumi.js +1 -1
  131. package/pulumi/features/AdminPulumi/AdminPulumi.js.map +1 -1
  132. package/pulumi/features/ApiPulumi/ApiPulumi.d.ts +1 -1
  133. package/pulumi/features/ApiPulumi/ApiPulumi.js +1 -1
  134. package/pulumi/features/ApiPulumi/ApiPulumi.js.map +1 -1
  135. package/pulumi/features/CorePulumi/CorePulumi.d.ts +1 -1
  136. package/pulumi/features/CorePulumi/CorePulumi.js +1 -1
  137. package/pulumi/features/CorePulumi/CorePulumi.js.map +1 -1
  138. package/pulumi/features/DefaultSetAdminCustomDomains.d.ts +1 -1
  139. package/pulumi/features/DefaultSetAdminCustomDomains.js.map +1 -1
  140. package/pulumi/features/DefaultSetApiCustomDomains.d.ts +1 -1
  141. package/pulumi/features/DefaultSetApiCustomDomains.js.map +1 -1
  142. package/pulumi/types.d.ts +2 -1
  143. package/pulumi/utils/getDistributionUrl.d.ts +9 -0
  144. package/pulumi/utils/getDistributionUrl.js +8 -0
  145. package/pulumi/utils/getDistributionUrl.js.map +1 -0
  146. package/pulumi/utils/index.d.ts +1 -0
  147. package/pulumi/utils/index.js +1 -0
  148. package/pulumi/utils/lambdaEnvVariables.js.map +1 -1
  149. package/services/AdminStackOutputService.d.ts +2 -2
  150. package/services/AdminStackOutputService.js +1 -1
  151. package/services/AdminStackOutputService.js.map +1 -1
  152. package/services/ApiStackOutputService.d.ts +2 -2
  153. package/services/ApiStackOutputService.js +1 -1
  154. package/services/ApiStackOutputService.js.map +1 -1
  155. package/services/CoreStackOutputService.d.ts +2 -2
  156. package/services/CoreStackOutputService.js +1 -1
  157. package/services/CoreStackOutputService.js.map +1 -1
  158. package/services/GetPulumiService/GetPulumiService.d.ts +1 -2
  159. package/services/GetPulumiService/GetPulumiService.js +1 -1
  160. package/services/GetPulumiService/GetPulumiService.js.map +1 -1
  161. package/abstractions/ApiGqlClient.d.ts +0 -23
  162. package/abstractions/ApiGqlClient.js +0 -5
  163. package/abstractions/ApiGqlClient.js.map +0 -1
  164. package/abstractions/InvokeLambdaFunction.d.ts +0 -18
  165. package/abstractions/InvokeLambdaFunction.js +0 -5
  166. package/abstractions/InvokeLambdaFunction.js.map +0 -1
  167. package/abstractions/features/pulumi/AdminPulumi.d.ts +0 -9
  168. package/abstractions/features/pulumi/AdminPulumi.js +0 -5
  169. package/abstractions/features/pulumi/AdminPulumi.js.map +0 -1
  170. package/abstractions/features/pulumi/ApiPulumi.d.ts +0 -9
  171. package/abstractions/features/pulumi/ApiPulumi.js +0 -5
  172. package/abstractions/features/pulumi/ApiPulumi.js.map +0 -1
  173. package/abstractions/features/pulumi/CorePulumi.d.ts +0 -9
  174. package/abstractions/features/pulumi/CorePulumi.js +0 -5
  175. package/abstractions/features/pulumi/CorePulumi.js.map +0 -1
  176. package/abstractions/features/pulumi/SetAdminCustomDomains.d.ts +0 -9
  177. package/abstractions/features/pulumi/SetAdminCustomDomains.js +0 -5
  178. package/abstractions/features/pulumi/SetAdminCustomDomains.js.map +0 -1
  179. package/abstractions/features/pulumi/SetApiCustomDomains.d.ts +0 -9
  180. package/abstractions/features/pulumi/SetApiCustomDomains.js +0 -5
  181. package/abstractions/features/pulumi/SetApiCustomDomains.js.map +0 -1
  182. package/abstractions/features/pulumi/index.d.ts +0 -5
  183. package/abstractions/features/pulumi/index.js +0 -5
  184. package/abstractions/index.d.ts +0 -6
  185. package/abstractions/index.js +0 -6
  186. package/abstractions/services/AdminStackOutputService.d.ts +0 -13
  187. package/abstractions/services/AdminStackOutputService.js +0 -5
  188. package/abstractions/services/AdminStackOutputService.js.map +0 -1
  189. package/abstractions/services/ApiStackOutputService.d.ts +0 -29
  190. package/abstractions/services/ApiStackOutputService.js +0 -5
  191. package/abstractions/services/ApiStackOutputService.js.map +0 -1
  192. package/abstractions/services/CoreStackOutputService.d.ts +0 -16
  193. package/abstractions/services/CoreStackOutputService.js +0 -5
  194. package/abstractions/services/CoreStackOutputService.js.map +0 -1
  195. package/exports/extensions.d.ts +0 -5
  196. package/exports/extensions.js +0 -5
  197. package/exports/infra.d.ts +0 -1
  198. package/exports/infra.js +0 -1
  199. package/extensions/AwsDefaultRegion.d.ts +0 -4
  200. package/extensions/AwsDefaultRegion.js +0 -23
  201. package/extensions/AwsDefaultRegion.js.map +0 -1
  202. package/extensions/BackgroundTasks.d.ts +0 -4
  203. package/extensions/BackgroundTasks.js +0 -24
  204. package/extensions/BackgroundTasks.js.map +0 -1
  205. package/extensions/Cms/ModelFieldCompression.d.ts +0 -4
  206. package/extensions/Cms/ModelFieldCompression.js +0 -24
  207. package/extensions/Cms/ModelFieldCompression.js.map +0 -1
  208. package/extensions/Mailer/Smtp.d.ts +0 -8
  209. package/extensions/Mailer/Smtp.js +0 -21
  210. package/extensions/Mailer/Smtp.js.map +0 -1
  211. package/extensions/Mailer/Smtp.test.js +0 -127
  212. package/extensions/Mailer/Smtp.test.js.map +0 -1
  213. package/extensions/Mailer/SmtpParamsSchema.d.ts +0 -9
  214. package/extensions/Mailer/SmtpParamsSchema.js +0 -17
  215. package/extensions/Mailer/SmtpParamsSchema.js.map +0 -1
  216. package/extensions/ProjectAws/AutoInstall.d.ts +0 -9
  217. package/extensions/ProjectAws/AutoInstall.js +0 -20
  218. package/extensions/ProjectAws/AutoInstall.js.map +0 -1
  219. package/pulumi/extensions/AdminCustomDomains.d.ts +0 -9
  220. package/pulumi/extensions/AdminCustomDomains.js +0 -20
  221. package/pulumi/extensions/AdminCustomDomains.js.map +0 -1
  222. package/pulumi/extensions/ApiCustomDomains.d.ts +0 -9
  223. package/pulumi/extensions/ApiCustomDomains.js +0 -20
  224. package/pulumi/extensions/ApiCustomDomains.js.map +0 -1
  225. package/pulumi/extensions/AwsTags.d.ts +0 -4
  226. package/pulumi/extensions/AwsTags.js +0 -16
  227. package/pulumi/extensions/AwsTags.js.map +0 -1
  228. package/pulumi/extensions/BlueGreenDeployments.d.ts +0 -34
  229. package/pulumi/extensions/BlueGreenDeployments.js +0 -38
  230. package/pulumi/extensions/BlueGreenDeployments.js.map +0 -1
  231. package/pulumi/extensions/OpenSearch.d.ts +0 -10
  232. package/pulumi/extensions/OpenSearch.js +0 -21
  233. package/pulumi/extensions/OpenSearch.js.map +0 -1
  234. package/pulumi/extensions/Vpc.d.ts +0 -15
  235. package/pulumi/extensions/Vpc.js +0 -26
  236. package/pulumi/extensions/Vpc.js.map +0 -1
  237. /package/extensions/{Mailer/Smtp.test.d.ts → registerExtensionImplementations.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"pulumi/apps/common/CoreOutput.js","sources":["../../../../src/pulumi/apps/common/CoreOutput.ts"],"sourcesContent":["import { createAppModule, type PulumiAppModule } from \"@webiny/pulumi\";\nimport { getAwsProjectSdk } from \"~/pulumi/getAwsProjectSdk.js\";\n\nexport type CoreOutput = PulumiAppModule<typeof CoreOutput>;\n\nexport interface ICoreOutput {\n deploymentId: string;\n region: string;\n dynamoDbTable: string;\n iotAuthorizerName: string;\n cognitoUserPoolArn: string;\n cognitoAppClientId: string;\n cognitoUserPoolId: string;\n cognitoUserPoolPasswordPolicy: string;\n fileManagerBucketId: string;\n fileManagerBucketArn: string;\n primaryDynamodbTableArn: string;\n primaryDynamodbTableName: string;\n primaryDynamodbTableHashKey: string;\n primaryDynamodbTableRangeKey: string;\n auditLogsDynamodbTableArn: string;\n auditLogsDynamodbTableName: string;\n auditLogsDynamodbTableHashKey: string;\n auditLogsDynamodbTableRangeKey: string;\n eventBusName: string;\n eventBusArn: string;\n vpcPublicSubnetIds: string[] | undefined;\n vpcPrivateSubnetIds: string[] | undefined;\n vpcSecurityGroupIds: string[] | undefined;\n opensearchDomainArn: string | undefined;\n opensearchDomainEndpoint: string | undefined;\n opensearchDynamodbTableHashKey: string;\n opensearchDynamodbTableRangeKey: string;\n opensearchDynamodbTableArn: string | undefined;\n opensearchDynamodbTableName: string | undefined;\n}\n\nexport const CoreOutput = createAppModule({\n name: \"CoreOutput\",\n config(app) {\n return app.addHandler(async () => {\n const sdk = await getAwsProjectSdk();\n\n const output = await sdk.getAppStackOutput(\"core\");\n if (!output) {\n throw new Error(\"Core application is not deployed.\");\n }\n\n return {\n fileManagerBucketId: output[\"fileManagerBucketId\"],\n primaryDynamodbTableArn: output[\"primaryDynamodbTableArn\"],\n primaryDynamodbTableName: output[\"primaryDynamodbTableName\"],\n primaryDynamodbTableHashKey: output[\"primaryDynamodbTableHashKey\"],\n primaryDynamodbTableRangeKey: output[\"primaryDynamodbTableRangeKey\"],\n auditLogsDynamodbTableArn: output[\"auditLogsDynamodbTableArn\"],\n auditLogsDynamodbTableName: output[\"auditLogsDynamodbTableName\"],\n auditLogsDynamodbTableHashKey: output[\"auditLogsDynamodbTableHashKey\"],\n auditLogsDynamodbTableRangeKey: output[\"auditLogsDynamodbTableRangeKey\"],\n cognitoUserPoolId: output[\"cognitoUserPoolId\"],\n cognitoUserPoolArn: output[\"cognitoUserPoolArn\"],\n cognitoUserPoolPasswordPolicy: output[\"cognitoUserPoolPasswordPolicy\"],\n cognitoAppClientId: output[\"cognitoAppClientId\"],\n eventBusName: output[\"eventBusName\"],\n eventBusArn: output[\"eventBusArn\"],\n // These outputs are optional, since VPC is not always enabled.\n vpcPublicSubnetIds: output[\"vpcPublicSubnetIds\"],\n vpcPrivateSubnetIds: output[\"vpcPrivateSubnetIds\"],\n vpcSecurityGroupIds: output[\"vpcSecurityGroupIds\"],\n // These outputs are optional, since Opensearch is not always enabled.\n opensearchDomainArn: output[\"opensearchDomainArn\"],\n opensearchDomainEndpoint: output[\"opensearchDomainEndpoint\"],\n opensearchDynamodbTableArn: output[\"opensearchDynamodbTableArn\"],\n opensearchDynamodbTableName: output[\"opensearchDynamodbTableName\"]\n } as ICoreOutput;\n });\n }\n});\n"],"names":["CoreOutput","createAppModule","app","sdk","getAwsProjectSdk","output","Error"],"mappings":";;AAqCO,MAAMA,aAAaC,gBAAgB;IACtC,MAAM;IACN,QAAOC,GAAG;QACN,OAAOA,IAAI,UAAU,CAAC;YAClB,MAAMC,MAAM,MAAMC;YAElB,MAAMC,SAAS,MAAMF,IAAI,iBAAiB,CAAC;YAC3C,IAAI,CAACE,QACD,MAAM,IAAIC,MAAM;YAGpB,OAAO;gBACH,qBAAqBD,MAAM,CAAC,sBAAsB;gBAClD,yBAAyBA,MAAM,CAAC,0BAA0B;gBAC1D,0BAA0BA,MAAM,CAAC,2BAA2B;gBAC5D,6BAA6BA,MAAM,CAAC,8BAA8B;gBAClE,8BAA8BA,MAAM,CAAC,+BAA+B;gBACpE,2BAA2BA,MAAM,CAAC,4BAA4B;gBAC9D,4BAA4BA,MAAM,CAAC,6BAA6B;gBAChE,+BAA+BA,MAAM,CAAC,gCAAgC;gBACtE,gCAAgCA,MAAM,CAAC,iCAAiC;gBACxE,mBAAmBA,MAAM,CAAC,oBAAoB;gBAC9C,oBAAoBA,MAAM,CAAC,qBAAqB;gBAChD,+BAA+BA,MAAM,CAAC,gCAAgC;gBACtE,oBAAoBA,MAAM,CAAC,qBAAqB;gBAChD,cAAcA,MAAM,CAAC,eAAe;gBACpC,aAAaA,MAAM,CAAC,cAAc;gBAElC,oBAAoBA,MAAM,CAAC,qBAAqB;gBAChD,qBAAqBA,MAAM,CAAC,sBAAsB;gBAClD,qBAAqBA,MAAM,CAAC,sBAAsB;gBAElD,qBAAqBA,MAAM,CAAC,sBAAsB;gBAClD,0BAA0BA,MAAM,CAAC,2BAA2B;gBAC5D,4BAA4BA,MAAM,CAAC,6BAA6B;gBAChE,6BAA6BA,MAAM,CAAC,8BAA8B;YACtE;QACJ;IACJ;AACJ"}
1
+ {"version":3,"file":"pulumi/apps/common/CoreOutput.js","sources":["../../../../src/pulumi/apps/common/CoreOutput.ts"],"sourcesContent":["import { createAppModule, type PulumiAppModule } from \"@webiny/pulumi\";\nimport { getAwsProjectSdk } from \"~/pulumi/getAwsProjectSdk.js\";\nimport type { ApiStackOutputService } from \"@webiny/project-extensions-aws/abstractions/services/ApiStackOutputService.js\";\n\nexport type CoreOutput = PulumiAppModule<typeof CoreOutput>;\n\nexport interface ICoreOutput {\n deploymentId: string;\n region: string;\n dynamoDbTable: string;\n iotAuthorizerName: string;\n cognitoUserPoolArn: string;\n cognitoAppClientId: string;\n cognitoUserPoolId: string;\n cognitoUserPoolPasswordPolicy: ApiStackOutputService.PasswordPolicy;\n fileManagerBucketId: string;\n fileManagerBucketArn: string;\n primaryDynamodbTableArn: string;\n primaryDynamodbTableName: string;\n primaryDynamodbTableHashKey: string;\n primaryDynamodbTableRangeKey: string;\n auditLogsDynamodbTableArn: string;\n auditLogsDynamodbTableName: string;\n auditLogsDynamodbTableHashKey: string;\n auditLogsDynamodbTableRangeKey: string;\n eventBusName: string;\n eventBusArn: string;\n vpcPublicSubnetIds: string[] | undefined;\n vpcPrivateSubnetIds: string[] | undefined;\n vpcSecurityGroupIds: string[] | undefined;\n opensearchDomainArn: string | undefined;\n opensearchDomainEndpoint: string | undefined;\n opensearchDynamodbTableHashKey: string;\n opensearchDynamodbTableRangeKey: string;\n opensearchDynamodbTableArn: string | undefined;\n opensearchDynamodbTableName: string | undefined;\n}\n\nexport const CoreOutput = createAppModule({\n name: \"CoreOutput\",\n config(app) {\n return app.addHandler(async () => {\n const sdk = await getAwsProjectSdk();\n\n const output = await sdk.getAppStackOutput(\"core\");\n if (!output) {\n throw new Error(\"Core application is not deployed.\");\n }\n\n return {\n fileManagerBucketId: output[\"fileManagerBucketId\"],\n primaryDynamodbTableArn: output[\"primaryDynamodbTableArn\"],\n primaryDynamodbTableName: output[\"primaryDynamodbTableName\"],\n primaryDynamodbTableHashKey: output[\"primaryDynamodbTableHashKey\"],\n primaryDynamodbTableRangeKey: output[\"primaryDynamodbTableRangeKey\"],\n auditLogsDynamodbTableArn: output[\"auditLogsDynamodbTableArn\"],\n auditLogsDynamodbTableName: output[\"auditLogsDynamodbTableName\"],\n auditLogsDynamodbTableHashKey: output[\"auditLogsDynamodbTableHashKey\"],\n auditLogsDynamodbTableRangeKey: output[\"auditLogsDynamodbTableRangeKey\"],\n cognitoUserPoolId: output[\"cognitoUserPoolId\"],\n cognitoUserPoolArn: output[\"cognitoUserPoolArn\"],\n cognitoUserPoolPasswordPolicy: output[\"cognitoUserPoolPasswordPolicy\"],\n cognitoAppClientId: output[\"cognitoAppClientId\"],\n eventBusName: output[\"eventBusName\"],\n eventBusArn: output[\"eventBusArn\"],\n // These outputs are optional, since VPC is not always enabled.\n vpcPublicSubnetIds: output[\"vpcPublicSubnetIds\"],\n vpcPrivateSubnetIds: output[\"vpcPrivateSubnetIds\"],\n vpcSecurityGroupIds: output[\"vpcSecurityGroupIds\"],\n // These outputs are optional, since Opensearch is not always enabled.\n opensearchDomainArn: output[\"opensearchDomainArn\"],\n opensearchDomainEndpoint: output[\"opensearchDomainEndpoint\"],\n opensearchDynamodbTableArn: output[\"opensearchDynamodbTableArn\"],\n opensearchDynamodbTableName: output[\"opensearchDynamodbTableName\"]\n } as ICoreOutput;\n });\n }\n});\n"],"names":["CoreOutput","createAppModule","app","sdk","getAwsProjectSdk","output","Error"],"mappings":";;AAsCO,MAAMA,aAAaC,gBAAgB;IACtC,MAAM;IACN,QAAOC,GAAG;QACN,OAAOA,IAAI,UAAU,CAAC;YAClB,MAAMC,MAAM,MAAMC;YAElB,MAAMC,SAAS,MAAMF,IAAI,iBAAiB,CAAC;YAC3C,IAAI,CAACE,QACD,MAAM,IAAIC,MAAM;YAGpB,OAAO;gBACH,qBAAqBD,MAAM,CAAC,sBAAsB;gBAClD,yBAAyBA,MAAM,CAAC,0BAA0B;gBAC1D,0BAA0BA,MAAM,CAAC,2BAA2B;gBAC5D,6BAA6BA,MAAM,CAAC,8BAA8B;gBAClE,8BAA8BA,MAAM,CAAC,+BAA+B;gBACpE,2BAA2BA,MAAM,CAAC,4BAA4B;gBAC9D,4BAA4BA,MAAM,CAAC,6BAA6B;gBAChE,+BAA+BA,MAAM,CAAC,gCAAgC;gBACtE,gCAAgCA,MAAM,CAAC,iCAAiC;gBACxE,mBAAmBA,MAAM,CAAC,oBAAoB;gBAC9C,oBAAoBA,MAAM,CAAC,qBAAqB;gBAChD,+BAA+BA,MAAM,CAAC,gCAAgC;gBACtE,oBAAoBA,MAAM,CAAC,qBAAqB;gBAChD,cAAcA,MAAM,CAAC,eAAe;gBACpC,aAAaA,MAAM,CAAC,cAAc;gBAElC,oBAAoBA,MAAM,CAAC,qBAAqB;gBAChD,qBAAqBA,MAAM,CAAC,sBAAsB;gBAClD,qBAAqBA,MAAM,CAAC,sBAAsB;gBAElD,qBAAqBA,MAAM,CAAC,sBAAsB;gBAClD,0BAA0BA,MAAM,CAAC,2BAA2B;gBAC5D,4BAA4BA,MAAM,CAAC,6BAA6B;gBAChE,6BAA6BA,MAAM,CAAC,8BAA8B;YACtE;QACJ;IACJ;AACJ"}
@@ -2,4 +2,5 @@ import type { PulumiAppModule } from "@webiny/pulumi";
2
2
  export type CoreAuditLogsDynamo = PulumiAppModule<typeof CoreAuditLogsDynamo>;
3
3
  export declare const CoreAuditLogsDynamo: import("@webiny/pulumi").PulumiAppModuleDefinition<import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/dynamodb/table").Table>, {
4
4
  protect: boolean;
5
+ pointInTimeRecovery: boolean;
5
6
  }>;
@@ -236,6 +236,9 @@ const CoreAuditLogsDynamo = createAppModule({
236
236
  ttl: {
237
237
  attributeName: "expiresAt",
238
238
  enabled: true
239
+ },
240
+ pointInTimeRecovery: {
241
+ enabled: params.pointInTimeRecovery
239
242
  }
240
243
  },
241
244
  opts: {
@@ -1 +1 @@
1
- {"version":3,"file":"pulumi/apps/core/CoreAuditLogsDynamo.js","sources":["../../../../src/pulumi/apps/core/CoreAuditLogsDynamo.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport type { PulumiApp, PulumiAppModule } from \"@webiny/pulumi\";\nimport { createAppModule } from \"@webiny/pulumi\";\n\nexport type CoreAuditLogsDynamo = PulumiAppModule<typeof CoreAuditLogsDynamo>;\n\nexport const CoreAuditLogsDynamo = createAppModule({\n name: \"AuditLogsDynamoDb\",\n config(app: PulumiApp, params: { protect: boolean }) {\n return app.addResource(aws.dynamodb.Table, {\n name: \"webiny-audit-logs\",\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: \"N\" },\n { name: \"GSI2_PK\", type: \"S\" },\n { name: \"GSI2_SK\", type: \"N\" },\n { name: \"GSI3_PK\", type: \"S\" },\n { name: \"GSI3_SK\", type: \"N\" },\n { name: \"GSI4_PK\", type: \"S\" },\n { name: \"GSI4_SK\", type: \"N\" },\n { name: \"GSI5_PK\", type: \"S\" },\n { name: \"GSI5_SK\", type: \"N\" },\n { name: \"GSI6_PK\", type: \"S\" },\n { name: \"GSI6_SK\", type: \"N\" },\n { name: \"GSI7_PK\", type: \"S\" },\n { name: \"GSI7_SK\", type: \"N\" },\n { name: \"GSI8_PK\", type: \"S\" },\n { name: \"GSI8_SK\", type: \"N\" },\n { name: \"GSI9_PK\", type: \"S\" },\n { name: \"GSI9_SK\", type: \"N\" }\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: \"KEYS_ONLY\"\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: \"KEYS_ONLY\"\n },\n {\n name: \"GSI3\",\n keySchemas: [\n {\n attributeName: \"GSI3_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI3_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI4\",\n keySchemas: [\n {\n attributeName: \"GSI4_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI4_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI5\",\n keySchemas: [\n {\n attributeName: \"GSI5_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI5_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI6\",\n keySchemas: [\n {\n attributeName: \"GSI6_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI6_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI7\",\n keySchemas: [\n {\n attributeName: \"GSI7_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI7_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI8\",\n keySchemas: [\n {\n attributeName: \"GSI8_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI8_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI9\",\n keySchemas: [\n {\n attributeName: \"GSI9_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI9_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n }\n ],\n ttl: {\n attributeName: \"expiresAt\",\n enabled: true\n }\n },\n opts: {\n protect: params.protect\n }\n });\n }\n});\n"],"names":["CoreAu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D,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;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;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;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;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/CoreAuditLogsDynamo.js","sources":["../../../../src/pulumi/apps/core/CoreAuditLogsDynamo.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport type { PulumiApp, PulumiAppModule } from \"@webiny/pulumi\";\nimport { createAppModule } from \"@webiny/pulumi\";\n\nexport type CoreAuditLogsDynamo = PulumiAppModule<typeof CoreAuditLogsDynamo>;\n\nexport const CoreAuditLogsDynamo = createAppModule({\n name: \"AuditLogsDynamoDb\",\n config(app: PulumiApp, params: { protect: boolean; pointInTimeRecovery: boolean }) {\n return app.addResource(aws.dynamodb.Table, {\n name: \"webiny-audit-logs\",\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: \"N\" },\n { name: \"GSI2_PK\", type: \"S\" },\n { name: \"GSI2_SK\", type: \"N\" },\n { name: \"GSI3_PK\", type: \"S\" },\n { name: \"GSI3_SK\", type: \"N\" },\n { name: \"GSI4_PK\", type: \"S\" },\n { name: \"GSI4_SK\", type: \"N\" },\n { name: \"GSI5_PK\", type: \"S\" },\n { name: \"GSI5_SK\", type: \"N\" },\n { name: \"GSI6_PK\", type: \"S\" },\n { name: \"GSI6_SK\", type: \"N\" },\n { name: \"GSI7_PK\", type: \"S\" },\n { name: \"GSI7_SK\", type: \"N\" },\n { name: \"GSI8_PK\", type: \"S\" },\n { name: \"GSI8_SK\", type: \"N\" },\n { name: \"GSI9_PK\", type: \"S\" },\n { name: \"GSI9_SK\", type: \"N\" }\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: \"KEYS_ONLY\"\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: \"KEYS_ONLY\"\n },\n {\n name: \"GSI3\",\n keySchemas: [\n {\n attributeName: \"GSI3_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI3_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI4\",\n keySchemas: [\n {\n attributeName: \"GSI4_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI4_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI5\",\n keySchemas: [\n {\n attributeName: \"GSI5_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI5_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI6\",\n keySchemas: [\n {\n attributeName: \"GSI6_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI6_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI7\",\n keySchemas: [\n {\n attributeName: \"GSI7_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI7_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI8\",\n keySchemas: [\n {\n attributeName: \"GSI8_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI8_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI9\",\n keySchemas: [\n {\n attributeName: \"GSI9_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI9_SK\",\n keyType: \"RANGE\"\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: {\n protect: params.protect\n }\n });\n }\n});\n"],"names":["CoreAuditLogsDynamo","createAppModule","app","params","aws"],"mappings":";;AAMO,MAAMA,sBAAsBC,gBAAgB;IAC/C,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;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;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;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;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;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;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"}
@@ -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;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;QAGA,MAAMM,mBAAmBR,OAAO,UAAU,GACpCD,IAAI,WAAW,CAACI,uCAAAA,EAAAA,CAAAA,gBAAuB,EAAE;YACrC,MAAM,GAAGF,KAAK,WAAW,CAAC;YAC1B,QAAQ;gBACJ,QAAQC,OAAO,MAAM,CAAC,EAAE;gBACxB,yBAAyB;oBACrB,QAAQ;gBACZ;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,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,G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AAOR,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;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rB,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"}
@@ -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;gB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"pulumi/apps/core/configureS3BucketMalwareProtection.js","sources":["../../../../src/pulumi/apps/core/configureS3BucketMalwareProtection.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport type { CorePulumiApp } from \"~/pulumi/apps/core/index.js\";\nimport { getAwsAccountId, getAwsRegion } from \"~/pulumi/apps/awsUtils.js\";\n\nexport const configureS3BucketMalwareProtection = (app: CorePulumiApp) => {\n const awsAccountId = getAwsAccountId(app);\n const awsRegion = getAwsRegion(app);\n const eventBus = app.resources.eventBus;\n\n const bucket = app.resources.fileManagerBucket.output;\n\n const currentAccount = {\n StringEquals: {\n \"aws:ResourceAccount\": awsAccountId\n }\n };\n\n const managedByGuardDuty = {\n StringEquals: {\n \"events:ManagedBy\": \"malware-protection-plan.guardduty.amazonaws.com\"\n }\n };\n\n const assumeRole = aws.iam.getPolicyDocument({\n statements: [\n {\n effect: \"Allow\",\n principals: [\n {\n type: \"Service\",\n identifiers: [\"malware-protection-plan.guardduty.amazonaws.com\"]\n }\n ],\n actions: [\"sts:AssumeRole\"]\n }\n ]\n });\n\n const role = app.addResource(aws.iam.Role, {\n name: \"fm-bucket-guardduty-role\",\n config: {\n assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json)\n }\n });\n\n const policy = app.addResource(aws.iam.Policy, {\n name: `fm-bucket-guardduty-role-policy`,\n config: {\n description: \"This policy enables GuardDuty to interact with the S3 bucket.\",\n policy: {\n Version: \"2012-10-17\",\n Statement: [\n {\n Sid: \"AllowManagedRuleToSendS3EventsToGuardDuty\",\n Effect: \"Allow\",\n Action: [\"events:PutRule\"],\n Resource: [\n pulumi.interpolate`arn:aws:events:${awsRegion}:${awsAccountId}:rule/DO-NOT-DELETE-AmazonGuardDutyMalwareProtectionS3*`\n ],\n Condition: {\n ...managedByGuardDuty,\n \"ForAllValues:StringEquals\": {\n \"events:source\": \"aws.s3\",\n \"events:detail-type\": [\n \"Object Created\",\n \"AWS API Call via CloudTrail\"\n ]\n },\n Null: {\n \"events:source\": \"false\",\n \"events:detail-type\": \"false\"\n }\n }\n },\n {\n Sid: \"AllowUpdateTargetAndDeleteManagedRule\",\n Effect: \"Allow\",\n Action: [\"events:DeleteRule\", \"events:PutTargets\", \"events:RemoveTargets\"],\n Resource: [\n pulumi.interpolate`arn:aws:events:${awsRegion}:${awsAccountId}:rule/DO-NOT-DELETE-AmazonGuardDutyMalwareProtectionS3*`\n ],\n Condition: {\n ...managedByGuardDuty\n }\n },\n {\n Sid: \"AllowGuardDutyToMonitorEventBridgeManagedRule\",\n Effect: \"Allow\",\n Action: [\"events:DescribeRule\", \"events:ListTargetsByRule\"],\n Resource: [\n pulumi.interpolate`arn:aws:events:${awsRegion}:${awsAccountId}:rule/DO-NOT-DELETE-AmazonGuardDutyMalwareProtectionS3*`\n ]\n },\n {\n Sid: \"AllowPostScanTag\",\n Effect: \"Allow\",\n Action: [\n \"s3:GetObjectTagging\",\n \"s3:GetObjectVersionTagging\",\n \"s3:PutObjectTagging\",\n \"s3:PutObjectVersionTagging\"\n ],\n Resource: [pulumi.interpolate`arn:aws:s3:::${bucket.bucket}/*`],\n Condition: {\n ...currentAccount\n }\n },\n {\n Sid: \"AllowEnableS3EventBridgeEvents\",\n Effect: \"Allow\",\n Action: [\"s3:PutBucketNotification\", \"s3:GetBucketNotification\"],\n Resource: [pulumi.interpolate`arn:aws:s3:::${bucket.bucket}`],\n Condition: {\n ...currentAccount\n }\n },\n {\n Sid: \"AllowPutValidationObject\",\n Effect: \"Allow\",\n Action: [\"s3:PutObject\"],\n Resource: [\n pulumi.interpolate`arn:aws:s3:::${bucket.bucket}/malware-protection-resource-validation-object`\n ],\n Condition: {\n ...currentAccount\n }\n },\n {\n Sid: \"AllowCheckBucketOwnership\",\n Effect: \"Allow\",\n Action: [\"s3:ListBucket\"],\n Resource: [pulumi.interpolate`arn:aws:s3:::${bucket.bucket}`],\n Condition: {\n ...currentAccount\n }\n },\n {\n Sid: \"AllowMalwareScan\",\n Effect: \"Allow\",\n Action: [\"s3:GetObject\", \"s3:GetObjectVersion\"],\n Resource: [pulumi.interpolate`arn:aws:s3:::${bucket.bucket}/*`],\n Condition: {\n ...currentAccount\n }\n }\n ]\n }\n }\n });\n\n const attachment = app.addResource(aws.iam.RolePolicyAttachment, {\n name: `fm-bucket-malware-protection-role-policy-attachment`,\n config: {\n role: role.output.name,\n policyArn: policy.output.arn\n }\n });\n\n app.addResource(aws.guardduty.MalwareProtectionPlan, {\n name: `fm-bucket-malware-protection-plan`,\n config: {\n role: role.output.arn,\n protectedResource: {\n s3Bucket: {\n bucketName: bucket.bucket\n }\n }\n },\n opts: {\n /**\n * The plan needs the role's permissions when it's created, and when it's deleted\n * (to remove its EventBridge rule). Without this dependency, Pulumi can create the\n * plan before the policy is attached, and delete the attachment before the plan.\n */\n dependsOn: [attachment.output]\n }\n });\n\n // FORWARD EVENTS FROM \"DEFAULT\" TO CUSTOM EVENT BUS.\n\n // Create an IAM Role for EventBridge to forward events\n const eventBridgeRole = app.addResource(aws.iam.Role, {\n name: \"guard-duty-forward-events-role\",\n config: {\n assumeRolePolicy: JSON.stringify({\n Version: \"2012-10-17\",\n Statement: [\n {\n Effect: \"Allow\",\n Principal: { Service: \"events.amazonaws.com\" },\n Action: \"sts:AssumeRole\"\n }\n ]\n })\n }\n });\n\n // Attach Policy to Allow EventBridge to PutEvents on Custom Event Bus\n const forwardEventsPolicy = app.addResource(aws.iam.RolePolicy, {\n name: \"guard-duty-forward-events-policy\",\n config: {\n role: eventBridgeRole.output,\n policy: pulumi.output(eventBus.output.arn).apply(arn =>\n JSON.stringify({\n Version: \"2012-10-17\",\n Statement: [\n {\n Effect: \"Allow\",\n Action: \"events:PutEvents\",\n Resource: arn\n }\n ]\n })\n )\n }\n });\n\n const forwardToCustomBusRule = app.addResource(aws.cloudwatch.EventRule, {\n name: \"forward-events-from-default-to-custom-bus-rule\",\n config: {\n eventBusName: \"default\",\n eventPattern: bucket.bucket.apply(name =>\n JSON.stringify({\n source: [\"aws.guardduty\"],\n \"detail-type\": [\"GuardDuty Malware Protection Object Scan Result\"],\n detail: {\n s3ObjectDetails: {\n bucketName: [name]\n }\n }\n })\n )\n }\n });\n\n // Target: Send events to the custom event bus\n app.addResource(aws.cloudwatch.EventTarget, {\n name: \"forward-events-from-default-to-custom-bus-target\",\n config: {\n rule: forwardToCustomBusRule.output.name,\n roleArn: eventBridgeRole.output.arn,\n eventBusName: \"default\",\n arn: eventBus.output.arn\n },\n opts: {\n // The target uses the role to forward events, so the role's policy must exist first.\n dependsOn: [forwardEventsPolicy.output]\n }\n });\n};\n"],"names":["configureS3BucketMalwareProtection","app","awsAccountId","getAwsAccountId","awsRegion","getAwsRegion","eventBus","bucket","currentAccount","managedByGuardDuty","assumeRole","aws","role","policy","pulumi","attachment","eventBridgeRole","JSON","forwardEventsPolicy","arn","forwardToCustomBusRule","name"],"mappings":";;;AAKO,MAAMA,qCAAqC,CAACC;IAC/C,MAAMC,eAAeC,gBAAgBF;IACrC,MAAMG,YAAYC,aAAaJ;IAC/B,MAAMK,WAAWL,IAAI,SAAS,CAAC,QAAQ;IAEvC,MAAMM,SAASN,IAAI,SAAS,CAAC,iBAAiB,CAAC,MAAM;IAErD,MAAMO,iBAAiB;QACnB,cAAc;YACV,uBAAuBN;QAC3B;IACJ;IAEA,MAAMO,qBAAqB;QACvB,cAAc;YACV,oBAAoB;QACxB;IACJ;IAEA,MAAMC,aAAaC,uCAAAA,GAAAA,CAAAA,iBAAyB,CAAC;QACzC,YAAY;YACR;gBACI,QAAQ;gBACR,YAAY;oBACR;wBACI,MAAM;wBACN,aAAa;4BAAC;yBAAkD;oBACpE;iBACH;gBACD,SAAS;oBAAC;iBAAiB;YAC/B;SACH;IACL;IAEA,MAAMC,OAAOX,IAAI,WAAW,CAACU,uCAAAA,GAAAA,CAAAA,IAAY,EAAE;QACvC,MAAM;QACN,QAAQ;YACJ,kBAAkBD,WAAW,IAAI,CAACA,CAAAA,aAAcA,WAAW,IAAI;QAC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iceManifest.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";
@@ -148,14 +152,17 @@ 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
168
  useEmailAsUsername: false,
@@ -178,7 +185,8 @@ function createCorePulumiApp() {
178
185
  ];
179
186
  const eventBus = app.addModule(CoreEventBus);
180
187
  const { bucket: fileManagerBucket } = app.addModule(CoreFileManger, {
181
- protect
188
+ protect,
189
+ versioning: s3BucketVersioning
182
190
  });
183
191
  let opensearch;
184
192
  if ("opensearch" === searchEngineType) {
@@ -188,7 +196,8 @@ function createCorePulumiApp() {
188
196
  opensearch = app.addModule(OpenSearch, {
189
197
  protect,
190
198
  namePrefix: namePrefixForOs,
191
- prevDomainName
199
+ prevDomainName,
200
+ pointInTimeRecovery
192
201
  });
193
202
  }
194
203
  app.addModule(WatchCommand, {