@webiny/pulumi-aws 0.0.0-mt-2 → 0.0.0-unstable.5e7233243f

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 (139) hide show
  1. package/README.md +317 -5
  2. package/apps/admin/createAdminPulumiApp.d.ts +20 -0
  3. package/apps/admin/createAdminPulumiApp.js +25 -0
  4. package/apps/admin/createAdminPulumiApp.js.map +1 -0
  5. package/apps/admin/index.d.ts +1 -0
  6. package/apps/admin/index.js +18 -0
  7. package/apps/admin/index.js.map +1 -0
  8. package/apps/api/ApiApwScheduler.d.ts +21 -0
  9. package/apps/api/ApiApwScheduler.js +246 -0
  10. package/apps/api/ApiApwScheduler.js.map +1 -0
  11. package/apps/api/ApiCloudfront.d.ts +4 -0
  12. package/apps/api/ApiCloudfront.js +103 -0
  13. package/apps/api/ApiCloudfront.js.map +1 -0
  14. package/apps/api/ApiFileManager.d.ts +11 -0
  15. package/apps/api/ApiFileManager.js +171 -0
  16. package/apps/api/ApiFileManager.js.map +1 -0
  17. package/apps/api/ApiGateway.d.ts +19 -0
  18. package/apps/api/ApiGateway.js +90 -0
  19. package/apps/api/ApiGateway.js.map +1 -0
  20. package/apps/api/ApiGraphql.d.ts +26 -0
  21. package/apps/api/ApiGraphql.js +173 -0
  22. package/apps/api/ApiGraphql.js.map +1 -0
  23. package/apps/api/ApiHeadlessCMS.d.ts +14 -0
  24. package/apps/api/ApiHeadlessCMS.js +100 -0
  25. package/apps/api/ApiHeadlessCMS.js.map +1 -0
  26. package/apps/api/ApiOutput.d.ts +15 -0
  27. package/apps/api/ApiOutput.js +43 -0
  28. package/apps/api/ApiOutput.js.map +1 -0
  29. package/apps/api/ApiPageBuilder.d.ts +25 -0
  30. package/apps/api/ApiPageBuilder.js +253 -0
  31. package/apps/api/ApiPageBuilder.js.map +1 -0
  32. package/apps/api/createApiPulumiApp.d.ts +67 -0
  33. package/apps/api/createApiPulumiApp.js +176 -0
  34. package/apps/api/createApiPulumiApp.js.map +1 -0
  35. package/apps/api/index.d.ts +9 -0
  36. package/apps/api/index.js +122 -0
  37. package/apps/api/index.js.map +1 -0
  38. package/apps/awsUtils.d.ts +3 -0
  39. package/apps/awsUtils.js +25 -0
  40. package/apps/awsUtils.js.map +1 -0
  41. package/apps/common/CoreOutput.d.ts +21 -0
  42. package/apps/common/CoreOutput.js +50 -0
  43. package/apps/common/CoreOutput.js.map +1 -0
  44. package/apps/common/VpcConfig.d.ts +8 -0
  45. package/apps/common/VpcConfig.js +37 -0
  46. package/apps/common/VpcConfig.js.map +1 -0
  47. package/apps/common/index.d.ts +2 -0
  48. package/apps/common/index.js +31 -0
  49. package/apps/common/index.js.map +1 -0
  50. package/apps/core/CoreCognito.d.ts +11 -0
  51. package/apps/core/CoreCognito.js +102 -0
  52. package/apps/core/CoreCognito.js.map +1 -0
  53. package/apps/core/CoreDynamo.d.ts +6 -0
  54. package/apps/core/CoreDynamo.js +53 -0
  55. package/apps/core/CoreDynamo.js.map +1 -0
  56. package/apps/core/CoreElasticSearch.d.ts +16 -0
  57. package/apps/core/CoreElasticSearch.js +285 -0
  58. package/apps/core/CoreElasticSearch.js.map +1 -0
  59. package/apps/core/CoreEventBus.d.ts +2 -0
  60. package/apps/core/CoreEventBus.js +27 -0
  61. package/apps/core/CoreEventBus.js.map +1 -0
  62. package/apps/core/CoreFileManager.d.ts +9 -0
  63. package/apps/core/CoreFileManager.js +57 -0
  64. package/apps/core/CoreFileManager.js.map +1 -0
  65. package/apps/core/CoreOpenSearch.d.ts +20 -0
  66. package/apps/core/CoreOpenSearch.js +264 -0
  67. package/apps/core/CoreOpenSearch.js.map +1 -0
  68. package/apps/core/CoreVpc.d.ts +10 -0
  69. package/apps/core/CoreVpc.js +145 -0
  70. package/apps/core/CoreVpc.js.map +1 -0
  71. package/apps/core/createCorePulumiApp.d.ts +56 -0
  72. package/apps/core/createCorePulumiApp.js +98 -0
  73. package/apps/core/createCorePulumiApp.js.map +1 -0
  74. package/apps/core/index.d.ts +6 -0
  75. package/apps/core/index.js +83 -0
  76. package/apps/core/index.js.map +1 -0
  77. package/apps/createAppBucket.d.ts +13 -0
  78. package/apps/createAppBucket.js +108 -0
  79. package/apps/createAppBucket.js.map +1 -0
  80. package/apps/customDomain.d.ts +9 -0
  81. package/apps/customDomain.js +14 -0
  82. package/apps/customDomain.js.map +1 -0
  83. package/apps/index.d.ts +7 -0
  84. package/apps/index.js +100 -0
  85. package/apps/index.js.map +1 -0
  86. package/apps/lambdaUtils.d.ts +10 -0
  87. package/apps/lambdaUtils.js +81 -0
  88. package/apps/lambdaUtils.js.map +1 -0
  89. package/apps/react/createReactPulumiApp.d.ts +29 -0
  90. package/apps/react/createReactPulumiApp.js +111 -0
  91. package/apps/react/createReactPulumiApp.js.map +1 -0
  92. package/apps/react/index.d.ts +1 -0
  93. package/apps/react/index.js +18 -0
  94. package/apps/react/index.js.map +1 -0
  95. package/apps/tenantRouter.d.ts +3 -0
  96. package/apps/tenantRouter.js +119 -0
  97. package/apps/tenantRouter.js.map +1 -0
  98. package/apps/website/WebsitePrerendering.d.ts +40 -0
  99. package/apps/website/WebsitePrerendering.js +305 -0
  100. package/apps/website/WebsitePrerendering.js.map +1 -0
  101. package/apps/website/createWebsitePulumiApp.d.ts +70 -0
  102. package/apps/website/createWebsitePulumiApp.js +240 -0
  103. package/apps/website/createWebsitePulumiApp.js.map +1 -0
  104. package/apps/website/deliveryViewerRequest.d.ts +2 -0
  105. package/apps/website/deliveryViewerRequest.js +32 -0
  106. package/apps/website/deliveryViewerRequest.js.map +1 -0
  107. package/apps/website/index.d.ts +1 -0
  108. package/apps/website/index.js +18 -0
  109. package/apps/website/index.js.map +1 -0
  110. package/components/tenantRouter/WebsiteTenantRouter.d.ts +1 -0
  111. package/components/tenantRouter/WebsiteTenantRouter.js +9 -13
  112. package/components/tenantRouter/WebsiteTenantRouter.js.map +1 -0
  113. package/components/tenantRouter/functions/origin/request.js +98 -11
  114. package/components/tenantRouter/functions/origin/request.js.map +1 -0
  115. package/index.d.ts +2 -0
  116. package/index.js +32 -1
  117. package/index.js.map +1 -0
  118. package/package.json +22 -15
  119. package/utils/crawlDirectory.d.ts +1 -0
  120. package/utils/crawlDirectory.js +35 -0
  121. package/utils/crawlDirectory.js.map +1 -0
  122. package/utils/getPresignedPost.d.ts +11 -0
  123. package/utils/getPresignedPost.js +46 -0
  124. package/utils/getPresignedPost.js.map +1 -0
  125. package/utils/index.d.ts +3 -0
  126. package/utils/index.js +51 -0
  127. package/utils/index.js.map +1 -0
  128. package/utils/lambdaEnvVariables.d.ts +20 -0
  129. package/utils/lambdaEnvVariables.js +84 -0
  130. package/utils/lambdaEnvVariables.js.map +1 -0
  131. package/utils/storageMigrate.d.ts +0 -0
  132. package/utils/storageMigrate.js +292 -0
  133. package/utils/storageMigrate.js.map +1 -0
  134. package/utils/tagResources.d.ts +5 -0
  135. package/utils/tagResources.js +49 -0
  136. package/utils/tagResources.js.map +1 -0
  137. package/utils/uploadFolderToS3.d.ts +26 -0
  138. package/utils/uploadFolderToS3.js +193 -0
  139. package/utils/uploadFolderToS3.js.map +1 -0
package/README.md CHANGED
@@ -1,16 +1,328 @@
1
- # @webiny/pulumi-aws
1
+ # `@webiny/pulumi-aws`
2
2
 
3
3
  [![](https://img.shields.io/npm/dw/@webiny/pulumi-aws.svg)](https://www.npmjs.com/package/@webiny/pulumi-aws)
4
4
  [![](https://img.shields.io/npm/v/@webiny/pulumi-aws.svg)](https://www.npmjs.com/package/@webiny/pulumi-aws)
5
5
  [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
6
6
  [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
7
7
 
8
- A set of custom Pulumi components for Webiny.
8
+ A set of Pulumi apps that deploy Webiny CMS into Amazon Web Services (AWS).
9
9
 
10
- ### Example
10
+ ## Table of Contents
11
+
12
+ - [Installation](#installation)
13
+ - [Overview](#overview)
14
+ - [Examples](#examples)
15
+ - [Reference](#reference)
16
+ - [Apps](#functions)
17
+ - [`createCoreApp`](#createCoreApp)
18
+ - [`createApiApp`](#createApiApp)
19
+ - [`createAdminApp`](#createAdminApp)
20
+ - [`createWebsiteApp`](#createWebsiteApp)
21
+
22
+ ## Installation
23
+
24
+ ```
25
+ npm install --save @webiny/pulumi-aws
26
+ ```
27
+
28
+ Or if you prefer yarn:
29
+
30
+ ```
31
+ yarn add @webiny/pulumi-aws
32
+ ```
33
+
34
+ ## Overview
35
+
36
+ A set of Pulumi apps that deploy Webiny CMS into Amazon Web Services (AWS).
37
+
38
+ > 💡 **TIP**
39
+ >
40
+ > Pulumi apps included in this package are automatically included in every Webiny project that's configured to be deployed into Amazon Web Services (AWS).
41
+
42
+ ## Examples
43
+
44
+ | Example | Description |
45
+ | --------------------------------- | --------------------------------------------------------------- |
46
+ | [Initialization and Running the Apps](./docs/examples/initializationAndRunningTheApps.md) | Shows how the included apps are initialized and run. |
47
+
48
+ ## Reference
49
+
50
+ ### Apps
51
+
52
+ #### `createCoreApp`
53
+
54
+ <details>
55
+ <summary>Type Declaration</summary>
56
+ <p>
57
+
58
+ ```ts
59
+ export interface CreateCoreAppParams {
60
+ /**
61
+ * Secures against deleting database by accident.
62
+ * By default enabled in production environments.
63
+ */
64
+ protect?: PulumiAppParam<boolean>;
65
+ /**
66
+ * Enables ElasticSearch infrastructure.
67
+ * Note that it requires also changes in application code.
68
+ */
69
+ elasticSearch?: PulumiAppParam<boolean>;
70
+ /**
71
+ * Enables VPC for the application.
72
+ * By default enabled in production environments.
73
+ */
74
+ vpc?: PulumiAppParam<boolean>;
75
+ /**
76
+ * Additional settings for backwards compatibility.
77
+ */
78
+ legacy?: PulumiAppParam<CoreAppLegacyConfig>;
79
+
80
+ pulumi?: (app: ReturnType<typeof createStoragePulumiApp>) => void;
81
+ }
82
+
83
+ export interface CoreAppLegacyConfig {
84
+ useEmailAsUsername?: boolean;
85
+ }
86
+
87
+ export declare function createCoreApp(projectAppParams?: CreateCoreAppParams): import("@webiny/pulumi").PulumiApp<{
88
+ fileManagerBucket: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/s3").Bucket>;
89
+ eventBus: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudwatch").EventBus>;
90
+ elasticSearch: {
91
+ domain: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/elasticsearch").Domain>;
92
+ domainPolicy: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/elasticsearch").DomainPolicy>;
93
+ table: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/dynamodb").Table>;
94
+ dynamoToElastic: {
95
+ role: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/iam").Role>;
96
+ policy: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/iam").Policy>;
97
+ lambda: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/lambda").Function>;
98
+ eventSourceMapping: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/lambda").EventSourceMapping>;
99
+ };
100
+ } | null;
101
+ userPool: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cognito").UserPool>;
102
+ userPoolClient: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cognito").UserPoolClient>;
103
+ dynamoDbTable: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/dynamodb").Table>;
104
+ vpc: {
105
+ vpc: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/ec2").Vpc>;
106
+ subnets: {
107
+ public: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/ec2").Subnet>[];
108
+ private: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/ec2").Subnet>[];
109
+ };
110
+ } | null;
111
+ }>;
112
+ ```
113
+
114
+ </p>
115
+ </details>
116
+
117
+ Creates Storage Pulumi app.
11
118
 
12
119
  ```ts
13
- import { WebsiteTenantRouter } from "@webiny/pulumi-aws";
120
+ // This is imported in our Pulumi program's entrypoint file (index.ts).
121
+ import { createStoragePulumiApp } from "@webiny/pulumi-aws";
122
+
123
+ export = async () => {
124
+ const coreApp = createCoreApp();
125
+
126
+ return coreApp.run();
127
+ };
128
+ ```
129
+
130
+ #### `createApiApp`
131
+
132
+ <details>
133
+ <summary>Type Declaration</summary>
134
+ <p>
135
+
136
+ ```ts
137
+ export interface CreateApiAppParams {
138
+ /**
139
+ * Enables or disables VPC for the API.
140
+ * For VPC to work you also have to enable it in the Storage application.
141
+ */
142
+ vpc?: PulumiAppParam<boolean>;
143
+ /** Custom domain configuration */
144
+ domain?(app: PulumiApp): CustomDomainParams | undefined | void;
145
+ pulumi?: (app: ReturnType<typeof createApiPulumiApp>) => void;
146
+ }
147
+
148
+ export declare const createApiPulumiApp: (projectAppParams?: CreateApiAppParams) => PulumiApp<{
149
+ fileManager: {
150
+ functions: {
151
+ transform: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/lambda").Function>;
152
+ manage: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/lambda").Function>;
153
+ download: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/lambda").Function>;
154
+ };
155
+ bucketNotification: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/s3").BucketNotification>;
156
+ };
157
+ graphql: {
158
+ role: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/iam").Role>;
159
+ policy: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/iam").Policy>;
160
+ functions: {
161
+ graphql: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/lambda").Function>;
162
+ };
163
+ };
164
+ headlessCms: {
165
+ role: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/iam").Role>;
166
+ policy: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/iam").Policy>;
167
+ functions: {
168
+ graphql: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/lambda").Function>;
169
+ };
170
+ };
171
+ apiGateway: {
172
+ api: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2").Api>;
173
+ stage: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2").Stage>;
174
+ routes: Record<string, {
175
+ integration: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2").Integration>;
176
+ route: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2").Route>;
177
+ permission: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/lambda").Permission>;
178
+ }>;
179
+ addRoute: (name: string, params: import("..").ApiRouteParams) => void;
180
+ };
181
+ cloudfront: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudfront").Distribution>;
182
+ apwScheduler: {
183
+ executeAction: {
184
+ role: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/iam").Role>;
185
+ policy: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/iam").Policy>;
186
+ lambda: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/lambda").Function>;
187
+ };
188
+ scheduleAction: {
189
+ role: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/iam").Role>;
190
+ policy: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/iam").Policy>;
191
+ lambda: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/lambda").Function>;
192
+ };
193
+ eventRule: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudwatch").EventRule>;
194
+ eventTarget: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudwatch").EventTarget>;
195
+ };
196
+ }>;
197
+ ```
198
+
199
+ </p>
200
+ </details>
201
+
202
+ Creates API Pulumi app.
203
+
204
+ ```ts
205
+ // This is imported in our Pulumi program's entrypoint file (index.ts).
206
+ import { createApiPulumiApp } from "@webiny/pulumi-aws";
207
+
208
+ export = async () => {
209
+ const apiApp = createApiApp();
210
+
211
+ return apiApp.run();
212
+ };
213
+ ```
214
+
215
+ #### `createAdminApp`
216
+
217
+ <details>
218
+ <summary>Type Declaration</summary>
219
+ <p>
220
+
221
+ ```ts
222
+ import * as aws from "@pulumi/aws";
223
+ import { PulumiApp } from "@webiny/pulumi";
224
+ import { CustomDomainParams } from "../customDomain";
225
+
226
+ export interface CreateAdminAppParams {
227
+ /** Custom domain configuration */
228
+ domain?(app: PulumiApp): CustomDomainParams | undefined | void;
229
+ pulumi?: (app: ReturnType<typeof createAdminPulumiApp>) => void;
230
+ }
231
+
232
+ export declare const createAdminPulumiApp: (projectAppParams: CreateAdminAppParams) => PulumiApp<{
233
+ cloudfront: import("@webiny/pulumi").PulumiAppResource<typeof aws.cloudfront.Distribution>;
234
+ bucket: import("@webiny/pulumi").PulumiAppResource<typeof aws.s3.Bucket>;
235
+ origin: aws.types.input.cloudfront.DistributionOrigin;
236
+ }>;
237
+ ```
238
+
239
+ </p>
240
+ </details>
241
+
242
+ Creates Admin Pulumi app.
243
+
244
+ ```ts
245
+ // This is imported in our Pulumi program's entrypoint file (index.ts).
246
+ import { createAdminPulumiApp } from "@webiny/pulumi-aws";
247
+
248
+ export = async () => {
249
+ const adminApp = createAdminApp();
250
+
251
+ return adminApp.run();
252
+ };
253
+ ```
254
+
255
+ #### `createWebsiteApp`
256
+
257
+ <details>
258
+ <summary>Type Declaration</summary>
259
+ <p>
260
+
261
+ ```ts
262
+ import * as pulumi from "@pulumi/pulumi";
263
+ import * as aws from "@pulumi/aws";
264
+ import { PulumiApp, PulumiAppParam } from "@webiny/pulumi";
265
+ import { CustomDomainParams } from "../customDomain";
266
+ export interface CreateWebsiteAppParams {
267
+ /** Custom domain configuration */
268
+ domain?(app: PulumiApp): CustomDomainParams | undefined | void;
269
+ /**
270
+ * Enables or disables VPC for the API.
271
+ * For VPC to work you also have to enable it in the `storage` application.
272
+ */
273
+ vpc?: PulumiAppParam<boolean | undefined>;
274
+ pulumi?: (app: ReturnType<typeof createWebsitePulumiApp>) => void;
275
+ }
276
+ export declare const createWebsitePulumiApp: (projectAppParams?: CreateWebsiteAppParams) => PulumiApp<{
277
+ prerendering: {
278
+ subscriber: {
279
+ policy: pulumi.Output<aws.iam.Policy>;
280
+ role: import("@webiny/pulumi").PulumiAppResource<typeof aws.iam.Role>;
281
+ lambda: import("@webiny/pulumi").PulumiAppResource<typeof aws.lambda.Function>;
282
+ eventRule: import("@webiny/pulumi").PulumiAppResource<typeof aws.cloudwatch.EventRule>;
283
+ eventPermission: import("@webiny/pulumi").PulumiAppResource<typeof aws.lambda.Permission>;
284
+ eventTarget: import("@webiny/pulumi").PulumiAppResource<typeof aws.cloudwatch.EventTarget>;
285
+ };
286
+ renderer: {
287
+ policy: pulumi.Output<aws.iam.Policy>;
288
+ role: import("@webiny/pulumi").PulumiAppResource<typeof aws.iam.Role>;
289
+ lambda: import("@webiny/pulumi").PulumiAppResource<typeof aws.lambda.Function>;
290
+ eventSourceMapping: import("@webiny/pulumi").PulumiAppResource<typeof aws.lambda.EventSourceMapping>;
291
+ };
292
+ flush: {
293
+ policy: pulumi.Output<aws.iam.Policy>;
294
+ role: import("@webiny/pulumi").PulumiAppResource<typeof aws.iam.Role>;
295
+ lambda: import("@webiny/pulumi").PulumiAppResource<typeof aws.lambda.Function>;
296
+ eventRule: import("@webiny/pulumi").PulumiAppResource<typeof aws.cloudwatch.EventRule>;
297
+ eventPermission: import("@webiny/pulumi").PulumiAppResource<typeof aws.lambda.Permission>;
298
+ eventTarget: import("@webiny/pulumi").PulumiAppResource<typeof aws.cloudwatch.EventTarget>;
299
+ };
300
+ };
301
+ app: {
302
+ cloudfront: import("@webiny/pulumi").PulumiAppResource<typeof aws.cloudfront.Distribution>;
303
+ bucket: import("@webiny/pulumi").PulumiAppResource<typeof aws.s3.Bucket>;
304
+ origin: aws.types.input.cloudfront.DistributionOrigin;
305
+ };
306
+ delivery: {
307
+ cloudfront: import("@webiny/pulumi").PulumiAppResource<typeof aws.cloudfront.Distribution>;
308
+ bucket: import("@webiny/pulumi").PulumiAppResource<typeof aws.s3.Bucket>;
309
+ origin: aws.types.input.cloudfront.DistributionOrigin;
310
+ };
311
+ }>;
312
+ ```
313
+
314
+ </p>
315
+ </details>
316
+
317
+ Creates Website Pulumi app.
318
+
319
+ ```ts
320
+ // This is imported in our Pulumi program's entrypoint file (index.ts).
321
+ import { createWebsitePulumiApp } from "@webiny/pulumi-aws";
322
+
323
+ export = async () => {
324
+ const websiteApp = createWebsiteApp();
14
325
 
15
- const router = new WebsiteTenantRouter("tenant-router");
326
+ return websiteApp.run();
327
+ };
16
328
  ```
@@ -0,0 +1,20 @@
1
+ import { PulumiAppParamCallback } from "@webiny/pulumi";
2
+ import { createReactPulumiApp, CustomDomainParams } from "..";
3
+ export declare type AdminPulumiApp = ReturnType<typeof createReactPulumiApp>;
4
+ export interface CreateAdminPulumiAppParams {
5
+ /** Custom domain configuration */
6
+ domains?: PulumiAppParamCallback<CustomDomainParams>;
7
+ /**
8
+ * Provides a way to adjust existing Pulumi code (cloud infrastructure resources)
9
+ * or add additional ones into the mix.
10
+ */
11
+ pulumi?: (app: AdminPulumiApp) => void | Promise<void>;
12
+ }
13
+ export declare const createAdminPulumiApp: (projectAppParams: CreateAdminPulumiAppParams) => import("@webiny/pulumi").PulumiApp<{
14
+ cloudfront: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudfront").Distribution>;
15
+ bucket: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/s3").Bucket>;
16
+ originIdentity: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudfront").OriginAccessIdentity>;
17
+ origin: import("@pulumi/aws/types/input").cloudfront.DistributionOrigin;
18
+ bucketPublicAccessBlock: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/s3").BucketPublicAccessBlock>;
19
+ bucketPolicy: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/s3").BucketPolicy>;
20
+ }>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.createAdminPulumiApp = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _ = require("./..");
13
+
14
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
+
16
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
+
18
+ const createAdminPulumiApp = projectAppParams => {
19
+ return (0, _.createReactPulumiApp)(_objectSpread({
20
+ name: "admin",
21
+ folder: "apps/admin"
22
+ }, projectAppParams));
23
+ };
24
+
25
+ exports.createAdminPulumiApp = createAdminPulumiApp;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createAdminPulumiApp","projectAppParams","createReactPulumiApp","name","folder"],"sources":["createAdminPulumiApp.ts"],"sourcesContent":["import { PulumiAppParamCallback } from \"@webiny/pulumi\";\nimport { createReactPulumiApp, CustomDomainParams } from \"~/apps\";\n\nexport type AdminPulumiApp = ReturnType<typeof createReactPulumiApp>;\n\nexport interface CreateAdminPulumiAppParams {\n /** Custom domain configuration */\n domains?: PulumiAppParamCallback<CustomDomainParams>;\n\n /**\n * Provides a way to adjust existing Pulumi code (cloud infrastructure resources)\n * or add additional ones into the mix.\n */\n pulumi?: (app: AdminPulumiApp) => void | Promise<void>;\n}\n\nexport const createAdminPulumiApp = (projectAppParams: CreateAdminPulumiAppParams) => {\n return createReactPulumiApp({\n name: \"admin\",\n folder: \"apps/admin\",\n ...projectAppParams\n });\n};\n"],"mappings":";;;;;;;;;;;AACA;;;;;;AAeO,MAAMA,oBAAoB,GAAIC,gBAAD,IAAkD;EAClF,OAAO,IAAAC,sBAAA;IACHC,IAAI,EAAE,OADH;IAEHC,MAAM,EAAE;EAFL,GAGAH,gBAHA,EAAP;AAKH,CANM"}
@@ -0,0 +1 @@
1
+ export * from "./createAdminPulumiApp";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _createAdminPulumiApp = require("./createAdminPulumiApp");
8
+
9
+ Object.keys(_createAdminPulumiApp).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _createAdminPulumiApp[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _createAdminPulumiApp[key];
16
+ }
17
+ });
18
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./createAdminPulumiApp\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -0,0 +1,21 @@
1
+ import * as aws from "@pulumi/aws";
2
+ import { PulumiAppModule } from "@webiny/pulumi";
3
+ interface ScheduleActionParams {
4
+ env: Record<string, any>;
5
+ }
6
+ export declare type ApiApwScheduler = PulumiAppModule<typeof ApiApwScheduler>;
7
+ export declare const ApiApwScheduler: import("@webiny/pulumi").PulumiAppModuleDefinition<{
8
+ executeAction: {
9
+ role: import("@webiny/pulumi").PulumiAppResource<typeof aws.iam.Role>;
10
+ policy: import("@webiny/pulumi").PulumiAppResource<typeof aws.iam.Policy>;
11
+ lambda: import("@webiny/pulumi").PulumiAppResource<typeof aws.lambda.Function>;
12
+ };
13
+ scheduleAction: {
14
+ role: import("@webiny/pulumi").PulumiAppResource<typeof aws.iam.Role>;
15
+ policy: import("@webiny/pulumi").PulumiAppResource<typeof aws.iam.Policy>;
16
+ lambda: import("@webiny/pulumi").PulumiAppResource<typeof aws.lambda.Function>;
17
+ };
18
+ eventRule: import("@webiny/pulumi").PulumiAppResource<typeof aws.cloudwatch.EventRule>;
19
+ eventTarget: import("@webiny/pulumi").PulumiAppResource<typeof aws.cloudwatch.EventTarget>;
20
+ }, ScheduleActionParams>;
21
+ export {};
@@ -0,0 +1,246 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.ApiApwScheduler = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _path = _interopRequireDefault(require("path"));
13
+
14
+ var pulumi = _interopRequireWildcard(require("@pulumi/pulumi"));
15
+
16
+ var aws = _interopRequireWildcard(require("@pulumi/aws"));
17
+
18
+ var _pulumi2 = require("@webiny/pulumi");
19
+
20
+ var _common = require("../common");
21
+
22
+ var _lambdaUtils = require("../lambdaUtils");
23
+
24
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
+
26
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
+
28
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
29
+
30
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
31
+
32
+ const LAMBDA_NAME_PREFIX = "apw-scheduler";
33
+ const CREATE_RULE_LAMBDA = `${LAMBDA_NAME_PREFIX}-schedule-action-lambda`;
34
+ const EXECUTE_ACTION_LAMBDA = `${LAMBDA_NAME_PREFIX}-execute-action-lambda`;
35
+ const EVENT_RULE_NAME = `${LAMBDA_NAME_PREFIX}-event-rule`;
36
+ const EVENT_RULE_TARGET = `${LAMBDA_NAME_PREFIX}-event-rule-target`;
37
+ const ApiApwScheduler = (0, _pulumi2.createAppModule)({
38
+ name: "ApiApwScheduler",
39
+
40
+ config(app, params) {
41
+ const executeAction = createExecuteActionLambda(app, params);
42
+ const scheduleAction = createScheduleActionLambda(app, executeAction.lambda.output, params); // Create event rule.
43
+
44
+ const eventRule = app.addResource(aws.cloudwatch.EventRule, {
45
+ name: EVENT_RULE_NAME,
46
+ config: {
47
+ description: `Enable us to schedule an action in publishing workflow at a particular datetime`,
48
+ scheduleExpression: "cron(* * * * ? 2000)",
49
+ isEnabled: true
50
+ }
51
+ }); // Add required permission to the target lambda.
52
+
53
+ app.addResource(aws.lambda.Permission, {
54
+ name: "eventTargetPermission",
55
+ config: {
56
+ action: "lambda:InvokeFunction",
57
+ function: scheduleAction.lambda.output.arn,
58
+ principal: "events.amazonaws.com",
59
+ statementId: "allow-rule-invoke-" + EVENT_RULE_NAME
60
+ }
61
+ }); // Add lambda as target to the event rule.
62
+
63
+ const eventTarget = app.addResource(aws.cloudwatch.EventTarget, {
64
+ name: EVENT_RULE_TARGET,
65
+ config: {
66
+ rule: eventRule.output.name,
67
+ arn: scheduleAction.lambda.output.arn
68
+ }
69
+ });
70
+ return {
71
+ executeAction,
72
+ scheduleAction,
73
+ eventRule,
74
+ eventTarget
75
+ };
76
+ }
77
+
78
+ });
79
+ exports.ApiApwScheduler = ApiApwScheduler;
80
+
81
+ function createExecuteActionLambda(app, params) {
82
+ const role = app.addResource(aws.iam.Role, {
83
+ name: `${EXECUTE_ACTION_LAMBDA}-role`,
84
+ config: {
85
+ assumeRolePolicy: {
86
+ Version: "2012-10-17",
87
+ Statement: [{
88
+ Action: "sts:AssumeRole",
89
+ Principal: {
90
+ Service: "lambda.amazonaws.com"
91
+ },
92
+ Effect: "Allow"
93
+ }]
94
+ }
95
+ }
96
+ });
97
+ const policy = createExecuteActionLambdaPolicy(app);
98
+ app.addResource(aws.iam.RolePolicyAttachment, {
99
+ name: `${EXECUTE_ACTION_LAMBDA}-role-policy-attachment`,
100
+ config: {
101
+ role: role.output,
102
+ policyArn: policy.output.arn
103
+ }
104
+ });
105
+ app.addResource(aws.iam.RolePolicyAttachment, {
106
+ name: `${EXECUTE_ACTION_LAMBDA}-AWSLambdaBasicExecutionRole`,
107
+ config: {
108
+ role: role.output,
109
+ policyArn: aws.iam.ManagedPolicy.AWSLambdaBasicExecutionRole
110
+ }
111
+ });
112
+ const lambda = app.addResource(aws.lambda.Function, {
113
+ name: EXECUTE_ACTION_LAMBDA,
114
+ config: {
115
+ role: role.output.arn,
116
+ runtime: "nodejs14.x",
117
+ handler: "handler.handler",
118
+ timeout: 60,
119
+ memorySize: 128,
120
+ description: "Handle execute action workflow in apw scheduler",
121
+ code: new pulumi.asset.AssetArchive({
122
+ ".": new pulumi.asset.FileArchive(_path.default.join(app.paths.workspace, "apw/executeAction/build"))
123
+ }),
124
+ environment: {
125
+ variables: (0, _lambdaUtils.getCommonLambdaEnvVariables)().apply(value => _objectSpread(_objectSpread({}, value), params.env))
126
+ }
127
+ }
128
+ });
129
+ return {
130
+ role,
131
+ policy,
132
+ lambda
133
+ };
134
+ }
135
+
136
+ function createExecuteActionLambdaPolicy(app) {
137
+ const core = app.getModule(_common.CoreOutput);
138
+ return app.addResource(aws.iam.Policy, {
139
+ name: "ApwSchedulerExecuteActionLambdaPolicy",
140
+ config: {
141
+ description: "This policy enables access to cloudwatch event and lambda invocation",
142
+ policy: {
143
+ Version: "2012-10-17",
144
+ Statement: [{
145
+ Sid: "PermissionLambda",
146
+ Effect: "Allow",
147
+ Action: ["lambda:InvokeFunction"],
148
+ Resource: ["*"]
149
+ }, {
150
+ Sid: "PermissionDynamoDB",
151
+ Effect: "Allow",
152
+ Action: ["dynamodb:Query", "dynamodb:GetItem", "dynamodb:DeleteItem"],
153
+ Resource: [pulumi.interpolate`${core.primaryDynamodbTableArn}`, pulumi.interpolate`${core.primaryDynamodbTableArn}/*`]
154
+ }]
155
+ }
156
+ }
157
+ });
158
+ }
159
+
160
+ function createScheduleActionLambda(app, executeLambda, params) {
161
+ const role = app.addResource(aws.iam.Role, {
162
+ name: `${CREATE_RULE_LAMBDA}-role`,
163
+ config: {
164
+ assumeRolePolicy: {
165
+ Version: "2012-10-17",
166
+ Statement: [{
167
+ Action: "sts:AssumeRole",
168
+ Principal: {
169
+ Service: "lambda.amazonaws.com"
170
+ },
171
+ Effect: "Allow"
172
+ }]
173
+ }
174
+ }
175
+ });
176
+ const policy = createScheduleActionLambdaPolicy(app);
177
+ app.addResource(aws.iam.RolePolicyAttachment, {
178
+ name: `${CREATE_RULE_LAMBDA}-role-policy-attachment`,
179
+ config: {
180
+ role: role.output,
181
+ policyArn: policy.output.arn
182
+ }
183
+ });
184
+ app.addResource(aws.iam.RolePolicyAttachment, {
185
+ name: `${CREATE_RULE_LAMBDA}-AWSLambdaBasicExecutionRole`,
186
+ config: {
187
+ role: role.output,
188
+ policyArn: aws.iam.ManagedPolicy.AWSLambdaBasicExecutionRole
189
+ }
190
+ });
191
+ const lambda = app.addResource(aws.lambda.Function, {
192
+ name: CREATE_RULE_LAMBDA,
193
+ config: {
194
+ role: role.output.arn,
195
+ runtime: "nodejs14.x",
196
+ handler: "handler.handler",
197
+ timeout: 60,
198
+ memorySize: 128,
199
+ description: "Handle schedule action workflow in apw scheduler",
200
+ code: new pulumi.asset.AssetArchive({
201
+ ".": new pulumi.asset.FileArchive(_path.default.join(app.paths.workspace, "apw/scheduleAction/build"))
202
+ }),
203
+ environment: {
204
+ variables: (0, _lambdaUtils.getCommonLambdaEnvVariables)().apply(value => _objectSpread(_objectSpread(_objectSpread({}, value), params.env), {}, {
205
+ APW_SCHEDULER_EXECUTE_ACTION_HANDLER: executeLambda.arn // RULE_NAME: this.eventRule.name.apply(name => name),
206
+ // RULE_TARGET_ID: this.eventTarget.targetId.apply(id => id)
207
+
208
+ }))
209
+ }
210
+ }
211
+ });
212
+ return {
213
+ role,
214
+ policy,
215
+ lambda
216
+ };
217
+ }
218
+
219
+ function createScheduleActionLambdaPolicy(app) {
220
+ const core = app.getModule(_common.CoreOutput);
221
+ return app.addResource(aws.iam.Policy, {
222
+ name: "ApwSchedulerScheduleActionLambdaPolicy",
223
+ config: {
224
+ description: "This policy enables access to cloudwatch event and lambda invocation",
225
+ policy: {
226
+ Version: "2012-10-17",
227
+ Statement: [{
228
+ Sid: "PermissionLambda",
229
+ Effect: "Allow",
230
+ Action: ["lambda:InvokeFunction"],
231
+ Resource: ["*"]
232
+ }, {
233
+ Sid: "PermissionDynamoDB",
234
+ Effect: "Allow",
235
+ Action: ["dynamodb:PutItem", "dynamodb:Query", "dynamodb:GetItem", "dynamodb:UpdateItem", "dynamodb:DeleteItem"],
236
+ Resource: [pulumi.interpolate`${core.primaryDynamodbTableArn}`, pulumi.interpolate`${core.primaryDynamodbTableArn}/*`]
237
+ }, {
238
+ Sid: "PermissionEvents",
239
+ Effect: "Allow",
240
+ Action: ["events:DeleteRule", "events:PutTargets", "events:PutRule", "events:ListRules", "events:RemoveTargets", "events:ListTargetsByRule"],
241
+ Resource: ["*"]
242
+ }]
243
+ }
244
+ }
245
+ });
246
+ }