@webiny/pulumi-aws 6.0.0-alpha.0 → 6.0.0-alpha.1

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 (191) hide show
  1. package/apps/admin/createAdminPulumiApp.d.ts +3 -2
  2. package/apps/admin/createAdminPulumiApp.js +1 -0
  3. package/apps/admin/createAdminPulumiApp.js.map +1 -1
  4. package/apps/api/ApiApwScheduler.d.ts +1 -1
  5. package/apps/api/ApiApwScheduler.js.map +1 -1
  6. package/apps/api/ApiBackgroundTask.d.ts +1 -1
  7. package/apps/api/ApiBackgroundTask.js.map +1 -1
  8. package/apps/api/ApiCloudfront.d.ts +1 -1
  9. package/apps/api/ApiCloudfront.js.map +1 -1
  10. package/apps/api/ApiFileManager.d.ts +7 -1
  11. package/apps/api/ApiFileManager.js +6 -0
  12. package/apps/api/ApiFileManager.js.map +1 -1
  13. package/apps/api/ApiGateway.d.ts +2 -2
  14. package/apps/api/ApiGateway.js.map +1 -1
  15. package/apps/api/ApiGraphql.d.ts +1 -1
  16. package/apps/api/ApiGraphql.js.map +1 -1
  17. package/apps/api/ApiMigration.d.ts +1 -1
  18. package/apps/api/ApiMigration.js.map +1 -1
  19. package/apps/api/ApiOutput.d.ts +11 -1
  20. package/apps/api/ApiOutput.js +11 -1
  21. package/apps/api/ApiOutput.js.map +1 -1
  22. package/apps/api/ApiPageBuilder.d.ts +1 -1
  23. package/apps/api/ApiPageBuilder.js.map +1 -1
  24. package/apps/api/ApiScheduler.d.ts +8 -0
  25. package/apps/api/ApiScheduler.js +105 -0
  26. package/apps/api/ApiScheduler.js.map +1 -0
  27. package/apps/api/ApiWebsocket.d.ts +1 -1
  28. package/apps/api/ApiWebsocket.js.map +1 -1
  29. package/apps/api/backgroundTask/definition.d.ts +2 -2
  30. package/apps/api/backgroundTask/definition.js.map +1 -1
  31. package/apps/api/backgroundTask/policy.d.ts +2 -2
  32. package/apps/api/backgroundTask/policy.js.map +1 -1
  33. package/apps/api/backgroundTask/role.d.ts +2 -2
  34. package/apps/api/backgroundTask/role.js.map +1 -1
  35. package/apps/api/backgroundTask/types.d.ts +1 -1
  36. package/apps/api/backgroundTask/types.js.map +1 -1
  37. package/apps/api/createApiPulumiApp.d.ts +19 -13
  38. package/apps/api/createApiPulumiApp.js +50 -19
  39. package/apps/api/createApiPulumiApp.js.map +1 -1
  40. package/apps/awsUtils.d.ts +1 -1
  41. package/apps/awsUtils.js.map +1 -1
  42. package/apps/blueGreen/createBlueGreenPulumiApp.d.ts +7 -1
  43. package/apps/blueGreen/createBlueGreenPulumiApp.js +2 -2
  44. package/apps/blueGreen/createBlueGreenPulumiApp.js.map +1 -1
  45. package/apps/blueGreen/domains/attachDomainsToOutput.d.ts +1 -1
  46. package/apps/blueGreen/domains/attachDomainsToOutput.js.map +1 -1
  47. package/apps/blueGreen/types.d.ts +4 -1
  48. package/apps/blueGreen/types.js.map +1 -1
  49. package/apps/common/CoreOutput.d.ts +2 -1
  50. package/apps/common/CoreOutput.js +1 -0
  51. package/apps/common/CoreOutput.js.map +1 -1
  52. package/apps/common/VpcConfig.d.ts +1 -1
  53. package/apps/common/VpcConfig.js.map +1 -1
  54. package/apps/core/CoreCognito.d.ts +1 -1
  55. package/apps/core/CoreCognito.js.map +1 -1
  56. package/apps/core/CoreDynamo.d.ts +1 -1
  57. package/apps/core/CoreDynamo.js.map +1 -1
  58. package/apps/core/CoreElasticSearch.d.ts +1 -1
  59. package/apps/core/CoreElasticSearch.js +7 -1
  60. package/apps/core/CoreElasticSearch.js.map +1 -1
  61. package/apps/core/CoreEventBus.js.map +1 -1
  62. package/apps/core/CoreFileManager.d.ts +1 -1
  63. package/apps/core/CoreFileManager.js.map +1 -1
  64. package/apps/core/CoreOpenSearch.d.ts +1 -1
  65. package/apps/core/CoreOpenSearch.js +7 -1
  66. package/apps/core/CoreOpenSearch.js.map +1 -1
  67. package/apps/core/CoreVpc.d.ts +1 -1
  68. package/apps/core/CoreVpc.js.map +1 -1
  69. package/apps/core/LogDynamo.d.ts +1 -1
  70. package/apps/core/LogDynamo.js.map +1 -1
  71. package/apps/core/WatchCommand.js.map +1 -1
  72. package/apps/core/cognitoIdentityProviders/amazon.d.ts +3 -3
  73. package/apps/core/cognitoIdentityProviders/amazon.js.map +1 -1
  74. package/apps/core/cognitoIdentityProviders/apple.d.ts +3 -3
  75. package/apps/core/cognitoIdentityProviders/apple.js.map +1 -1
  76. package/apps/core/cognitoIdentityProviders/configure.d.ts +3 -3
  77. package/apps/core/cognitoIdentityProviders/configure.js.map +1 -1
  78. package/apps/core/cognitoIdentityProviders/facebook.d.ts +3 -3
  79. package/apps/core/cognitoIdentityProviders/facebook.js.map +1 -1
  80. package/apps/core/cognitoIdentityProviders/getIdpConfig.d.ts +2 -2
  81. package/apps/core/cognitoIdentityProviders/getIdpConfig.js.map +1 -1
  82. package/apps/core/cognitoIdentityProviders/google.d.ts +3 -3
  83. package/apps/core/cognitoIdentityProviders/google.js.map +1 -1
  84. package/apps/core/cognitoIdentityProviders/oidc.d.ts +3 -3
  85. package/apps/core/cognitoIdentityProviders/oidc.js.map +1 -1
  86. package/apps/core/createCorePulumiApp.d.ts +1 -1
  87. package/apps/core/createCorePulumiApp.js +2 -1
  88. package/apps/core/createCorePulumiApp.js.map +1 -1
  89. package/apps/createAppBucket.d.ts +1 -1
  90. package/apps/createAppBucket.js.map +1 -1
  91. package/apps/customDomain.d.ts +3 -3
  92. package/apps/customDomain.js.map +1 -1
  93. package/apps/lambdaUtils.d.ts +3 -2
  94. package/apps/lambdaUtils.js +21 -3
  95. package/apps/lambdaUtils.js.map +1 -1
  96. package/apps/react/createReactPulumiApp.d.ts +2 -2
  97. package/apps/react/createReactPulumiApp.js.map +1 -1
  98. package/apps/syncSystem/SyncSystemDynamo.d.ts +1 -1
  99. package/apps/syncSystem/SyncSystemDynamo.js.map +1 -1
  100. package/apps/syncSystem/SyncSystemDynamoDb.d.ts +3 -0
  101. package/apps/syncSystem/SyncSystemDynamoDb.js +55 -0
  102. package/apps/syncSystem/SyncSystemDynamoDb.js.map +1 -0
  103. package/apps/syncSystem/SyncSystemEventBus.d.ts +6 -0
  104. package/apps/syncSystem/SyncSystemEventBus.js +84 -0
  105. package/apps/syncSystem/SyncSystemEventBus.js.map +1 -0
  106. package/apps/syncSystem/SyncSystemLambda.d.ts +1 -1
  107. package/apps/syncSystem/SyncSystemLambda.js.map +1 -1
  108. package/apps/syncSystem/SyncSystemOutput.d.ts +3 -0
  109. package/apps/syncSystem/SyncSystemOutput.js +26 -0
  110. package/apps/syncSystem/SyncSystemOutput.js.map +1 -0
  111. package/apps/syncSystem/SyncSystemResolverLambda.d.ts +8 -0
  112. package/apps/syncSystem/SyncSystemResolverLambda.js +78 -0
  113. package/apps/syncSystem/SyncSystemResolverLambda.js.map +1 -0
  114. package/apps/syncSystem/SyncSystemSQS.d.ts +3 -4
  115. package/apps/syncSystem/SyncSystemSQS.js +33 -12
  116. package/apps/syncSystem/SyncSystemSQS.js.map +1 -1
  117. package/apps/syncSystem/SyncSystemWorkerLambda.d.ts +7 -0
  118. package/apps/syncSystem/SyncSystemWorkerLambda.js +57 -0
  119. package/apps/syncSystem/SyncSystemWorkerLambda.js.map +1 -0
  120. package/apps/syncSystem/api/addServiceManifest.d.ts +8 -0
  121. package/apps/syncSystem/api/addServiceManifest.js +25 -0
  122. package/apps/syncSystem/api/addServiceManifest.js.map +1 -0
  123. package/apps/syncSystem/api/attachCognitoPermissions.d.ts +14 -0
  124. package/apps/syncSystem/api/attachCognitoPermissions.js +67 -0
  125. package/apps/syncSystem/api/attachCognitoPermissions.js.map +1 -0
  126. package/apps/syncSystem/api/attachDynamoDbPermissions.d.ts +13 -0
  127. package/apps/syncSystem/api/attachDynamoDbPermissions.js +53 -0
  128. package/apps/syncSystem/api/attachDynamoDbPermissions.js.map +1 -0
  129. package/apps/syncSystem/api/attachEventBusPermissions.d.ts +18 -0
  130. package/apps/syncSystem/api/attachEventBusPermissions.js +66 -0
  131. package/apps/syncSystem/api/attachEventBusPermissions.js.map +1 -0
  132. package/apps/syncSystem/api/attachS3Permissions.d.ts +14 -0
  133. package/apps/syncSystem/api/attachS3Permissions.js +59 -0
  134. package/apps/syncSystem/api/attachS3Permissions.js.map +1 -0
  135. package/apps/syncSystem/api/index.d.ts +9 -0
  136. package/apps/syncSystem/api/index.js +65 -0
  137. package/apps/syncSystem/api/index.js.map +1 -0
  138. package/apps/syncSystem/constants.d.ts +1 -0
  139. package/apps/syncSystem/constants.js +9 -0
  140. package/apps/syncSystem/constants.js.map +1 -0
  141. package/apps/syncSystem/createSyncResourceName.d.ts +4 -0
  142. package/apps/syncSystem/createSyncResourceName.js +17 -0
  143. package/apps/syncSystem/createSyncResourceName.js.map +1 -0
  144. package/apps/syncSystem/createSyncSystemPulumiApp.d.ts +19 -10
  145. package/apps/syncSystem/createSyncSystemPulumiApp.js +107 -34
  146. package/apps/syncSystem/createSyncSystemPulumiApp.js.map +1 -1
  147. package/apps/syncSystem/customApp.d.ts +6 -0
  148. package/apps/syncSystem/customApp.js +26 -0
  149. package/apps/syncSystem/customApp.js.map +1 -0
  150. package/apps/syncSystem/getSyncSystemOutput.d.ts +6 -0
  151. package/apps/syncSystem/getSyncSystemOutput.js +28 -0
  152. package/apps/syncSystem/getSyncSystemOutput.js.map +1 -0
  153. package/apps/syncSystem/lambda/createSyncSystemResolverLambdaPolicy.d.ts +7 -0
  154. package/apps/syncSystem/lambda/createSyncSystemResolverLambdaPolicy.js +55 -0
  155. package/apps/syncSystem/lambda/createSyncSystemResolverLambdaPolicy.js.map +1 -0
  156. package/apps/syncSystem/types.d.ts +55 -0
  157. package/apps/syncSystem/types.js +7 -0
  158. package/apps/syncSystem/types.js.map +1 -0
  159. package/apps/tenantRouter.d.ts +1 -1
  160. package/apps/tenantRouter.js.map +1 -1
  161. package/apps/website/WebsitePrerendering.d.ts +1 -1
  162. package/apps/website/WebsitePrerendering.js.map +1 -1
  163. package/apps/website/createWebsitePulumiApp.d.ts +2 -2
  164. package/apps/website/createWebsitePulumiApp.js.map +1 -1
  165. package/enterprise/api/handleGuardDutyEvents.d.ts +1 -1
  166. package/enterprise/api/handleGuardDutyEvents.js.map +1 -1
  167. package/enterprise/createApiPulumiApp.d.ts +13 -2
  168. package/enterprise/createApiPulumiApp.js.map +1 -1
  169. package/enterprise/createCorePulumiApp.d.ts +2 -2
  170. package/enterprise/createCorePulumiApp.js.map +1 -1
  171. package/enterprise/createSyncSystemPulumiApp.d.ts +13 -8
  172. package/enterprise/createSyncSystemPulumiApp.js +1 -1
  173. package/enterprise/createSyncSystemPulumiApp.js.map +1 -1
  174. package/enterprise/createWebsitePulumiApp.d.ts +2 -2
  175. package/enterprise/createWebsitePulumiApp.js.map +1 -1
  176. package/package.json +12 -12
  177. package/utils/addDomainsUrlsOutputs.d.ts +2 -2
  178. package/utils/addDomainsUrlsOutputs.js.map +1 -1
  179. package/utils/addServiceManifestTableItem.d.ts +1 -1
  180. package/utils/addServiceManifestTableItem.js.map +1 -1
  181. package/utils/createAssetArchive.d.ts +2 -0
  182. package/utils/createAssetArchive.js +16 -0
  183. package/utils/createAssetArchive.js.map +1 -0
  184. package/utils/getPresignedPost.d.ts +1 -1
  185. package/utils/getPresignedPost.js.map +1 -1
  186. package/utils/lambdaEnvVariables.d.ts +1 -1
  187. package/utils/lambdaEnvVariables.js.map +1 -1
  188. package/utils/uploadFolderToS3.d.ts +1 -1
  189. package/utils/uploadFolderToS3.js.map +1 -1
  190. package/utils/withServiceManifest.d.ts +2 -2
  191. package/utils/withServiceManifest.js.map +1 -1
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.SyncSystemDynamoDb = void 0;
8
+ var aws = _interopRequireWildcard(require("@pulumi/aws"));
9
+ var _pulumi = require("@webiny/pulumi");
10
+ var _createSyncResourceName = require("./createSyncResourceName.js");
11
+ const SyncSystemDynamoDb = exports.SyncSystemDynamoDb = (0, _pulumi.createAppModule)({
12
+ name: "SyncSystemDynamoDb",
13
+ config(app) {
14
+ return app.addResource(aws.dynamodb.Table, {
15
+ name: (0, _createSyncResourceName.createSyncResourceName)("table"),
16
+ config: {
17
+ attributes: [{
18
+ name: "PK",
19
+ type: "S"
20
+ }, {
21
+ name: "SK",
22
+ type: "S"
23
+ }, {
24
+ name: "GSI1_PK",
25
+ type: "S"
26
+ }, {
27
+ name: "GSI1_SK",
28
+ type: "S"
29
+ }, {
30
+ name: "GSI2_PK",
31
+ type: "S"
32
+ }, {
33
+ name: "GSI2_SK",
34
+ type: "S"
35
+ }],
36
+ billingMode: "PAY_PER_REQUEST",
37
+ hashKey: "PK",
38
+ rangeKey: "SK",
39
+ globalSecondaryIndexes: [{
40
+ name: "GSI1",
41
+ hashKey: "GSI1_PK",
42
+ rangeKey: "GSI1_SK",
43
+ projectionType: "ALL"
44
+ }, {
45
+ name: "GSI2",
46
+ hashKey: "GSI2_PK",
47
+ rangeKey: "GSI2_SK",
48
+ projectionType: "ALL"
49
+ }]
50
+ }
51
+ });
52
+ }
53
+ });
54
+
55
+ //# sourceMappingURL=SyncSystemDynamoDb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["aws","_interopRequireWildcard","require","_pulumi","_createSyncResourceName","SyncSystemDynamoDb","exports","createAppModule","name","config","app","addResource","dynamodb","Table","createSyncResourceName","attributes","type","billingMode","hashKey","rangeKey","globalSecondaryIndexes","projectionType"],"sources":["SyncSystemDynamoDb.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport type { PulumiApp, PulumiAppModule } from \"@webiny/pulumi\";\nimport { createAppModule } from \"@webiny/pulumi\";\nimport { createSyncResourceName } from \"~/apps/syncSystem/createSyncResourceName.js\";\n\nexport type SyncSystemDynamoDb = PulumiAppModule<typeof SyncSystemDynamoDb>;\n\nexport const SyncSystemDynamoDb = createAppModule({\n name: \"SyncSystemDynamoDb\",\n config(app: PulumiApp) {\n return app.addResource(aws.dynamodb.Table, {\n name: createSyncResourceName(\"table\"),\n config: {\n attributes: [\n { name: \"PK\", type: \"S\" },\n { name: \"SK\", 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: \"GSI1\",\n hashKey: \"GSI1_PK\",\n rangeKey: \"GSI1_SK\",\n projectionType: \"ALL\"\n },\n {\n name: \"GSI2\",\n hashKey: \"GSI2_PK\",\n rangeKey: \"GSI2_SK\",\n projectionType: \"ALL\"\n }\n ]\n }\n });\n }\n});\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,uBAAA,GAAAF,OAAA;AAIO,MAAMG,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,IAAAE,uBAAe,EAAC;EAC9CC,IAAI,EAAE,oBAAoB;EAC1BC,MAAMA,CAACC,GAAc,EAAE;IACnB,OAAOA,GAAG,CAACC,WAAW,CAACX,GAAG,CAACY,QAAQ,CAACC,KAAK,EAAE;MACvCL,IAAI,EAAE,IAAAM,8CAAsB,EAAC,OAAO,CAAC;MACrCL,MAAM,EAAE;QACJM,UAAU,EAAE,CACR;UAAEP,IAAI,EAAE,IAAI;UAAEQ,IAAI,EAAE;QAAI,CAAC,EACzB;UAAER,IAAI,EAAE,IAAI;UAAEQ,IAAI,EAAE;QAAI,CAAC,EACzB;UAAER,IAAI,EAAE,SAAS;UAAEQ,IAAI,EAAE;QAAI,CAAC,EAC9B;UAAER,IAAI,EAAE,SAAS;UAAEQ,IAAI,EAAE;QAAI,CAAC,EAC9B;UAAER,IAAI,EAAE,SAAS;UAAEQ,IAAI,EAAE;QAAI,CAAC,EAC9B;UAAER,IAAI,EAAE,SAAS;UAAEQ,IAAI,EAAE;QAAI,CAAC,CACjC;QACDC,WAAW,EAAE,iBAAiB;QAC9BC,OAAO,EAAE,IAAI;QACbC,QAAQ,EAAE,IAAI;QACdC,sBAAsB,EAAE,CACpB;UACIZ,IAAI,EAAE,MAAM;UACZU,OAAO,EAAE,SAAS;UAClBC,QAAQ,EAAE,SAAS;UACnBE,cAAc,EAAE;QACpB,CAAC,EACD;UACIb,IAAI,EAAE,MAAM;UACZU,OAAO,EAAE,SAAS;UAClBC,QAAQ,EAAE,SAAS;UACnBE,cAAc,EAAE;QACpB,CAAC;MAET;IACJ,CAAC,CAAC;EACN;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ export declare const SyncSystemEventBus: import("@webiny/pulumi").PulumiAppModuleDefinition<{
2
+ eventBus: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudwatch/eventBus.js").EventBus>;
3
+ eventBusRule: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudwatch/eventRule.js").EventRule>;
4
+ eventBusTarget: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudwatch/eventTarget.js").EventTarget>;
5
+ eventBusPolicy: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/sqs/queuePolicy.js").QueuePolicy>;
6
+ }, void>;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.SyncSystemEventBus = void 0;
8
+ var aws = _interopRequireWildcard(require("@pulumi/aws"));
9
+ var pulumi = _interopRequireWildcard(require("@pulumi/pulumi"));
10
+ var _pulumi2 = require("@webiny/pulumi");
11
+ var _createSyncResourceName = require("./createSyncResourceName.js");
12
+ var _SyncSystemSQS = require("./SyncSystemSQS.js");
13
+ const SyncSystemEventBus = exports.SyncSystemEventBus = (0, _pulumi2.createAppModule)({
14
+ name: "SyncSystemEventBus",
15
+ config: app => {
16
+ const {
17
+ sqsQueue
18
+ } = app.getModule(_SyncSystemSQS.SyncSystemSQS);
19
+ const eventBusName = (0, _createSyncResourceName.createSyncResourceName)("eventBus");
20
+ const config = {
21
+ name: eventBusName,
22
+ description: "Connect deployed systems to Sync SQS"
23
+ };
24
+ const eventBus = app.addResource(aws.cloudwatch.EventBus, {
25
+ name: eventBusName,
26
+ config
27
+ });
28
+ const eventBusRuleConfig = {
29
+ eventBusName: eventBus.output.name,
30
+ eventPattern: JSON.stringify({
31
+ "detail-type": ["synchronization-input"]
32
+ })
33
+ };
34
+ const eventBusRule = app.addResource(aws.cloudwatch.EventRule, {
35
+ name: (0, _createSyncResourceName.createSyncResourceName)("eventBusRule"),
36
+ config: eventBusRuleConfig
37
+ });
38
+ const eventBusTargetConfig = {
39
+ rule: eventBusRule.output.name,
40
+ eventBusName: eventBus.output.name,
41
+ arn: sqsQueue.output.arn,
42
+ sqsTarget: {
43
+ messageGroupId: "default"
44
+ }
45
+ };
46
+ const eventBusTarget = app.addResource(aws.cloudwatch.EventTarget, {
47
+ name: (0, _createSyncResourceName.createSyncResourceName)("eventBusEventTarget"),
48
+ config: eventBusTargetConfig
49
+ });
50
+ const eventBusPolicy = app.addResource(aws.sqs.QueuePolicy, {
51
+ name: (0, _createSyncResourceName.createSyncResourceName)("queuePolicy"),
52
+ config: {
53
+ queueUrl: sqsQueue.output.url,
54
+ policy: pulumi.all([sqsQueue.output.arn, eventBusRule.output.arn]).apply(([sqsArn, eventBusRuleArn]) => {
55
+ return JSON.stringify({
56
+ Version: "2012-10-17",
57
+ Statement: [{
58
+ Effect: "Allow",
59
+ Principal: aws.iam.Principals.EventsPrincipal,
60
+ Action: ["sqs:SendMessage"],
61
+ Resource: [sqsArn, `${sqsArn}/*`],
62
+ Condition: {
63
+ ArnEquals: {
64
+ /**
65
+ * Not a mistake, source is the rule, not the bus.
66
+ */
67
+ "aws:SourceArn": eventBusRuleArn
68
+ }
69
+ }
70
+ }]
71
+ });
72
+ })
73
+ }
74
+ });
75
+ return {
76
+ eventBus,
77
+ eventBusRule,
78
+ eventBusTarget,
79
+ eventBusPolicy
80
+ };
81
+ }
82
+ });
83
+
84
+ //# sourceMappingURL=SyncSystemEventBus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["aws","_interopRequireWildcard","require","pulumi","_pulumi2","_createSyncResourceName","_SyncSystemSQS","SyncSystemEventBus","exports","createAppModule","name","config","app","sqsQueue","getModule","SyncSystemSQS","eventBusName","createSyncResourceName","description","eventBus","addResource","cloudwatch","EventBus","eventBusRuleConfig","output","eventPattern","JSON","stringify","eventBusRule","EventRule","eventBusTargetConfig","rule","arn","sqsTarget","messageGroupId","eventBusTarget","EventTarget","eventBusPolicy","sqs","QueuePolicy","queueUrl","url","policy","all","apply","sqsArn","eventBusRuleArn","Version","Statement","Effect","Principal","iam","Principals","EventsPrincipal","Action","Resource","Condition","ArnEquals"],"sources":["SyncSystemEventBus.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport type { PulumiApp } from \"@webiny/pulumi\";\nimport { createAppModule } from \"@webiny/pulumi\";\nimport { createSyncResourceName } from \"./createSyncResourceName.js\";\nimport type { EventBusArgs } from \"@pulumi/aws/cloudwatch/eventBus.js\";\nimport { SyncSystemSQS } from \"~/apps/syncSystem/SyncSystemSQS.js\";\nimport type { EventRuleArgs } from \"@pulumi/aws/cloudwatch/eventRule.js\";\nimport type { EventTargetArgs } from \"@pulumi/aws/cloudwatch/eventTarget.js\";\n\nexport const SyncSystemEventBus = createAppModule({\n name: \"SyncSystemEventBus\",\n config: (app: PulumiApp) => {\n const { sqsQueue } = app.getModule(SyncSystemSQS);\n\n const eventBusName = createSyncResourceName(\"eventBus\");\n\n const config: EventBusArgs = {\n name: eventBusName,\n description: \"Connect deployed systems to Sync SQS\"\n };\n const eventBus = app.addResource(aws.cloudwatch.EventBus, {\n name: eventBusName,\n config\n });\n\n const eventBusRuleConfig: EventRuleArgs = {\n eventBusName: eventBus.output.name,\n eventPattern: JSON.stringify({\n \"detail-type\": [\"synchronization-input\"]\n })\n };\n\n const eventBusRule = app.addResource(aws.cloudwatch.EventRule, {\n name: createSyncResourceName(\"eventBusRule\"),\n config: eventBusRuleConfig\n });\n\n const eventBusTargetConfig: EventTargetArgs = {\n rule: eventBusRule.output.name,\n eventBusName: eventBus.output.name,\n arn: sqsQueue.output.arn,\n sqsTarget: {\n messageGroupId: \"default\"\n }\n };\n\n const eventBusTarget = app.addResource(aws.cloudwatch.EventTarget, {\n name: createSyncResourceName(\"eventBusEventTarget\"),\n config: eventBusTargetConfig\n });\n\n const eventBusPolicy = app.addResource(aws.sqs.QueuePolicy, {\n name: createSyncResourceName(\"queuePolicy\"),\n config: {\n queueUrl: sqsQueue.output.url,\n policy: pulumi\n .all([sqsQueue.output.arn, eventBusRule.output.arn])\n .apply(([sqsArn, eventBusRuleArn]) => {\n return JSON.stringify({\n Version: \"2012-10-17\",\n Statement: [\n {\n Effect: \"Allow\",\n Principal: aws.iam.Principals.EventsPrincipal,\n Action: [\"sqs:SendMessage\"],\n Resource: [sqsArn, `${sqsArn}/*`],\n Condition: {\n ArnEquals: {\n /**\n * Not a mistake, source is the rule, not the bus.\n */\n \"aws:SourceArn\": eventBusRuleArn\n }\n }\n }\n ]\n });\n })\n }\n });\n\n return {\n eventBus,\n eventBusRule,\n eventBusTarget,\n eventBusPolicy\n };\n }\n});\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,uBAAA,CAAAC,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,uBAAA,GAAAH,OAAA;AAEA,IAAAI,cAAA,GAAAJ,OAAA;AAIO,MAAMK,kBAAkB,GAAAC,OAAA,CAAAD,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M,EAAEmB;IACZ,CAAC,CAAC;IAEF,MAAMO,cAAc,GAAGzB,GAAG,CAACQ,WAAW,CAACpB,GAAG,CAACsC,GAAG,CAACC,WAAW,EAAE;MACxD7B,IAAI,EAAE,IAAAO,8CAAsB,EAAC,aAAa,CAAC;MAC3CN,MAAM,EAAE;QACJ6B,QAAQ,EAAE3B,QAAQ,CAACW,MAAM,CAACiB,GAAG;QAC7BC,MAAM,EAAEvC,MAAM,CACTwC,GAAG,CAAC,CAAC9B,QAAQ,CAACW,MAAM,CAACQ,GAAG,EAAEJ,YAAY,CAACJ,MAAM,CAACQ,GAAG,CAAC,CAAC,CACnDY,KAAK,CAAC,CAAC,CAACC,MAAM,EAAEC,eAAe,CAAC,KAAK;UAClC,OAAOpB,IAAI,CAACC,SAAS,CAAC;YAClBoB,OAAO,EAAE,YAAY;YACrBC,SAAS,EAAE,CACP;cACIC,MAAM,EAAE,OAAO;cACfC,SAAS,EAAElD,GAAG,CAACmD,GAAG,CAACC,UAAU,CAACC,eAAe;cAC7CC,MAAM,EAAE,CAAC,iBAAiB,CAAC;cAC3BC,QAAQ,EAAE,CAACV,MAAM,EAAE,GAAGA,MAAM,IAAI,CAAC;cACjCW,SAAS,EAAE;gBACPC,SAAS,EAAE;kBACP;AAC5C;AACA;kBAC4C,eAAe,EAAEX;gBACrB;cACJ;YACJ,CAAC;UAET,CAAC,CAAC;QACN,CAAC;MACT;IACJ,CAAC,CAAC;IAEF,OAAO;MACH3B,QAAQ;MACRS,YAAY;MACZO,cAAc;MACdE;IACJ,CAAC;EACL;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { PulumiAppModule } from "@webiny/pulumi";
1
+ import type { PulumiAppModule } from "@webiny/pulumi";
2
2
  export interface SyncSystemLambdaParams {
3
3
  protect: boolean;
4
4
  config: Record<string, string>;
@@ -1 +1 @@
1
- {"version":3,"names":["_path","_interopRequireDefault","require","pulumi","_interopRequireWildcard","aws","_pulumi2","_lambdaUtils","_2","_awsUtils","_constants","_SyncSystemDynamo","SyncSystemLambda","exports","createAppModule","name","config","app","_","policy","createSyncSystemLambdaPolicy","primary","fileManagerBucketId","dynamoDbTableArn","secondary","role","createLambdaRole","output","syncSystemLambda","addResource","lambda","Function","runtime","LAMBDA_RUNTIME","handler","arn","timeout","memorySize","code","asset","AssetArchive","FileArchive","path","join","paths","workspace","environment","variables","getCommonLambdaEnvVariables","apply","value","AWS_NODEJS_CONNECTION_REUSE_ENABLED","vpcConfig","getModule","VpcConfig","functionVpcConfig","functions","syncSystem","params","dynamoDbTable","SyncSystemDynamo","awsAccountId","getAwsAccountId","awsRegion","getAwsRegion","Version","Statement","Sid","Effect","Action","Resource","interpolate","iam","Policy","description"],"sources":["SyncSystemLambda.ts"],"sourcesContent":["import path from \"path\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport { createAppModule, PulumiApp, PulumiAppModule } from \"@webiny/pulumi\";\nimport { createLambdaRole, getCommonLambdaEnvVariables } from \"../lambdaUtils\";\nimport { VpcConfig } from \"~/apps\";\nimport { getAwsAccountId, getAwsRegion } from \"../awsUtils\";\nimport { LAMBDA_RUNTIME } from \"~/constants\";\nimport { SyncSystemDynamo } from \"./SyncSystemDynamo\";\n\nexport interface SyncSystemLambdaParams {\n protect: boolean;\n config: Record<string, string>;\n}\n\nexport type SyncSystemLambda = PulumiAppModule<typeof SyncSystemLambda>;\n\nexport const SyncSystemLambda = createAppModule({\n name: \"SyncSystemLambda\",\n // eslint-disable-next-line\n config(app: PulumiApp, _: SyncSystemLambdaParams) {\n const policy = createSyncSystemLambdaPolicy({\n app,\n // TODO - get bucket ids and dynamodb tables from the FileManager app\n primary: {\n fileManagerBucketId: \"primaryFileManagerBucketId\",\n dynamoDbTableArn: \"\"\n },\n secondary: {\n fileManagerBucketId: \"secondaryFileManagerBucketId\",\n dynamoDbTableArn: \"\"\n }\n });\n const role = createLambdaRole(app, {\n name: \"sync-system-lambda-role\",\n policy: policy.output\n });\n\n const syncSystemLambda = app.addResource(aws.lambda.Function, {\n name: \"sync-system-lambda\",\n config: {\n runtime: LAMBDA_RUNTIME,\n handler: \"handler.handler\",\n role: role.output.arn,\n timeout: 900,\n memorySize: 1024,\n code: new pulumi.asset.AssetArchive({\n \".\": new pulumi.asset.FileArchive(\n path.join(app.paths.workspace, \"transfer/build\")\n )\n }),\n environment: {\n variables: getCommonLambdaEnvVariables().apply(value => ({\n ...value,\n AWS_NODEJS_CONNECTION_REUSE_ENABLED: \"1\"\n }))\n },\n vpcConfig: app.getModule(VpcConfig).functionVpcConfig\n }\n });\n\n return {\n role,\n policy,\n functions: {\n syncSystem: syncSystemLambda\n }\n };\n }\n});\n\ninterface ICreateSyncSystemLambdaPolicyParamsType {\n fileManagerBucketId: string;\n dynamoDbTableArn: string;\n}\n\ninterface ICreateSyncSystemLambdaPolicyParams {\n app: PulumiApp;\n primary: ICreateSyncSystemLambdaPolicyParamsType;\n secondary: ICreateSyncSystemLambdaPolicyParamsType;\n}\n\nfunction createSyncSystemLambdaPolicy(params: ICreateSyncSystemLambdaPolicyParams) {\n const { app, primary, secondary } = params;\n const dynamoDbTable = app.getModule(SyncSystemDynamo);\n const awsAccountId = getAwsAccountId(app);\n const awsRegion = getAwsRegion(app);\n\n const policy: aws.iam.PolicyDocument = {\n Version: \"2012-10-17\",\n Statement: [\n {\n Sid: \"PermissionForDynamodb\",\n Effect: \"Allow\",\n Action: [\n \"dynamodb:BatchGetItem\",\n \"dynamodb:BatchWriteItem\",\n \"dynamodb:ConditionCheckItem\",\n \"dynamodb:CreateBackup\",\n \"dynamodb:CreateTable\",\n \"dynamodb:CreateTableReplica\",\n \"dynamodb:DeleteBackup\",\n \"dynamodb:DeleteItem\",\n \"dynamodb:DeleteTable\",\n \"dynamodb:DeleteTableReplica\",\n \"dynamodb:DescribeBackup\",\n \"dynamodb:DescribeContinuousBackups\",\n \"dynamodb:DescribeContributorInsights\",\n \"dynamodb:DescribeExport\",\n \"dynamodb:DescribeKinesisStreamingDestination\",\n \"dynamodb:DescribeLimits\",\n \"dynamodb:DescribeReservedCapacity\",\n \"dynamodb:DescribeReservedCapacityOfferings\",\n \"dynamodb:DescribeStream\",\n \"dynamodb:DescribeTable\",\n \"dynamodb:DescribeTableReplicaAutoScaling\",\n \"dynamodb:DescribeTimeToLive\",\n \"dynamodb:DisableKinesisStreamingDestination\",\n \"dynamodb:EnableKinesisStreamingDestination\",\n \"dynamodb:ExportTableToPointInTime\",\n \"dynamodb:GetItem\",\n \"dynamodb:GetRecords\",\n \"dynamodb:GetShardIterator\",\n \"dynamodb:ListBackups\",\n \"dynamodb:ListContributorInsights\",\n \"dynamodb:ListExports\",\n \"dynamodb:ListStreams\",\n \"dynamodb:ListTables\",\n \"dynamodb:ListTagsOfResource\",\n \"dynamodb:PartiQLDelete\",\n \"dynamodb:PartiQLInsert\",\n \"dynamodb:PartiQLSelect\",\n \"dynamodb:PartiQLUpdate\",\n \"dynamodb:PurchaseReservedCapacityOfferings\",\n \"dynamodb:PutItem\",\n \"dynamodb:Query\",\n \"dynamodb:RestoreTableFromBackup\",\n \"dynamodb:RestoreTableToPointInTime\",\n \"dynamodb:Scan\",\n \"dynamodb:UpdateContinuousBackups\",\n \"dynamodb:UpdateContributorInsights\",\n \"dynamodb:UpdateItem\",\n \"dynamodb:UpdateTable\",\n \"dynamodb:UpdateTableReplicaAutoScaling\",\n \"dynamodb:UpdateTimeToLive\"\n ],\n Resource: [`${dynamoDbTable.output.arn}`, `${dynamoDbTable.output.arn}/*`]\n },\n {\n Sid: \"PermissionForS3\",\n Effect: \"Allow\",\n Action: [\n \"s3:ListBucket\",\n \"s3:GetObjectAcl\",\n \"s3:DeleteObject\",\n \"s3:PutObjectAcl\",\n \"s3:PutObject\",\n \"s3:GetObject\"\n ],\n Resource: [\n pulumi.interpolate`arn:aws:s3:::${primary.fileManagerBucketId}`,\n pulumi.interpolate`arn:aws:s3:::${primary.fileManagerBucketId}/*`,\n pulumi.interpolate`arn:aws:s3:::${secondary.fileManagerBucketId}`,\n pulumi.interpolate`arn:aws:s3:::${secondary.fileManagerBucketId}/*`\n ]\n },\n {\n Sid: \"PermissionForLambda\",\n Effect: \"Allow\",\n Action: [\"lambda:InvokeFunction\"],\n Resource: pulumi.interpolate`arn:aws:lambda:${awsRegion}:${awsAccountId}:function:*`\n }\n ]\n };\n\n return app.addResource(aws.iam.Policy, {\n name: \"SyncSystemLambdaPolicy\",\n config: {\n description: \"This policy enables access to Dynamodb, S3 and Lambda.\",\n policy\n }\n });\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,GAAA,GAAAD,uBAAA,CAAAF,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,EAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,iBAAA,GAAAT,OAAA;AASO,MAAMU,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,IAAAE,wBAAe,EAAC;EAC5CC,IAAI,EAAE,kBAAkB;EACxB;EACAC,MAAMA,CAACC,GAAc,EAAEC,CAAyB,EAAE;IAC9C,MAAMC,MAAM,GAAGC,4BAA4B,CAAC;MACxCH,GAAG;MACH;MACAI,OAAO,EAAE;QACLC,mBAAmB,EAAE,4BAA4B;QACjDC,gBAAgB,EAAE;MACtB,CAAC;MACDC,SAAS,EAAE;QACPF,mBAAmB,EAAE,8BAA8B;QACnDC,gBAAgB,EAAE;MACtB;IACJ,CAAC,CAAC;IACF,MAAME,IAAI,GAAG,IAAAC,6BAAgB,EAACT,GAAG,EAAE;MAC/BF,IAAI,EAAE,yBAAyB;MAC/BI,MAAM,EAAEA,MAAM,CAACQ;IACnB,CAAC,CAAC;IAEF,MAAMC,gBAAgB,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CAACoE,WAAW,gBAAgBlD,OAAO,CAACC,mBAAmB,IAAI,EACjEnB,MAAM,CAACoE,WAAW,gBAAgB/C,SAAS,CAACF,mBAAmB,EAAE,EACjEnB,MAAM,CAACoE,WAAW,gBAAgB/C,SAAS,CAACF,mBAAmB,IAAI;IAE3E,CAAC,EACD;MACI6C,GAAG,EAAE,qBAAqB;MAC1BC,MAAM,EAAE,OAAO;MACfC,MAAM,EAAE,CAAC,uBAAuB,CAAC;MACjCC,QAAQ,EAAEnE,MAAM,CAACoE,WAAW,kBAAkBR,SAAS,IAAIF,YAAY;IAC3E,CAAC;EAET,CAAC;EAED,OAAO5C,GAAG,CAACY,WAAW,CAACxB,GAAG,CAACmE,GAAG,CAACC,MAAM,EAAE;IACnC1D,IAAI,EAAE,wBAAwB;IAC9BC,MAAM,EAAE;MACJ0D,WAAW,EAAE,wDAAwD;MACrEvD;IACJ;EACJ,CAAC,CAAC;AACN","ignoreList":[]}
1
+ {"version":3,"names":["_path","_interopRequireDefault","require","pulumi","_interopRequireWildcard","aws","_pulumi2","_lambdaUtils","_2","_awsUtils","_constants","_SyncSystemDynamo","SyncSystemLambda","exports","createAppModule","name","config","app","_","policy","createSyncSystemLambdaPolicy","primary","fileManagerBucketId","dynamoDbTableArn","secondary","role","createLambdaRole","output","syncSystemLambda","addResource","lambda","Function","runtime","LAMBDA_RUNTIME","handler","arn","timeout","memorySize","code","asset","AssetArchive","FileArchive","path","join","paths","workspace","environment","variables","getCommonLambdaEnvVariables","apply","value","AWS_NODEJS_CONNECTION_REUSE_ENABLED","vpcConfig","getModule","VpcConfig","functionVpcConfig","functions","syncSystem","params","dynamoDbTable","SyncSystemDynamo","awsAccountId","getAwsAccountId","awsRegion","getAwsRegion","Version","Statement","Sid","Effect","Action","Resource","interpolate","iam","Policy","description"],"sources":["SyncSystemLambda.ts"],"sourcesContent":["import path from \"path\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport type { PulumiApp, PulumiAppModule } from \"@webiny/pulumi\";\nimport { createAppModule } from \"@webiny/pulumi\";\nimport { createLambdaRole, getCommonLambdaEnvVariables } from \"../lambdaUtils\";\nimport { VpcConfig } from \"~/apps\";\nimport { getAwsAccountId, getAwsRegion } from \"../awsUtils\";\nimport { LAMBDA_RUNTIME } from \"~/constants\";\nimport { SyncSystemDynamo } from \"./SyncSystemDynamo\";\n\nexport interface SyncSystemLambdaParams {\n protect: boolean;\n config: Record<string, string>;\n}\n\nexport type SyncSystemLambda = PulumiAppModule<typeof SyncSystemLambda>;\n\nexport const SyncSystemLambda = createAppModule({\n name: \"SyncSystemLambda\",\n // eslint-disable-next-line\n config(app: PulumiApp, _: SyncSystemLambdaParams) {\n const policy = createSyncSystemLambdaPolicy({\n app,\n // TODO - get bucket ids and dynamodb tables from the FileManager app\n primary: {\n fileManagerBucketId: \"primaryFileManagerBucketId\",\n dynamoDbTableArn: \"\"\n },\n secondary: {\n fileManagerBucketId: \"secondaryFileManagerBucketId\",\n dynamoDbTableArn: \"\"\n }\n });\n const role = createLambdaRole(app, {\n name: \"sync-system-lambda-role\",\n policy: policy.output\n });\n\n const syncSystemLambda = app.addResource(aws.lambda.Function, {\n name: \"sync-system-lambda\",\n config: {\n runtime: LAMBDA_RUNTIME,\n handler: \"handler.handler\",\n role: role.output.arn,\n timeout: 900,\n memorySize: 1024,\n code: new pulumi.asset.AssetArchive({\n \".\": new pulumi.asset.FileArchive(\n path.join(app.paths.workspace, \"transfer/build\")\n )\n }),\n environment: {\n variables: getCommonLambdaEnvVariables().apply(value => ({\n ...value,\n AWS_NODEJS_CONNECTION_REUSE_ENABLED: \"1\"\n }))\n },\n vpcConfig: app.getModule(VpcConfig).functionVpcConfig\n }\n });\n\n return {\n role,\n policy,\n functions: {\n syncSystem: syncSystemLambda\n }\n };\n }\n});\n\ninterface ICreateSyncSystemLambdaPolicyParamsType {\n fileManagerBucketId: string;\n dynamoDbTableArn: string;\n}\n\ninterface ICreateSyncSystemLambdaPolicyParams {\n app: PulumiApp;\n primary: ICreateSyncSystemLambdaPolicyParamsType;\n secondary: ICreateSyncSystemLambdaPolicyParamsType;\n}\n\nfunction createSyncSystemLambdaPolicy(params: ICreateSyncSystemLambdaPolicyParams) {\n const { app, primary, secondary } = params;\n const dynamoDbTable = app.getModule(SyncSystemDynamo);\n const awsAccountId = getAwsAccountId(app);\n const awsRegion = getAwsRegion(app);\n\n const policy: aws.iam.PolicyDocument = {\n Version: \"2012-10-17\",\n Statement: [\n {\n Sid: \"PermissionForDynamodb\",\n Effect: \"Allow\",\n Action: [\n \"dynamodb:BatchGetItem\",\n \"dynamodb:BatchWriteItem\",\n \"dynamodb:ConditionCheckItem\",\n \"dynamodb:CreateBackup\",\n \"dynamodb:CreateTable\",\n \"dynamodb:CreateTableReplica\",\n \"dynamodb:DeleteBackup\",\n \"dynamodb:DeleteItem\",\n \"dynamodb:DeleteTable\",\n \"dynamodb:DeleteTableReplica\",\n \"dynamodb:DescribeBackup\",\n \"dynamodb:DescribeContinuousBackups\",\n \"dynamodb:DescribeContributorInsights\",\n \"dynamodb:DescribeExport\",\n \"dynamodb:DescribeKinesisStreamingDestination\",\n \"dynamodb:DescribeLimits\",\n \"dynamodb:DescribeReservedCapacity\",\n \"dynamodb:DescribeReservedCapacityOfferings\",\n \"dynamodb:DescribeStream\",\n \"dynamodb:DescribeTable\",\n \"dynamodb:DescribeTableReplicaAutoScaling\",\n \"dynamodb:DescribeTimeToLive\",\n \"dynamodb:DisableKinesisStreamingDestination\",\n \"dynamodb:EnableKinesisStreamingDestination\",\n \"dynamodb:ExportTableToPointInTime\",\n \"dynamodb:GetItem\",\n \"dynamodb:GetRecords\",\n \"dynamodb:GetShardIterator\",\n \"dynamodb:ListBackups\",\n \"dynamodb:ListContributorInsights\",\n \"dynamodb:ListExports\",\n \"dynamodb:ListStreams\",\n \"dynamodb:ListTables\",\n \"dynamodb:ListTagsOfResource\",\n \"dynamodb:PartiQLDelete\",\n \"dynamodb:PartiQLInsert\",\n \"dynamodb:PartiQLSelect\",\n \"dynamodb:PartiQLUpdate\",\n \"dynamodb:PurchaseReservedCapacityOfferings\",\n \"dynamodb:PutItem\",\n \"dynamodb:Query\",\n \"dynamodb:RestoreTableFromBackup\",\n \"dynamodb:RestoreTableToPointInTime\",\n \"dynamodb:Scan\",\n \"dynamodb:UpdateContinuousBackups\",\n \"dynamodb:UpdateContributorInsights\",\n \"dynamodb:UpdateItem\",\n \"dynamodb:UpdateTable\",\n \"dynamodb:UpdateTableReplicaAutoScaling\",\n \"dynamodb:UpdateTimeToLive\"\n ],\n Resource: [`${dynamoDbTable.output.arn}`, `${dynamoDbTable.output.arn}/*`]\n },\n {\n Sid: \"PermissionForS3\",\n Effect: \"Allow\",\n Action: [\n \"s3:ListBucket\",\n \"s3:GetObjectAcl\",\n \"s3:DeleteObject\",\n \"s3:PutObjectAcl\",\n \"s3:PutObject\",\n \"s3:GetObject\"\n ],\n Resource: [\n pulumi.interpolate`arn:aws:s3:::${primary.fileManagerBucketId}`,\n pulumi.interpolate`arn:aws:s3:::${primary.fileManagerBucketId}/*`,\n pulumi.interpolate`arn:aws:s3:::${secondary.fileManagerBucketId}`,\n pulumi.interpolate`arn:aws:s3:::${secondary.fileManagerBucketId}/*`\n ]\n },\n {\n Sid: \"PermissionForLambda\",\n Effect: \"Allow\",\n Action: [\"lambda:InvokeFunction\"],\n Resource: pulumi.interpolate`arn:aws:lambda:${awsRegion}:${awsAccountId}:function:*`\n }\n ]\n };\n\n return app.addResource(aws.iam.Policy, {\n name: \"SyncSystemLambdaPolicy\",\n config: {\n description: \"This policy enables access to Dynamodb, S3 and Lambda.\",\n policy\n }\n });\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,GAAA,GAAAD,uBAAA,CAAAF,OAAA;AAEA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA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ACrEvD;IACJ;EACJ,CAAC,CAAC;AACN","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import type { PulumiAppModule } from "@webiny/pulumi";
2
+ export type SyncSystemOutput = PulumiAppModule<typeof SyncSystemOutput>;
3
+ export declare const SyncSystemOutput: import("@webiny/pulumi").PulumiAppModuleDefinition<import("@pulumi/pulumi").Output<import("@pulumi/pulumi").UnwrappedObject<import("./types").IGetSyncSystemOutputResult> | null>, void>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SyncSystemOutput = void 0;
7
+ var _pulumi = require("@webiny/pulumi");
8
+ var _getSyncSystemOutput = require("./getSyncSystemOutput.js");
9
+ const SyncSystemOutput = exports.SyncSystemOutput = (0, _pulumi.createAppModule)({
10
+ name: "SyncSystemOutput",
11
+ config(app) {
12
+ return app.addHandler(async () => {
13
+ const output = (0, _getSyncSystemOutput.getSyncSystemOutput)({
14
+ env: app.params.run.env
15
+ });
16
+ const keys = Object.keys(output || {});
17
+ if (keys.length === 0) {
18
+ console.log("Sync System application is not deployed.");
19
+ return null;
20
+ }
21
+ return output;
22
+ });
23
+ }
24
+ });
25
+
26
+ //# sourceMappingURL=SyncSystemOutput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_pulumi","require","_getSyncSystemOutput","SyncSystemOutput","exports","createAppModule","name","config","app","addHandler","output","getSyncSystemOutput","env","params","run","keys","Object","length","console","log"],"sources":["SyncSystemOutput.ts"],"sourcesContent":["import type { PulumiAppModule } from \"@webiny/pulumi\";\nimport { createAppModule } from \"@webiny/pulumi\";\nimport { getSyncSystemOutput } from \"~/apps/syncSystem/getSyncSystemOutput.js\";\n\nexport type SyncSystemOutput = PulumiAppModule<typeof SyncSystemOutput>;\n\nexport const SyncSystemOutput = createAppModule({\n name: \"SyncSystemOutput\",\n config(app) {\n return app.addHandler(async () => {\n const output = getSyncSystemOutput({\n env: app.params.run.env\n });\n\n const keys = Object.keys(output || {});\n\n if (keys.length === 0) {\n console.log(\"Sync System application is not deployed.\");\n return null;\n }\n return output;\n });\n }\n});\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AAIO,MAAME,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,IAAAE,uBAAe,EAAC;EAC5CC,IAAI,EAAE,kBAAkB;EACxBC,MAAMA,CAACC,GAAG,EAAE;IACR,OAAOA,GAAG,CAACC,UAAU,CAAC,YAAY;MAC9B,MAAMC,MAAM,GAAG,IAAAC,wCAAmB,EAAC;QAC/BC,GAAG,EAAEJ,GAAG,CAACK,MAAM,CAACC,GAAG,CAACF;MACxB,CAAC,CAAC;MAEF,MAAMG,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACL,MAAM,IAAI,CAAC,CAAC,CAAC;MAEtC,IAAIK,IAAI,CAACE,MAAM,KAAK,CAAC,EAAE;QACnBC,OAAO,CAACC,GAAG,CAAC,0CAA0C,CAAC;QACvD,OAAO,IAAI;MACf;MACA,OAAOT,MAAM;IACjB,CAAC,CAAC;EACN;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ import type { PulumiAppModule } from "@webiny/pulumi";
2
+ export type SyncSystemResolverLambda = PulumiAppModule<typeof SyncSystemResolverLambda>;
3
+ export declare const SyncSystemResolverLambda: import("@webiny/pulumi").PulumiAppModuleDefinition<{
4
+ role: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/iam/role.js").Role>;
5
+ policy: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/iam/policy.js").Policy>;
6
+ lambda: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/lambda/function.js").Function>;
7
+ eventSourceMapping: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/lambda/eventSourceMapping.js").EventSourceMapping>;
8
+ }, void>;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.SyncSystemResolverLambda = void 0;
9
+ var _path = _interopRequireDefault(require("path"));
10
+ var aws = _interopRequireWildcard(require("@pulumi/aws"));
11
+ var _pulumi = require("@webiny/pulumi");
12
+ var _lambdaUtils = require("../lambdaUtils.js");
13
+ var _constants = require("../../constants.js");
14
+ var _createSyncSystemResolverLambdaPolicy = require("./lambda/createSyncSystemResolverLambdaPolicy.js");
15
+ var _createSyncResourceName = require("./createSyncResourceName.js");
16
+ var _createAssetArchive = require("../../utils/createAssetArchive.js");
17
+ var _SyncSystemSQS = require("./SyncSystemSQS.js");
18
+ var _SyncSystemDynamoDb = require("./SyncSystemDynamoDb.js");
19
+ var _SyncSystemWorkerLambda = require("./SyncSystemWorkerLambda.js");
20
+ const SyncSystemResolverLambda = exports.SyncSystemResolverLambda = (0, _pulumi.createAppModule)({
21
+ name: "SyncSystemResolverLambda",
22
+ config(app) {
23
+ const {
24
+ sqsQueue
25
+ } = app.getModule(_SyncSystemSQS.SyncSystemSQS);
26
+ const dynamoDb = app.getModule(_SyncSystemDynamoDb.SyncSystemDynamoDb);
27
+ const {
28
+ lambda: workerLambda
29
+ } = app.getModule(_SyncSystemWorkerLambda.SyncSystemWorkerLambda);
30
+ const roleName = (0, _createSyncResourceName.createSyncResourceName)("resolver-lambda-role");
31
+ const policy = (0, _createSyncSystemResolverLambdaPolicy.createSyncSystemResolverLambdaPolicy)({
32
+ name: `${roleName}-policy`,
33
+ app
34
+ });
35
+ const role = (0, _lambdaUtils.createLambdaRoleWithoutVpc)(app, {
36
+ name: roleName,
37
+ policy: policy.output
38
+ });
39
+ const lambda = app.addResource(aws.lambda.Function, {
40
+ name: (0, _createSyncResourceName.createSyncResourceName)("resolver-lambda"),
41
+ config: {
42
+ runtime: _constants.LAMBDA_RUNTIME,
43
+ handler: "handler.handler",
44
+ role: role.output.arn,
45
+ timeout: 900,
46
+ memorySize: 512,
47
+ code: (0, _createAssetArchive.createAssetArchive)(_path.default.join(app.paths.workspace, "resolver/build")),
48
+ environment: {
49
+ variables: {
50
+ DB_TABLE: dynamoDb.output.name,
51
+ AWS_SYNC_WORKER_LAMBDA_ARN: workerLambda.output.arn,
52
+ DEBUG: String(process.env.DEBUG),
53
+ PULUMI_APPS: "true",
54
+ AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
55
+ }
56
+ }
57
+ }
58
+ });
59
+ const eventSourceMapping = app.addResource(aws.lambda.EventSourceMapping, {
60
+ name: (0, _createSyncResourceName.createSyncResourceName)("sqs-to-resolver-lambda"),
61
+ config: {
62
+ enabled: true,
63
+ eventSourceArn: sqsQueue.output.arn,
64
+ functionName: lambda.output.arn,
65
+ batchSize: 1
66
+ // maximumBatchingWindowInSeconds: 2
67
+ }
68
+ });
69
+ return {
70
+ role,
71
+ policy,
72
+ lambda,
73
+ eventSourceMapping
74
+ };
75
+ }
76
+ });
77
+
78
+ //# sourceMappingURL=SyncSystemResolverLambda.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_path","_interopRequireDefault","require","aws","_interopRequireWildcard","_pulumi","_lambdaUtils","_constants","_createSyncSystemResolverLambdaPolicy","_createSyncResourceName","_createAssetArchive","_SyncSystemSQS","_SyncSystemDynamoDb","_SyncSystemWorkerLambda","SyncSystemResolverLambda","exports","createAppModule","name","config","app","sqsQueue","getModule","SyncSystemSQS","dynamoDb","SyncSystemDynamoDb","lambda","workerLambda","SyncSystemWorkerLambda","roleName","createSyncResourceName","policy","createSyncSystemResolverLambdaPolicy","role","createLambdaRoleWithoutVpc","output","addResource","Function","runtime","LAMBDA_RUNTIME","handler","arn","timeout","memorySize","code","createAssetArchive","path","join","paths","workspace","environment","variables","DB_TABLE","AWS_SYNC_WORKER_LAMBDA_ARN","DEBUG","String","process","env","PULUMI_APPS","AWS_NODEJS_CONNECTION_REUSE_ENABLED","eventSourceMapping","EventSourceMapping","enabled","eventSourceArn","functionName","batchSize"],"sources":["SyncSystemResolverLambda.ts"],"sourcesContent":["import path from \"path\";\nimport * as aws from \"@pulumi/aws\";\nimport type { PulumiApp, PulumiAppModule } from \"@webiny/pulumi\";\nimport { createAppModule } from \"@webiny/pulumi\";\nimport { createLambdaRoleWithoutVpc } from \"../lambdaUtils.js\";\nimport { LAMBDA_RUNTIME } from \"~/constants.js\";\nimport { createSyncSystemResolverLambdaPolicy } from \"./lambda/createSyncSystemResolverLambdaPolicy.js\";\nimport { createSyncResourceName } from \"./createSyncResourceName.js\";\nimport { createAssetArchive } from \"~/utils/createAssetArchive.js\";\nimport { SyncSystemSQS } from \"./SyncSystemSQS.js\";\nimport { SyncSystemDynamoDb } from \"~/apps/syncSystem/SyncSystemDynamoDb.js\";\nimport { SyncSystemWorkerLambda } from \"~/apps/syncSystem/SyncSystemWorkerLambda.js\";\n\nexport type SyncSystemResolverLambda = PulumiAppModule<typeof SyncSystemResolverLambda>;\n\nexport const SyncSystemResolverLambda = createAppModule({\n name: \"SyncSystemResolverLambda\",\n config(app: PulumiApp) {\n const { sqsQueue } = app.getModule(SyncSystemSQS);\n const dynamoDb = app.getModule(SyncSystemDynamoDb);\n\n const { lambda: workerLambda } = app.getModule(SyncSystemWorkerLambda);\n\n const roleName = createSyncResourceName(\"resolver-lambda-role\");\n const policy = createSyncSystemResolverLambdaPolicy({\n name: `${roleName}-policy`,\n app\n });\n const role = createLambdaRoleWithoutVpc(app, {\n name: roleName,\n policy: policy.output\n });\n\n const lambda = app.addResource(aws.lambda.Function, {\n name: createSyncResourceName(\"resolver-lambda\"),\n config: {\n runtime: LAMBDA_RUNTIME,\n handler: \"handler.handler\",\n role: role.output.arn,\n timeout: 900,\n memorySize: 512,\n code: createAssetArchive(path.join(app.paths.workspace, \"resolver/build\")),\n environment: {\n variables: {\n DB_TABLE: dynamoDb.output.name,\n AWS_SYNC_WORKER_LAMBDA_ARN: workerLambda.output.arn,\n DEBUG: String(process.env.DEBUG),\n PULUMI_APPS: \"true\",\n AWS_NODEJS_CONNECTION_REUSE_ENABLED: \"1\"\n }\n }\n }\n });\n\n const eventSourceMapping = app.addResource(aws.lambda.EventSourceMapping, {\n name: createSyncResourceName(\"sqs-to-resolver-lambda\"),\n config: {\n enabled: true,\n eventSourceArn: sqsQueue.output.arn,\n functionName: lambda.output.arn,\n batchSize: 1\n // maximumBatchingWindowInSeconds: 2\n }\n });\n\n return {\n role,\n policy,\n lambda,\n eventSourceMapping\n };\n }\n});\n"],"mappings":";;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,qCAAA,GAAAN,OAAA;AACA,IAAAO,uBAAA,GAAAP,OAAA;AACA,IAAAQ,mBAAA,GAAAR,OAAA;AACA,IAAAS,cAAA,GAAAT,OAAA;AACA,IAAAU,mBAAA,GAAAV,OAAA;AACA,IAAAW,uBAAA,GAAAX,OAAA;AAIO,MAAMY,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA,GAAG,IAAAE,uBAAe,EAAC;EACpDC,IAAI,EAAE,0BAA0B;EAChCC,MAAMA,CAACC,GAAc,EAAE;IACnB,MAAM;MAAEC;IAAS,CAAC,GAAGD,GAAG,CAACE,SAAS,CAACC,4BAAa,CAAC;IACjD,MAAMC,QAAQ,GAAGJ,GAAG,CAACE,SAAS,CAACG,sCAAkB,CAAC;IAElD,MAAM;MAAEC,MAAM,EAAEC;IAAa,CAAC,GAAGP,GAAG,CAACE,SAAS,CAACM,8CAAsB,CAAC;IAEtE,MAAMC,QAAQ,GAAG,IAAAC,8CAAsB,EAAC,sBAAsB,CAAC;IAC/D,MAAMC,MAAM,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QACnCuB,YAAY,EAAEtC,MAAM,CAACS,MAAM,CAACM,GAAG;QAC/BwB,SAAS,EAAE;QACX;MACJ;IACJ,CAAC,CAAC;IAEF,OAAO;MACHhC,IAAI;MACJF,MAAM;MACNL,MAAM;MACNkC;IACJ,CAAC;EACL;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- export interface ISyncSystemSQSParams {
2
- protect: boolean;
3
- }
4
- export declare const SyncSystemSQS: import("@webiny/pulumi").PulumiAppModuleDefinition<import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/sqs/queue").Queue>, ISyncSystemSQSParams>;
1
+ export declare const SyncSystemSQS: import("@webiny/pulumi").PulumiAppModuleDefinition<{
2
+ sqsQueue: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/sqs/queue.js").Queue>;
3
+ }, void>;
@@ -7,33 +7,54 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.SyncSystemSQS = void 0;
8
8
  var aws = _interopRequireWildcard(require("@pulumi/aws"));
9
9
  var _pulumi = require("@webiny/pulumi");
10
+ var _createSyncResourceName = require("./createSyncResourceName.js");
10
11
  const SyncSystemSQS = exports.SyncSystemSQS = (0, _pulumi.createAppModule)({
11
12
  name: "SyncSystemSQS",
12
- config: (app, params) => {
13
+ config: app => {
13
14
  const config = {
15
+ /**
16
+ * We must name the SQS queue with a ".fifo" suffix to enable FIFO functionality.
17
+ * If we add .fifo to a resource name, it will fail because pulumi adds some random generated id + .fifo to the end of the name.
18
+ * ... and there cannot be two .fifo in the name.
19
+ */
20
+ name: `${(0, _createSyncResourceName.createSyncResourceName)("sqs")}.fifo`,
14
21
  delaySeconds: 0,
22
+ /**
23
+ * 5 minutes should be enough for the message to be processed.
24
+ */
15
25
  visibilityTimeoutSeconds: 900,
16
26
  fifoQueue: true,
17
27
  receiveWaitTimeSeconds: 0,
28
+ deduplicationScope: "queue",
18
29
  /**
19
30
  * The maximum message size is 256 KB.
20
- * Is it enough? If not, we can use S3 to store the message and only store the reference in the queue.
31
+ * Chunks are billed in 64KB increments, so let's keep the message size below that.
21
32
  */
22
- maxMessageSize: 262144,
23
- // max
33
+ maxMessageSize: 60 * 1024,
34
+ // KB
24
35
  /**
25
36
  * How log do we keep the message in the queue?
26
- * Something is very wrong if the message is not processed within 4 days... :/
27
37
  */
28
- messageRetentionSeconds: 345600 // default - 4 days
38
+ messageRetentionSeconds: 4 /* days */ * 24 * 60 * 60,
39
+ /**
40
+ * No need to encrypt the message as nothing outside the system can actually read it.
41
+ */
42
+ sqsManagedSseEnabled: false,
43
+ /**
44
+ * We want to make sure that no message is sent more than once.
45
+ *
46
+ * TODO: determine if the criteria by which will we create a hash for the ID.
47
+ * TODO: must set "MessageDeduplicationId" property when creating the message.
48
+ */
49
+ contentBasedDeduplication: true
29
50
  };
30
- return app.addResource(aws.sqs.Queue, {
31
- name: "sync-sqs",
32
- config,
33
- opts: {
34
- protect: params.protect
35
- }
51
+ const sqsQueue = app.addResource(aws.sqs.Queue, {
52
+ name: `${(0, _createSyncResourceName.createSyncResourceName)("sqs")}`,
53
+ config
36
54
  });
55
+ return {
56
+ sqsQueue
57
+ };
37
58
  }
38
59
  });
39
60
 
@@ -1 +1 @@
1
- {"version":3,"names":["aws","_interopRequireWildcard","require","_pulumi","SyncSystemSQS","exports","createAppModule","name","config","app","params","delaySeconds","visibilityTimeoutSeconds","fifoQueue","receiveWaitTimeSeconds","maxMessageSize","messageRetentionSeconds","addResource","sqs","Queue","opts","protect"],"sources":["SyncSystemSQS.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport type { QueueArgs } from \"@pulumi/aws/sqs\";\nimport type { PulumiApp } from \"@webiny/pulumi\";\nimport { createAppModule } from \"@webiny/pulumi\";\n\nexport interface ISyncSystemSQSParams {\n protect: boolean;\n}\n\nexport const SyncSystemSQS = createAppModule({\n name: \"SyncSystemSQS\",\n config: (app: PulumiApp, params: ISyncSystemSQSParams) => {\n const config: QueueArgs = {\n delaySeconds: 0,\n visibilityTimeoutSeconds: 900,\n fifoQueue: true,\n receiveWaitTimeSeconds: 0,\n /**\n * The maximum message size is 256 KB.\n * Is it enough? If not, we can use S3 to store the message and only store the reference in the queue.\n */\n maxMessageSize: 262144, // max\n /**\n * How log do we keep the message in the queue?\n * Something is very wrong if the message is not processed within 4 days... :/\n */\n messageRetentionSeconds: 345600 // default - 4 days\n };\n return app.addResource(aws.sqs.Queue, {\n name: \"sync-sqs\",\n config,\n opts: {\n protect: params.protect\n }\n });\n }\n});\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,OAAA,GAAAD,OAAA;AAMO,MAAME,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG,IAAAE,uBAAe,EAAC;EACzCC,IAAI,EAAE,eAAe;EACrBC,MAAM,EAAEA,CAACC,GAAc,EAAEC,MAA4B,KAAK;IACtD,MAAMF,MAAiB,GAAG;MACtBG,YAAY,EAAE,CAAC;MACfC,wBAAwB,EAAE,GAAG;MAC7BC,SAAS,EAAE,IAAI;MACfC,sBAAsB,EAAE,CAAC;MACzB;AACZ;AACA;AACA;MACYC,cAAc,EAAE,MAAM;MAAE;MACxB;AACZ;AACA;AACA;MACYC,uBAAuB,EAAE,MAAM,CAAC;IACpC,CAAC;IACD,OAAOP,GAAG,CAACQ,WAAW,CAACjB,GAAG,CAACkB,GAAG,CAACC,KAAK,EAAE;MAClCZ,IAAI,EAAE,UAAU;MAChBC,MAAM;MACNY,IAAI,EAAE;QACFC,OAAO,EAAEX,MAAM,CAACW;MACpB;IACJ,CAAC,CAAC;EACN;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["aws","_interopRequireWildcard","require","_pulumi","_createSyncResourceName","SyncSystemSQS","exports","createAppModule","name","config","app","createSyncResourceName","delaySeconds","visibilityTimeoutSeconds","fifoQueue","receiveWaitTimeSeconds","deduplicationScope","maxMessageSize","messageRetentionSeconds","sqsManagedSseEnabled","contentBasedDeduplication","sqsQueue","addResource","sqs","Queue"],"sources":["SyncSystemSQS.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport type { QueueArgs } from \"@pulumi/aws/sqs\";\nimport type { PulumiApp } from \"@webiny/pulumi\";\nimport { createAppModule } from \"@webiny/pulumi\";\nimport { createSyncResourceName } from \"./createSyncResourceName.js\";\n\nexport const SyncSystemSQS = createAppModule({\n name: \"SyncSystemSQS\",\n config: (app: PulumiApp) => {\n const config: QueueArgs = {\n /**\n * We must name the SQS queue with a \".fifo\" suffix to enable FIFO functionality.\n * If we add .fifo to a resource name, it will fail because pulumi adds some random generated id + .fifo to the end of the name.\n * ... and there cannot be two .fifo in the name.\n */\n name: `${createSyncResourceName(\"sqs\")}.fifo`,\n delaySeconds: 0,\n /**\n * 5 minutes should be enough for the message to be processed.\n */\n visibilityTimeoutSeconds: 900,\n fifoQueue: true,\n receiveWaitTimeSeconds: 0,\n deduplicationScope: \"queue\",\n /**\n * The maximum message size is 256 KB.\n * Chunks are billed in 64KB increments, so let's keep the message size below that.\n */\n maxMessageSize: 60 * 1024, // KB\n /**\n * How log do we keep the message in the queue?\n */\n messageRetentionSeconds: 4 /* days */ * 24 * 60 * 60,\n /**\n * No need to encrypt the message as nothing outside the system can actually read it.\n */\n sqsManagedSseEnabled: false,\n /**\n * We want to make sure that no message is sent more than once.\n *\n * TODO: determine if the criteria by which will we create a hash for the ID.\n * TODO: must set \"MessageDeduplicationId\" property when creating the message.\n */\n contentBasedDeduplication: true\n };\n\n const sqsQueue = app.addResource(aws.sqs.Queue, {\n name: `${createSyncResourceName(\"sqs\")}`,\n config\n });\n\n return {\n sqsQueue\n };\n }\n});\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,uBAAA,GAAAF,OAAA;AAEO,MAAMG,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG,IAAAE,uBAAe,EAAC;EACzCC,IAAI,EAAE,eAAe;EACrBC,MAAM,EAAGC,GAAc,IAAK;IACxB,MAAMD,MAAiB,GAAG;MACtB;AACZ;AACA;AACA;AACA;MACYD,IAAI,EAAE,GAAG,IAAAG,8CAAsB,EAAC,KAAK,CAAC,OAAO;MAC7CC,YAAY,EAAE,CAAC;MACf;AACZ;AACA;MACYC,wBAAwB,EAAE,GAAG;MAC7BC,SAAS,EAAE,IAAI;MACfC,sBAAsB,EAAE,CAAC;MACzBC,kBAAkB,EAAE,OAAO;MAC3B;AACZ;AACA;AACA;MACYC,cAAc,EAAE,EAAE,GAAG,IAAI;MAAE;MAC3B;AACZ;AACA;MACYC,uBAAuB,EAAE,CAAC,CAAC,aAAa,EAAE,GAAG,EAAE,GAAG,EAAE;MACpD;AACZ;AACA;MACYC,oBAAoB,EAAE,KAAK;MAC3B;AACZ;AACA;AACA;AACA;AACA;MACYC,yBAAyB,EAAE;IAC/B,CAAC;IAED,MAAMC,QAAQ,GAAGX,GAAG,CAACY,WAAW,CAACtB,GAAG,CAACuB,GAAG,CAACC,KAAK,EAAE;MAC5ChB,IAAI,EAAE,GAAG,IAAAG,8CAAsB,EAAC,KAAK,CAAC,EAAE;MACxCF;IACJ,CAAC,CAAC;IAEF,OAAO;MACHY;IACJ,CAAC;EACL;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import type { PulumiAppModule } from "@webiny/pulumi";
2
+ export type SyncSystemWorkerLambda = PulumiAppModule<typeof SyncSystemWorkerLambda>;
3
+ export declare const SyncSystemWorkerLambda: import("@webiny/pulumi").PulumiAppModuleDefinition<{
4
+ role: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/iam/role.js").Role>;
5
+ policy: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/iam/rolePolicyAttachment.js").RolePolicyAttachment>;
6
+ lambda: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/lambda/function.js").Function>;
7
+ }, void>;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.SyncSystemWorkerLambda = void 0;
9
+ var _path = _interopRequireDefault(require("path"));
10
+ var aws = _interopRequireWildcard(require("@pulumi/aws"));
11
+ var _pulumi = require("@webiny/pulumi");
12
+ var _constants = require("../../constants.js");
13
+ var _createSyncResourceName = require("./createSyncResourceName.js");
14
+ var _createAssetArchive = require("../../utils/createAssetArchive.js");
15
+ var _lambdaUtils = require("../lambdaUtils.js");
16
+ const SyncSystemWorkerLambda = exports.SyncSystemWorkerLambda = (0, _pulumi.createAppModule)({
17
+ name: "SyncSystemWorkerLambda",
18
+ config(app) {
19
+ const lambdaName = (0, _createSyncResourceName.createSyncResourceName)("worker-lambda");
20
+ const roleName = `${lambdaName}-role`;
21
+ const role = (0, _lambdaUtils.createLambdaRoleWithoutVpc)(app, {
22
+ name: roleName
23
+ });
24
+ const policy = app.addResource(aws.iam.RolePolicyAttachment, {
25
+ name: `${roleName}-policy-attachment`,
26
+ config: {
27
+ role: role.output.name,
28
+ policyArn: aws.iam.ManagedPolicies.AWSLambdaBasicExecutionRole
29
+ }
30
+ });
31
+ const lambda = app.addResource(aws.lambda.Function, {
32
+ name: lambdaName,
33
+ config: {
34
+ runtime: _constants.LAMBDA_RUNTIME,
35
+ handler: "handler.handler",
36
+ role: role.output.arn,
37
+ timeout: 900,
38
+ memorySize: 512,
39
+ code: (0, _createAssetArchive.createAssetArchive)(_path.default.join(app.paths.workspace, "worker/build")),
40
+ environment: {
41
+ variables: {
42
+ DEBUG: String(process.env.DEBUG),
43
+ PULUMI_APPS: "true",
44
+ AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
45
+ }
46
+ }
47
+ }
48
+ });
49
+ return {
50
+ role,
51
+ policy,
52
+ lambda
53
+ };
54
+ }
55
+ });
56
+
57
+ //# sourceMappingURL=SyncSystemWorkerLambda.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_path","_interopRequireDefault","require","aws","_interopRequireWildcard","_pulumi","_constants","_createSyncResourceName","_createAssetArchive","_lambdaUtils","SyncSystemWorkerLambda","exports","createAppModule","name","config","app","lambdaName","createSyncResourceName","roleName","role","createLambdaRoleWithoutVpc","policy","addResource","iam","RolePolicyAttachment","output","policyArn","ManagedPolicies","AWSLambdaBasicExecutionRole","lambda","Function","runtime","LAMBDA_RUNTIME","handler","arn","timeout","memorySize","code","createAssetArchive","path","join","paths","workspace","environment","variables","DEBUG","String","process","env","PULUMI_APPS","AWS_NODEJS_CONNECTION_REUSE_ENABLED"],"sources":["SyncSystemWorkerLambda.ts"],"sourcesContent":["import path from \"path\";\nimport * as aws from \"@pulumi/aws\";\nimport type { PulumiApp, PulumiAppModule } from \"@webiny/pulumi\";\nimport { createAppModule } from \"@webiny/pulumi\";\nimport { LAMBDA_RUNTIME } from \"~/constants.js\";\nimport { createSyncResourceName } from \"./createSyncResourceName.js\";\nimport { createAssetArchive } from \"~/utils/createAssetArchive.js\";\nimport { createLambdaRoleWithoutVpc } from \"~/apps/lambdaUtils.js\";\n\nexport type SyncSystemWorkerLambda = PulumiAppModule<typeof SyncSystemWorkerLambda>;\n\nexport const SyncSystemWorkerLambda = createAppModule({\n name: \"SyncSystemWorkerLambda\",\n config(app: PulumiApp) {\n const lambdaName = createSyncResourceName(\"worker-lambda\");\n const roleName = `${lambdaName}-role`;\n\n const role = createLambdaRoleWithoutVpc(app, {\n name: roleName\n });\n\n const policy = app.addResource(aws.iam.RolePolicyAttachment, {\n name: `${roleName}-policy-attachment`,\n config: {\n role: role.output.name,\n policyArn: aws.iam.ManagedPolicies.AWSLambdaBasicExecutionRole\n }\n });\n\n const lambda = app.addResource(aws.lambda.Function, {\n name: lambdaName,\n config: {\n runtime: LAMBDA_RUNTIME,\n handler: \"handler.handler\",\n role: role.output.arn,\n timeout: 900,\n memorySize: 512,\n code: createAssetArchive(path.join(app.paths.workspace, \"worker/build\")),\n environment: {\n variables: {\n DEBUG: String(process.env.DEBUG),\n PULUMI_APPS: \"true\",\n AWS_NODEJS_CONNECTION_REUSE_ENABLED: \"1\"\n }\n }\n }\n });\n\n return {\n role,\n policy,\n lambda\n };\n }\n});\n"],"mappings":";;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,uBAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAIO,MAAMQ,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,IAAAE,uBAAe,EAAC;EAClDC,IAAI,EAAE,wBAAwB;EAC9BC,MAAMA,CAACC,GAAc,EAAE;IACnB,MAAMC,UAAU,GAAG,IAAAC,8CAAsB,EAAC,eAAe,CAAC;IAC1D,MAAMC,QAAQ,GAAG,GAAGF,UAAU,OAAO;IAErC,MAAMG,IAAI,GAAG,IAAAC,uCAA0B,EAACL,GAAG,EAAE;MACzCF,IAAI,EAAEK;IACV,CAAC,CAAC;IAEF,MAAMG,MAAM,GAAGN,GAAG,CAACO,WAAW,CAACnB,GAAG,CAACoB,GAAG,CAACC,oBAAoB,EAAE;MACzDX,IAAI,EAAE,GAAGK,QAAQ,oBAAoB;MACrCJ,MAAM,EAAE;QACJK,IAAI,EAAEA,IAAI,CAACM,MAAM,CAACZ,IAAI;QACtBa,SAAS,EAAEvB,GAAG,CAACoB,GAAG,CAACI,eAAe,CAACC;MACvC;IACJ,CAAC,CAAC;IAEF,MAAMC,MAAM,GAAGd,GAAG,CAACO,WAAW,CAACnB,GAAG,CAAC0B,MAAM,CAACC,QAAQ,EAAE;MAChDjB,IAAI,EAAEG,UAAU;MAChBF,MAAM,EAAE;QACJiB,OAAO,EAAEC,yBAAc;QACvBC,OAAO,EAAE,iBAAiB;QAC1Bd,IAAI,EAAEA,IAAI,CAACM,MAAM,CAACS,GAAG;QACrBC,OAAO,EAAE,GAAG;QACZC,UAAU,EAAE,GAAG;QACfC,IAAI,EAAE,IAAAC,sCAAkB,EAACC,aAAI,CAACC,IAAI,CAACzB,GAAG,CAAC0B,KAAK,CAACC,SAAS,EAAE,cAAc,CAAC,CAAC;QACxEC,WAAW,EAAE;UACTC,SAAS,EAAE;YACPC,KAAK,EAAEC,MAAM,CAACC,OAAO,CAACC,GAAG,CAACH,KAAK,CAAC;YAChCI,WAAW,EAAE,MAAM;YACnBC,mCAAmC,EAAE;UACzC;QACJ;MACJ;IACJ,CAAC,CAAC;IAEF,OAAO;MACH/B,IAAI;MACJE,MAAM;MACNQ;IACJ,CAAC;EACL;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ import type { PulumiApp } from "@webiny/pulumi";
2
+ import type { IGetSyncSystemOutputResult } from "../types.js";
3
+ import type { WithServiceManifest } from "../../../utils/withServiceManifest.js";
4
+ export interface IAddServiceManifestParams {
5
+ app: PulumiApp & WithServiceManifest;
6
+ syncSystem: IGetSyncSystemOutputResult;
7
+ }
8
+ export declare const addServiceManifest: (params: IAddServiceManifestParams) => void;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.addServiceManifest = void 0;
7
+ const addServiceManifest = params => {
8
+ const {
9
+ app,
10
+ syncSystem
11
+ } = params;
12
+ app.addHandler(() => {
13
+ app.addServiceManifest({
14
+ name: "sync",
15
+ manifest: {
16
+ eventBusArn: syncSystem.eventBusArn,
17
+ eventBusName: syncSystem.eventBusName,
18
+ region: syncSystem.region
19
+ }
20
+ });
21
+ });
22
+ };
23
+ exports.addServiceManifest = addServiceManifest;
24
+
25
+ //# sourceMappingURL=addServiceManifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["addServiceManifest","params","app","syncSystem","addHandler","name","manifest","eventBusArn","eventBusName","region","exports"],"sources":["addServiceManifest.ts"],"sourcesContent":["import type { PulumiApp } from \"@webiny/pulumi\";\nimport type { IGetSyncSystemOutputResult } from \"~/apps/syncSystem/types.js\";\nimport type { WithServiceManifest } from \"~/utils/withServiceManifest.js\";\n\nexport interface IAddServiceManifestParams {\n app: PulumiApp & WithServiceManifest;\n syncSystem: IGetSyncSystemOutputResult;\n}\n\nexport const addServiceManifest = (params: IAddServiceManifestParams) => {\n const { app, syncSystem } = params;\n\n app.addHandler(() => {\n app.addServiceManifest({\n name: \"sync\",\n manifest: {\n eventBusArn: syncSystem.eventBusArn,\n eventBusName: syncSystem.eventBusName,\n region: syncSystem.region\n }\n });\n });\n};\n"],"mappings":";;;;;;AASO,MAAMA,kBAAkB,GAAIC,MAAiC,IAAK;EACrE,MAAM;IAAEC,GAAG;IAAEC;EAAW,CAAC,GAAGF,MAAM;EAElCC,GAAG,CAACE,UAAU,CAAC,MAAM;IACjBF,GAAG,CAACF,kBAAkB,CAAC;MACnBK,IAAI,EAAE,MAAM;MACZC,QAAQ,EAAE;QACNC,WAAW,EAAEJ,UAAU,CAACI,WAAW;QACnCC,YAAY,EAAEL,UAAU,CAACK,YAAY;QACrCC,MAAM,EAAEN,UAAU,CAACM;MACvB;IACJ,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAV,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ import type { PulumiApp } from "@webiny/pulumi";
2
+ import type { WithServiceManifest } from "../../../utils/withServiceManifest.js";
3
+ import type { IGetSyncSystemOutputResult } from "../types.js";
4
+ import type { CoreOutput } from "../../index.js";
5
+ export interface IAttachCognitoPermissionsParams {
6
+ app: PulumiApp & WithServiceManifest;
7
+ syncSystem: IGetSyncSystemOutputResult;
8
+ core: CoreOutput;
9
+ }
10
+ export declare const attachCognitoPermissions: (params: IAttachCognitoPermissionsParams) => {
11
+ cognitoPolicy: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/iam/policy").Policy>;
12
+ workerLambdaS3PolicyAttachment: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/iam/rolePolicyAttachment").RolePolicyAttachment>;
13
+ resolverLambdaS3PolicyAttachment: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/iam/rolePolicyAttachment").RolePolicyAttachment>;
14
+ } | null;