@webiny/pulumi-aws 5.25.0-beta.6 → 5.25.1-beta.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.
- package/apps/admin/AdminApp.d.ts +14 -0
- package/apps/admin/AdminApp.js +134 -0
- package/apps/admin/AdminApp.js.map +1 -0
- package/apps/admin/AdminUpload.d.ts +6 -0
- package/apps/admin/AdminUpload.js +50 -0
- package/apps/admin/AdminUpload.js.map +1 -0
- package/apps/api/ApiApp.d.ts +66 -0
- package/apps/api/ApiApp.js +223 -0
- package/apps/api/ApiApp.js.map +1 -0
- package/apps/api/ApiApwScheduler.d.ts +23 -0
- package/apps/api/ApiApwScheduler.js +240 -0
- package/apps/api/ApiApwScheduler.js.map +1 -0
- package/apps/api/ApiCloudfront.d.ts +4 -0
- package/apps/api/ApiCloudfront.js +103 -0
- package/apps/api/ApiCloudfront.js.map +1 -0
- package/apps/api/ApiFileManager.d.ts +18 -0
- package/apps/api/ApiFileManager.js +168 -0
- package/apps/api/ApiFileManager.js.map +1 -0
- package/apps/api/ApiGateway.d.ts +19 -0
- package/apps/api/ApiGateway.js +90 -0
- package/apps/api/ApiGateway.js.map +1 -0
- package/apps/api/ApiGraphql.d.ts +27 -0
- package/apps/api/ApiGraphql.js +128 -0
- package/apps/api/ApiGraphql.js.map +1 -0
- package/apps/api/ApiHeadlessCMS.d.ts +18 -0
- package/apps/api/ApiHeadlessCMS.js +90 -0
- package/apps/api/ApiHeadlessCMS.js.map +1 -0
- package/apps/api/ApiLambdaUtils.d.ts +11 -0
- package/apps/api/ApiLambdaUtils.js +45 -0
- package/apps/api/ApiLambdaUtils.js.map +1 -0
- package/apps/api/ApiPageBuilder.d.ts +40 -0
- package/apps/api/ApiPageBuilder.js +289 -0
- package/apps/api/ApiPageBuilder.js.map +1 -0
- package/apps/api/ApiPrerendering.d.ts +24 -0
- package/apps/api/ApiPrerendering.js +200 -0
- package/apps/api/ApiPrerendering.js.map +1 -0
- package/apps/api/ApiVpc.d.ts +10 -0
- package/apps/api/ApiVpc.js +129 -0
- package/apps/api/ApiVpc.js.map +1 -0
- package/apps/api/index.d.ts +8 -0
- package/apps/api/index.js +109 -0
- package/apps/api/index.js.map +1 -0
- package/apps/awsUtils.d.ts +3 -0
- package/apps/awsUtils.js +25 -0
- package/apps/awsUtils.js.map +1 -0
- package/apps/createAppBucket.d.ts +13 -0
- package/apps/createAppBucket.js +107 -0
- package/apps/createAppBucket.js.map +1 -0
- package/apps/customDomain.d.ts +9 -0
- package/apps/customDomain.js +14 -0
- package/apps/customDomain.js.map +1 -0
- package/apps/getStorageOutput.d.ts +13 -0
- package/apps/getStorageOutput.js +29 -0
- package/apps/getStorageOutput.js.map +1 -0
- package/apps/index.d.ts +5 -0
- package/apps/index.js +72 -0
- package/apps/index.js.map +1 -0
- package/apps/storage/StorageApp.d.ts +16 -0
- package/apps/storage/StorageApp.js +90 -0
- package/apps/storage/StorageApp.js.map +1 -0
- package/apps/storage/StorageCognito.d.ts +11 -0
- package/apps/storage/StorageCognito.js +102 -0
- package/apps/storage/StorageCognito.js.map +1 -0
- package/apps/storage/StorageDynamo.d.ts +6 -0
- package/apps/storage/StorageDynamo.js +53 -0
- package/apps/storage/StorageDynamo.js.map +1 -0
- package/apps/storage/StorageFileManager.d.ts +6 -0
- package/apps/storage/StorageFileManager.js +40 -0
- package/apps/storage/StorageFileManager.js.map +1 -0
- package/apps/storage/index.d.ts +4 -0
- package/apps/storage/index.js +57 -0
- package/apps/storage/index.js.map +1 -0
- package/apps/website/WebsiteApp.d.ts +22 -0
- package/apps/website/WebsiteApp.js +206 -0
- package/apps/website/WebsiteApp.js.map +1 -0
- package/apps/website/WebsiteHookRender.d.ts +1 -0
- package/apps/website/WebsiteHookRender.js +65 -0
- package/apps/website/WebsiteHookRender.js.map +1 -0
- package/apps/website/WebsiteHookUpdatePbSettings.d.ts +5 -0
- package/apps/website/WebsiteHookUpdatePbSettings.js +80 -0
- package/apps/website/WebsiteHookUpdatePbSettings.js.map +1 -0
- package/apps/website/WebsiteHookUpload.d.ts +1 -0
- package/apps/website/WebsiteHookUpload.js +65 -0
- package/apps/website/WebsiteHookUpload.js.map +1 -0
- package/components/tenantRouter/functions/origin/request.js +54 -8
- package/components/tenantRouter/functions/origin/request.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +18 -1
- package/index.js.map +1 -1
- package/package.json +10 -6
- package/types.d.ts +2 -0
- package/types.js +5 -0
- package/types.js.map +1 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createVpc = createVpc;
|
|
7
|
+
|
|
8
|
+
var aws = _interopRequireWildcard(require("@pulumi/aws"));
|
|
9
|
+
|
|
10
|
+
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); }
|
|
11
|
+
|
|
12
|
+
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; }
|
|
13
|
+
|
|
14
|
+
function createVpc(app) {
|
|
15
|
+
// Create VPC.
|
|
16
|
+
const vpc = app.addResource(aws.ec2.Vpc, {
|
|
17
|
+
name: "webiny",
|
|
18
|
+
config: {
|
|
19
|
+
cidrBlock: "10.0.0.0/16"
|
|
20
|
+
}
|
|
21
|
+
}); // Create one public and two private subnets.
|
|
22
|
+
|
|
23
|
+
const publicSubnet = app.addResource(aws.ec2.Subnet, {
|
|
24
|
+
name: "public",
|
|
25
|
+
config: {
|
|
26
|
+
vpcId: vpc.output.id,
|
|
27
|
+
cidrBlock: "10.0.0.0/24",
|
|
28
|
+
tags: {
|
|
29
|
+
Name: "public-subnet"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const availabilityZones = aws.getAvailabilityZones({
|
|
34
|
+
state: "available"
|
|
35
|
+
});
|
|
36
|
+
const privateSubnet1 = app.addResource(aws.ec2.Subnet, {
|
|
37
|
+
name: "private-subnet-1",
|
|
38
|
+
config: {
|
|
39
|
+
vpcId: vpc.output.id,
|
|
40
|
+
cidrBlock: "10.0.1.0/24",
|
|
41
|
+
availabilityZone: availabilityZones.then(zone => zone.names[0]),
|
|
42
|
+
tags: {
|
|
43
|
+
Name: "private-subnet-1"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
const privateSubnet2 = app.addResource(aws.ec2.Subnet, {
|
|
48
|
+
name: "private-subnet-2",
|
|
49
|
+
config: {
|
|
50
|
+
vpcId: vpc.output.id,
|
|
51
|
+
cidrBlock: "10.0.2.0/24",
|
|
52
|
+
availabilityZone: availabilityZones.then(zone => zone.names[1]),
|
|
53
|
+
tags: {
|
|
54
|
+
Name: "private-subnet-2"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}); // Create Internet gateway.
|
|
58
|
+
|
|
59
|
+
const internetGateway = app.addResource(aws.ec2.InternetGateway, {
|
|
60
|
+
name: "internet-gateway",
|
|
61
|
+
config: {
|
|
62
|
+
vpcId: vpc.output.id
|
|
63
|
+
}
|
|
64
|
+
}); // Create NAT gateway.
|
|
65
|
+
|
|
66
|
+
const elasticIpAllocation = app.addResource(aws.ec2.Eip, {
|
|
67
|
+
name: "nat-gateway-elastic-ip",
|
|
68
|
+
config: {
|
|
69
|
+
vpc: true
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
const natGateway = app.addResource(aws.ec2.NatGateway, {
|
|
73
|
+
name: "nat-gateway",
|
|
74
|
+
config: {
|
|
75
|
+
allocationId: elasticIpAllocation.output.id,
|
|
76
|
+
subnetId: publicSubnet.output.id
|
|
77
|
+
}
|
|
78
|
+
}); // Create a route table for both subnets.
|
|
79
|
+
|
|
80
|
+
const publicSubnetRouteTable = app.addResource(aws.ec2.RouteTable, {
|
|
81
|
+
name: "public",
|
|
82
|
+
config: {
|
|
83
|
+
vpcId: vpc.output.id,
|
|
84
|
+
routes: [{
|
|
85
|
+
cidrBlock: "0.0.0.0/0",
|
|
86
|
+
gatewayId: internetGateway.output.id
|
|
87
|
+
}]
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
const privateSubnetRouteTable = app.addResource(aws.ec2.RouteTable, {
|
|
91
|
+
name: "private",
|
|
92
|
+
config: {
|
|
93
|
+
vpcId: vpc.output.id,
|
|
94
|
+
routes: [{
|
|
95
|
+
cidrBlock: "0.0.0.0/0",
|
|
96
|
+
natGatewayId: natGateway.output.id
|
|
97
|
+
}]
|
|
98
|
+
}
|
|
99
|
+
}); // Create route table associations - links between subnets and route tables.
|
|
100
|
+
|
|
101
|
+
app.addResource(aws.ec2.RouteTableAssociation, {
|
|
102
|
+
name: "public-subnet-route-table-association",
|
|
103
|
+
config: {
|
|
104
|
+
subnetId: publicSubnet.output.id,
|
|
105
|
+
routeTableId: publicSubnetRouteTable.output.id
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
app.addResource(aws.ec2.RouteTableAssociation, {
|
|
109
|
+
name: "private-subnet-1-route-table-association",
|
|
110
|
+
config: {
|
|
111
|
+
subnetId: privateSubnet1.output.id,
|
|
112
|
+
routeTableId: privateSubnetRouteTable.output.id
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
app.addResource(aws.ec2.RouteTableAssociation, {
|
|
116
|
+
name: "private-subnet-2-route-table-association",
|
|
117
|
+
config: {
|
|
118
|
+
subnetId: privateSubnet2.output.id,
|
|
119
|
+
routeTableId: privateSubnetRouteTable.output.id
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
return {
|
|
123
|
+
vpc,
|
|
124
|
+
subnets: {
|
|
125
|
+
public: [publicSubnet],
|
|
126
|
+
private: [privateSubnet1, privateSubnet2]
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ApiVpc.ts"],"names":["createVpc","app","vpc","addResource","aws","ec2","Vpc","name","config","cidrBlock","publicSubnet","Subnet","vpcId","output","id","tags","Name","availabilityZones","getAvailabilityZones","state","privateSubnet1","availabilityZone","then","zone","names","privateSubnet2","internetGateway","InternetGateway","elasticIpAllocation","Eip","natGateway","NatGateway","allocationId","subnetId","publicSubnetRouteTable","RouteTable","routes","gatewayId","privateSubnetRouteTable","natGatewayId","RouteTableAssociation","routeTableId","subnets","public","private"],"mappings":";;;;;;;AAAA;;;;;;AAGO,SAASA,SAAT,CAAmBC,GAAnB,EAAmC;AACtC;AACA,QAAMC,GAAG,GAAGD,GAAG,CAACE,WAAJ,CAAgBC,GAAG,CAACC,GAAJ,CAAQC,GAAxB,EAA6B;AACrCC,IAAAA,IAAI,EAAE,QAD+B;AAErCC,IAAAA,MAAM,EAAE;AACJC,MAAAA,SAAS,EAAE;AADP;AAF6B,GAA7B,CAAZ,CAFsC,CAStC;;AACA,QAAMC,YAAY,GAAGT,GAAG,CAACE,WAAJ,CAAgBC,GAAG,CAACC,GAAJ,CAAQM,MAAxB,EAAgC;AACjDJ,IAAAA,IAAI,EAAE,QAD2C;AAEjDC,IAAAA,MAAM,EAAE;AACJI,MAAAA,KAAK,EAAEV,GAAG,CAACW,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ACLC,MAAAA,MAAM,EAAE,CAACjC,YAAD,CADH;AAELkC,MAAAA,OAAO,EAAE,CAACxB,cAAD,EAAiBK,cAAjB;AAFJ;AAFN,GAAP;AAOH","sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { PulumiApp } from \"@webiny/pulumi-sdk\";\n\nexport function createVpc(app: PulumiApp) {\n // Create VPC.\n const vpc = app.addResource(aws.ec2.Vpc, {\n name: \"webiny\",\n config: {\n cidrBlock: \"10.0.0.0/16\"\n }\n });\n\n // Create one public and two private subnets.\n const publicSubnet = app.addResource(aws.ec2.Subnet, {\n name: \"public\",\n config: {\n vpcId: vpc.output.id,\n cidrBlock: \"10.0.0.0/24\",\n tags: { Name: \"public-subnet\" }\n }\n });\n\n const availabilityZones = aws.getAvailabilityZones({\n state: \"available\"\n });\n\n const privateSubnet1 = app.addResource(aws.ec2.Subnet, {\n name: \"private-subnet-1\",\n config: {\n vpcId: vpc.output.id,\n cidrBlock: \"10.0.1.0/24\",\n availabilityZone: availabilityZones.then(zone => zone.names[0]),\n tags: { Name: \"private-subnet-1\" }\n }\n });\n\n const privateSubnet2 = app.addResource(aws.ec2.Subnet, {\n name: \"private-subnet-2\",\n config: {\n vpcId: vpc.output.id,\n cidrBlock: \"10.0.2.0/24\",\n availabilityZone: availabilityZones.then(zone => zone.names[1]),\n tags: { Name: \"private-subnet-2\" }\n }\n });\n\n // Create Internet gateway.\n const internetGateway = app.addResource(aws.ec2.InternetGateway, {\n name: \"internet-gateway\",\n config: {\n vpcId: vpc.output.id\n }\n });\n\n // Create NAT gateway.\n const elasticIpAllocation = app.addResource(aws.ec2.Eip, {\n name: \"nat-gateway-elastic-ip\",\n config: {\n vpc: true\n }\n });\n\n const natGateway = app.addResource(aws.ec2.NatGateway, {\n name: \"nat-gateway\",\n config: {\n allocationId: elasticIpAllocation.output.id,\n subnetId: publicSubnet.output.id\n }\n });\n\n // Create a route table for both subnets.\n const publicSubnetRouteTable = app.addResource(aws.ec2.RouteTable, {\n name: \"public\",\n config: {\n vpcId: vpc.output.id,\n routes: [\n {\n cidrBlock: \"0.0.0.0/0\",\n gatewayId: internetGateway.output.id\n }\n ]\n }\n });\n\n const privateSubnetRouteTable = app.addResource(aws.ec2.RouteTable, {\n name: \"private\",\n config: {\n vpcId: vpc.output.id,\n routes: [\n {\n cidrBlock: \"0.0.0.0/0\",\n natGatewayId: natGateway.output.id\n }\n ]\n }\n });\n\n // Create route table associations - links between subnets and route tables.\n app.addResource(aws.ec2.RouteTableAssociation, {\n name: \"public-subnet-route-table-association\",\n config: {\n subnetId: publicSubnet.output.id,\n routeTableId: publicSubnetRouteTable.output.id\n }\n });\n\n app.addResource(aws.ec2.RouteTableAssociation, {\n name: \"private-subnet-1-route-table-association\",\n config: {\n subnetId: privateSubnet1.output.id,\n routeTableId: privateSubnetRouteTable.output.id\n }\n });\n\n app.addResource(aws.ec2.RouteTableAssociation, {\n name: \"private-subnet-2-route-table-association\",\n config: {\n subnetId: privateSubnet2.output.id,\n routeTableId: privateSubnetRouteTable.output.id\n }\n });\n\n return {\n vpc,\n subnets: {\n public: [publicSubnet],\n private: [privateSubnet1, privateSubnet2]\n }\n };\n}\n\nexport type Vpc = ReturnType<typeof createVpc>;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./ApiApp";
|
|
2
|
+
export * from "./ApiApwScheduler";
|
|
3
|
+
export * from "./ApiCloudfront";
|
|
4
|
+
export * from "./ApiFileManager";
|
|
5
|
+
export * from "./ApiGateway";
|
|
6
|
+
export * from "./ApiGraphql";
|
|
7
|
+
export * from "./ApiHeadlessCMS";
|
|
8
|
+
export * from "./ApiPageBuilder";
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _ApiApp = require("./ApiApp");
|
|
8
|
+
|
|
9
|
+
Object.keys(_ApiApp).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _ApiApp[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _ApiApp[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
var _ApiApwScheduler = require("./ApiApwScheduler");
|
|
21
|
+
|
|
22
|
+
Object.keys(_ApiApwScheduler).forEach(function (key) {
|
|
23
|
+
if (key === "default" || key === "__esModule") return;
|
|
24
|
+
if (key in exports && exports[key] === _ApiApwScheduler[key]) return;
|
|
25
|
+
Object.defineProperty(exports, key, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _ApiApwScheduler[key];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
var _ApiCloudfront = require("./ApiCloudfront");
|
|
34
|
+
|
|
35
|
+
Object.keys(_ApiCloudfront).forEach(function (key) {
|
|
36
|
+
if (key === "default" || key === "__esModule") return;
|
|
37
|
+
if (key in exports && exports[key] === _ApiCloudfront[key]) return;
|
|
38
|
+
Object.defineProperty(exports, key, {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return _ApiCloudfront[key];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
var _ApiFileManager = require("./ApiFileManager");
|
|
47
|
+
|
|
48
|
+
Object.keys(_ApiFileManager).forEach(function (key) {
|
|
49
|
+
if (key === "default" || key === "__esModule") return;
|
|
50
|
+
if (key in exports && exports[key] === _ApiFileManager[key]) return;
|
|
51
|
+
Object.defineProperty(exports, key, {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () {
|
|
54
|
+
return _ApiFileManager[key];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
var _ApiGateway = require("./ApiGateway");
|
|
60
|
+
|
|
61
|
+
Object.keys(_ApiGateway).forEach(function (key) {
|
|
62
|
+
if (key === "default" || key === "__esModule") return;
|
|
63
|
+
if (key in exports && exports[key] === _ApiGateway[key]) return;
|
|
64
|
+
Object.defineProperty(exports, key, {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function () {
|
|
67
|
+
return _ApiGateway[key];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
var _ApiGraphql = require("./ApiGraphql");
|
|
73
|
+
|
|
74
|
+
Object.keys(_ApiGraphql).forEach(function (key) {
|
|
75
|
+
if (key === "default" || key === "__esModule") return;
|
|
76
|
+
if (key in exports && exports[key] === _ApiGraphql[key]) return;
|
|
77
|
+
Object.defineProperty(exports, key, {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: function () {
|
|
80
|
+
return _ApiGraphql[key];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
var _ApiHeadlessCMS = require("./ApiHeadlessCMS");
|
|
86
|
+
|
|
87
|
+
Object.keys(_ApiHeadlessCMS).forEach(function (key) {
|
|
88
|
+
if (key === "default" || key === "__esModule") return;
|
|
89
|
+
if (key in exports && exports[key] === _ApiHeadlessCMS[key]) return;
|
|
90
|
+
Object.defineProperty(exports, key, {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return _ApiHeadlessCMS[key];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
var _ApiPageBuilder = require("./ApiPageBuilder");
|
|
99
|
+
|
|
100
|
+
Object.keys(_ApiPageBuilder).forEach(function (key) {
|
|
101
|
+
if (key === "default" || key === "__esModule") return;
|
|
102
|
+
if (key in exports && exports[key] === _ApiPageBuilder[key]) return;
|
|
103
|
+
Object.defineProperty(exports, key, {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function () {
|
|
106
|
+
return _ApiPageBuilder[key];
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./ApiApp\";\nexport * from \"./ApiApwScheduler\";\nexport * from \"./ApiCloudfront\";\nexport * from \"./ApiFileManager\";\nexport * from \"./ApiGateway\";\nexport * from \"./ApiGraphql\";\nexport * from \"./ApiHeadlessCMS\";\nexport * from \"./ApiPageBuilder\";\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { PulumiApp } from "@webiny/pulumi-sdk";
|
|
2
|
+
export declare function getAwsAccountId(app: PulumiApp): import("@pulumi/pulumi").Output<string>;
|
|
3
|
+
export declare function getAwsRegion(app: PulumiApp): import("@pulumi/pulumi").Output<"us-east-1" | "af-south-1" | "ap-east-1" | "ap-northeast-1" | "ap-northeast-2" | "ap-south-1" | "ap-southeast-2" | "ap-southeast-1" | "ca-central-1" | "cn-north-1" | "cn-northwest-1" | "eu-central-1" | "eu-north-1" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "eu-south-1" | "me-south-1" | "sa-east-1" | "us-gov-east-1" | "us-gov-west-1" | "us-east-2" | "us-west-1" | "us-west-2">;
|
package/apps/awsUtils.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getAwsAccountId = getAwsAccountId;
|
|
7
|
+
exports.getAwsRegion = getAwsRegion;
|
|
8
|
+
|
|
9
|
+
var aws = _interopRequireWildcard(require("@pulumi/aws"));
|
|
10
|
+
|
|
11
|
+
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); }
|
|
12
|
+
|
|
13
|
+
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; }
|
|
14
|
+
|
|
15
|
+
function getAwsAccountId(app) {
|
|
16
|
+
return app.addHandler(() => {
|
|
17
|
+
return aws.getCallerIdentity({}).then(x => x.accountId);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function getAwsRegion(app) {
|
|
22
|
+
return app.addHandler(() => {
|
|
23
|
+
return aws.config.requireRegion();
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["awsUtils.ts"],"names":["getAwsAccountId","app","addHandler","aws","getCallerIdentity","then","x","accountId","getAwsRegion","config","requireRegion"],"mappings":";;;;;;;;AAAA;;;;;;AAGO,SAASA,eAAT,CAAyBC,GAAzB,EAAyC;AAC5C,SAAOA,GAAG,CAACC,UAAJ,CAAe,MAAM;AACxB,WAAOC,GAAG,CAACC,iBAAJ,CAAsB,EAAtB,EAA0BC,IAA1B,CAA+BC,CAAC,IAAIA,CAAC,CAACC,SAAtC,CAAP;AACH,GAFM,CAAP;AAGH;;AAEM,SAASC,YAAT,CAAsBP,GAAtB,EAAsC;AACzC,SAAOA,GAAG,CAACC,UAAJ,CAAe,MAAM;AACxB,WAAOC,GAAG,CAACM,MAAJ,CAAWC,aAAX,EAAP;AACH,GAFM,CAAP;AAGH","sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { PulumiApp } from \"@webiny/pulumi-sdk\";\n\nexport function getAwsAccountId(app: PulumiApp) {\n return app.addHandler(() => {\n return aws.getCallerIdentity({}).then(x => x.accountId);\n });\n}\n\nexport function getAwsRegion(app: PulumiApp) {\n return app.addHandler(() => {\n return aws.config.requireRegion();\n });\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as aws from "@pulumi/aws";
|
|
2
|
+
import { PulumiApp } from "@webiny/pulumi-sdk";
|
|
3
|
+
export declare function createPublicAppBucket(app: PulumiApp, name: string): {
|
|
4
|
+
bucket: import("@webiny/pulumi-sdk").PulumiAppResource<typeof aws.s3.Bucket>;
|
|
5
|
+
origin: aws.types.input.cloudfront.DistributionOrigin;
|
|
6
|
+
};
|
|
7
|
+
export declare function createPrivateAppBucket(app: PulumiApp, name: string): {
|
|
8
|
+
bucket: import("@webiny/pulumi-sdk").PulumiAppResource<typeof aws.s3.Bucket>;
|
|
9
|
+
originIdentity: import("@webiny/pulumi-sdk").PulumiAppResource<typeof aws.cloudfront.OriginAccessIdentity>;
|
|
10
|
+
origin: aws.types.input.cloudfront.DistributionOrigin;
|
|
11
|
+
bucketPublicAccessBlock: import("@webiny/pulumi-sdk").PulumiAppResource<typeof aws.s3.BucketPublicAccessBlock>;
|
|
12
|
+
bucketPolicy: import("@webiny/pulumi-sdk").PulumiAppResource<typeof aws.s3.BucketPolicy>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createPrivateAppBucket = createPrivateAppBucket;
|
|
7
|
+
exports.createPublicAppBucket = createPublicAppBucket;
|
|
8
|
+
|
|
9
|
+
var aws = _interopRequireWildcard(require("@pulumi/aws"));
|
|
10
|
+
|
|
11
|
+
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); }
|
|
12
|
+
|
|
13
|
+
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; }
|
|
14
|
+
|
|
15
|
+
function createPublicAppBucket(app, name) {
|
|
16
|
+
const bucket = app.addResource(aws.s3.Bucket, {
|
|
17
|
+
name: name,
|
|
18
|
+
config: {
|
|
19
|
+
acl: aws.s3.CannedAcl.PublicRead,
|
|
20
|
+
forceDestroy: true,
|
|
21
|
+
website: {
|
|
22
|
+
indexDocument: "index.html",
|
|
23
|
+
errorDocument: "index.html"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const origin = {
|
|
28
|
+
originId: bucket.output.arn,
|
|
29
|
+
domainName: bucket.output.websiteEndpoint,
|
|
30
|
+
customOriginConfig: {
|
|
31
|
+
originProtocolPolicy: "http-only",
|
|
32
|
+
httpPort: 80,
|
|
33
|
+
httpsPort: 443,
|
|
34
|
+
originSslProtocols: ["TLSv1.2"]
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
bucket,
|
|
39
|
+
origin
|
|
40
|
+
};
|
|
41
|
+
} // TODO Currently not used, because of issues with uploading prerendered pages.
|
|
42
|
+
// Allows to have private S3 buckets available only through cloudfront distribution.
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
function createPrivateAppBucket(app, name) {
|
|
46
|
+
const bucket = app.addResource(aws.s3.Bucket, {
|
|
47
|
+
name: name,
|
|
48
|
+
config: {
|
|
49
|
+
acl: aws.s3.CannedAcl.Private,
|
|
50
|
+
forceDestroy: true
|
|
51
|
+
}
|
|
52
|
+
}); // Origin Identity is a kind of AWS user that represents Cloudfront distribution
|
|
53
|
+
// We can add IAM policies to it later, to allow accessing private S3 bucket
|
|
54
|
+
|
|
55
|
+
const originIdentity = app.addResource(aws.cloudfront.OriginAccessIdentity, {
|
|
56
|
+
name: `${name}-origin-identity`,
|
|
57
|
+
config: {}
|
|
58
|
+
});
|
|
59
|
+
const origin = {
|
|
60
|
+
originId: bucket.output.arn,
|
|
61
|
+
domainName: bucket.output.bucketDomainName,
|
|
62
|
+
s3OriginConfig: {
|
|
63
|
+
originAccessIdentity: originIdentity.output.cloudfrontAccessIdentityPath
|
|
64
|
+
}
|
|
65
|
+
}; // block any public access
|
|
66
|
+
|
|
67
|
+
const bucketPublicAccessBlock = app.addResource(aws.s3.BucketPublicAccessBlock, {
|
|
68
|
+
name: `${name}-bucket-block-access`,
|
|
69
|
+
config: {
|
|
70
|
+
bucket: bucket.output.id,
|
|
71
|
+
blockPublicAcls: true,
|
|
72
|
+
blockPublicPolicy: true,
|
|
73
|
+
ignorePublicAcls: true,
|
|
74
|
+
restrictPublicBuckets: true
|
|
75
|
+
}
|
|
76
|
+
}); // Create an IAM policy to allow access to S3 bucket from cloudfront
|
|
77
|
+
|
|
78
|
+
const bucketPolicy = app.addResource(aws.s3.BucketPolicy, {
|
|
79
|
+
name: `${name}-bucket-policy`,
|
|
80
|
+
config: {
|
|
81
|
+
bucket: bucket.output.bucket,
|
|
82
|
+
policy: {
|
|
83
|
+
Version: "2012-10-17",
|
|
84
|
+
Statement: bucket.output.arn.apply(arn => {
|
|
85
|
+
const statements = [{
|
|
86
|
+
Effect: "Allow",
|
|
87
|
+
Principal: {
|
|
88
|
+
AWS: originIdentity.output.iamArn
|
|
89
|
+
},
|
|
90
|
+
// we need GetObject to retrieve objects from S3
|
|
91
|
+
// and ListBucket allows to properly handle non-existing files (404)
|
|
92
|
+
Action: ["s3:ListBucket", "s3:GetObject"],
|
|
93
|
+
Resource: [`${arn}`, `${arn}/*`]
|
|
94
|
+
}];
|
|
95
|
+
return statements;
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
return {
|
|
101
|
+
bucket,
|
|
102
|
+
originIdentity,
|
|
103
|
+
origin,
|
|
104
|
+
bucketPublicAccessBlock,
|
|
105
|
+
bucketPolicy
|
|
106
|
+
};
|
|
107
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["createAppBucket.ts"],"names":["createPublicAppBucket","app","name","bucket","addResource","aws","s3","Bucket","config","acl","CannedAcl","PublicRead","forceDestroy","website","indexDocument","errorDocument","origin","originId","output","arn","domainName","websiteEndpoint","customOriginConfig","originProtocolPolicy","httpPort","httpsPort","originSslProtocols","createPrivateAppBucket","Private","originIdentity","cloudfront","OriginAccessIdentity","bucketDomainName","s3OriginConfig","originAccessIdentity","cloudfrontAccessIdentityPath","bucketPublicAccessBlock","BucketPublicAccessBlock","id","blockPublicAcls","blockPublicPolicy","ignorePublicAcls","restrictPublicBuckets","bucketPolicy","BucketPolicy","policy","Version","Statement","apply","statements","Effect","Principal","AWS","iamArn","Action","Resource"],"mappings":";;;;;;;;AAAA;;;;;;AAQO,SAASA,qBAAT,CAA+BC,GAA/B,EAA+CC,IAA/C,EAA6D;AAChE,QAAMC,MAAM,GAAGF,GAAG,CAACG,WAAJ,CAAgBC,GAAG,CAACC,EAAJ,CAAOC,MAAvB,EAA+B;AAC1CL,IAAAA,IAAI,EAAEA,IADoC;AAE1CM,IAAAA,MAAM,EAAE;AACJC,MAAAA,GAAG,EAAEJ,GAAG,CAACC,EAAJ,CAAOI,SAAP,CAAiBC,UADlB;AAEJC,MAAAA,YAAY,EAAE,IAFV;AAGJC,MAAAA,OAAO,EAAE;AACLC,QAAAA,aAAa,EAAE,YADV;AAELC,QAAAA,aAAa,EAAE;AAFV;AAHL;AAFkC,GAA/B,CAAf;AAYA,QAAMC,MAAoB,GAAG;AACzBC,IAAAA,QAAQ,EAAEd,MAAM,CAACe,MAAP,CAAcC,GADC;AAEzBC,IAAAA,UAAU,EAAEjB,MAAM,CAACe,MAAP,CAAcG,eAFD;AAGzBC,IAAAA,kBAAkB,EAAE;AAChBC,MAAAA,oBAAoB,EAAE,WADN;AAEhBC,MAAAA,QAAQ,EAAE,EAFM;AAGhBC,MAAAA,SAAS,EAAE,GAHK;AAIhBC,MAAAA,kBAAkB,EAAE,CAAC,SAAD;AAJJ;AAHK,GAA7B;AAWA,SAAO;AACHvB,IAAAA,M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,qBAAqB,EAAE;AALnB;AAFoE,GAAhD,CAAhC,CAzBiE,CAoCjE;;AACA,QAAMC,YAAY,GAAG1C,GAAG,CAACG,WAAJ,CAAgBC,GAAG,CAACC,EAAJ,CAAOsC,YAAvB,EAAqC;AACtD1C,IAAAA,IAAI,EAAG,GAAEA,IAAK,gBADwC;AAEtDM,IAAAA,MAAM,EAAE;AACJL,MAAAA,MAAM,EAAEA,MAAM,CAACe,MAAP,CAAcf,MADlB;AAEJ0C,MAAAA,MAAM,EAAE;AACJC,QAAAA,OAAO,EAAE,YADL;AAEJC,QAAAA,SAAS,EAAE5C,MAAM,CAACe,MAAP,CAAcC,GAAd,CAAkB6B,KAAlB,CAAwB7B,GAAG,IAAI;AACtC,gBAAM8B,UAAqC,GAAG,CAC1C;AACIC,YAAAA,MAAM,EAAE,OADZ;AAEIC,YAAAA,SAAS,EAAE;AAAEC,cAAAA,GAAG,EAAEvB,cAAc,CAACX,MAAf,CAAsBmC;AAA7B,aAFf;AAGI;AACA;AACAC,YAAAA,MAAM,EAAE,CAAC,eAAD,EAAkB,cAAlB,CALZ;AAMIC,YAAAA,QAAQ,EAAE,CAAE,GAAEpC,GAAI,EAAR,EAAY,GAAEA,GAAI,IAAlB;AANd,WAD0C,CAA9C;AAWA,iBAAO8B,UAAP;AACH,SAbU;AAFP;AAFJ;AAF8C,GAArC,CAArB;AAwBA,SAAO;AACH9C,IAAAA,MADG;AAEH0B,IAAAA,cAFG;AAGHb,IAAAA,MAHG;AAIHoB,IAAAA,uBAJG;AAKHO,IAAAA;AALG,GAAP;AAOH","sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { PulumiInputValue } from \"../types\";\nimport { PulumiApp } from \"@webiny/pulumi-sdk\";\n\ntype OriginConfig = PulumiInputValue<\n PulumiInputValue<aws.cloudfront.DistributionArgs[\"origins\"]>[number]\n>;\n\nexport function createPublicAppBucket(app: PulumiApp, name: string) {\n const bucket = app.addResource(aws.s3.Bucket, {\n name: name,\n config: {\n acl: aws.s3.CannedAcl.PublicRead,\n forceDestroy: true,\n website: {\n indexDocument: \"index.html\",\n errorDocument: \"index.html\"\n }\n }\n });\n\n const origin: OriginConfig = {\n originId: bucket.output.arn,\n domainName: bucket.output.websiteEndpoint,\n customOriginConfig: {\n originProtocolPolicy: \"http-only\",\n httpPort: 80,\n httpsPort: 443,\n originSslProtocols: [\"TLSv1.2\"]\n }\n };\n\n return {\n bucket,\n origin\n };\n}\n\n// TODO Currently not used, because of issues with uploading prerendered pages.\n// Allows to have private S3 buckets available only through cloudfront distribution.\nexport function createPrivateAppBucket(app: PulumiApp, name: string) {\n const bucket = app.addResource(aws.s3.Bucket, {\n name: name,\n config: {\n acl: aws.s3.CannedAcl.Private,\n forceDestroy: true\n }\n });\n\n // Origin Identity is a kind of AWS user that represents Cloudfront distribution\n // We can add IAM policies to it later, to allow accessing private S3 bucket\n const originIdentity = app.addResource(aws.cloudfront.OriginAccessIdentity, {\n name: `${name}-origin-identity`,\n config: {}\n });\n\n const origin: OriginConfig = {\n originId: bucket.output.arn,\n domainName: bucket.output.bucketDomainName,\n s3OriginConfig: {\n originAccessIdentity: originIdentity.output.cloudfrontAccessIdentityPath\n }\n };\n\n // block any public access\n const bucketPublicAccessBlock = app.addResource(aws.s3.BucketPublicAccessBlock, {\n name: `${name}-bucket-block-access`,\n config: {\n bucket: bucket.output.id,\n blockPublicAcls: true,\n blockPublicPolicy: true,\n ignorePublicAcls: true,\n restrictPublicBuckets: true\n }\n });\n\n // Create an IAM policy to allow access to S3 bucket from cloudfront\n const bucketPolicy = app.addResource(aws.s3.BucketPolicy, {\n name: `${name}-bucket-policy`,\n config: {\n bucket: bucket.output.bucket,\n policy: {\n Version: \"2012-10-17\",\n Statement: bucket.output.arn.apply(arn => {\n const statements: aws.iam.PolicyStatement[] = [\n {\n Effect: \"Allow\",\n Principal: { AWS: originIdentity.output.iamArn },\n // we need GetObject to retrieve objects from S3\n // and ListBucket allows to properly handle non-existing files (404)\n Action: [\"s3:ListBucket\", \"s3:GetObject\"],\n Resource: [`${arn}`, `${arn}/*`]\n }\n ];\n\n return statements;\n })\n }\n }\n });\n\n return {\n bucket,\n originIdentity,\n origin,\n bucketPublicAccessBlock,\n bucketPolicy\n };\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Input } from "@pulumi/pulumi";
|
|
2
|
+
import * as aws from "@pulumi/aws";
|
|
3
|
+
import { PulumiAppResource } from "@webiny/pulumi-sdk";
|
|
4
|
+
export interface CustomDomainParams {
|
|
5
|
+
domain: Input<string>;
|
|
6
|
+
acmCertificateArn: Input<string>;
|
|
7
|
+
sslSupportMethod?: Input<string>;
|
|
8
|
+
}
|
|
9
|
+
export declare function applyCustomDomain(cloudfront: PulumiAppResource<typeof aws.cloudfront.Distribution>, params: CustomDomainParams): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.applyCustomDomain = applyCustomDomain;
|
|
7
|
+
|
|
8
|
+
function applyCustomDomain(cloudfront, params) {
|
|
9
|
+
cloudfront.config.aliases([params.domain]);
|
|
10
|
+
cloudfront.config.viewerCertificate({
|
|
11
|
+
acmCertificateArn: params.acmCertificateArn,
|
|
12
|
+
sslSupportMethod: params.sslSupportMethod ?? "sni-only"
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["customDomain.ts"],"names":["applyCustomDomain","cloudfront","params","config","aliases","domain","viewerCertificate","acmCertificateArn","sslSupportMethod"],"mappings":";;;;;;;AAUO,SAASA,iBAAT,CACHC,UADG,EAEHC,MAFG,EAGL;AACED,EAAAA,UAAU,CAACE,MAAX,CAAkBC,OAAlB,CAA0B,CAACF,MAAM,CAACG,MAAR,CAA1B;AACAJ,EAAAA,UAAU,CAACE,MAAX,CAAkBG,iBAAlB,CAAoC;AAChCC,IAAAA,iBAAiB,EAAEL,MAAM,CAACK,iBADM;AAEhCC,IAAAA,gBAAgB,EAAEN,MAAM,CAACM,gBAAP,IAA2B;AAFb,GAApC;AAIH","sourcesContent":["import { Input } from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport { PulumiAppResource } from \"@webiny/pulumi-sdk\";\n\nexport interface CustomDomainParams {\n domain: Input<string>;\n acmCertificateArn: Input<string>;\n sslSupportMethod?: Input<string>;\n}\n\nexport function applyCustomDomain(\n cloudfront: PulumiAppResource<typeof aws.cloudfront.Distribution>,\n params: CustomDomainParams\n) {\n cloudfront.config.aliases([params.domain]);\n cloudfront.config.viewerCertificate({\n acmCertificateArn: params.acmCertificateArn,\n sslSupportMethod: params.sslSupportMethod ?? \"sni-only\"\n });\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PulumiApp } from "@webiny/pulumi-sdk";
|
|
2
|
+
export declare function getStorageOutput(app: PulumiApp): import("@pulumi/pulumi").Output<import("@pulumi/pulumi").UnwrappedObject<{
|
|
3
|
+
fileManagerBucketId: string;
|
|
4
|
+
primaryDynamodbTableArn: string;
|
|
5
|
+
primaryDynamodbTableName: string;
|
|
6
|
+
primaryDynamodbTableHashKey: string;
|
|
7
|
+
primaryDynamodbTableRangeKey: string;
|
|
8
|
+
cognitoUserPoolId: string;
|
|
9
|
+
cognitoUserPoolArn: string;
|
|
10
|
+
cognitoUserPoolPasswordPolicy: any;
|
|
11
|
+
cognitoAppClientId: string;
|
|
12
|
+
eventBusArn: string;
|
|
13
|
+
}>>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getStorageOutput = getStorageOutput;
|
|
7
|
+
|
|
8
|
+
var _utils = require("@webiny/cli-plugin-deploy-pulumi/utils");
|
|
9
|
+
|
|
10
|
+
function getStorageOutput(app) {
|
|
11
|
+
return app.addHandler(async () => {
|
|
12
|
+
const output = await (0, _utils.getStackOutput)({
|
|
13
|
+
folder: "apps/storage",
|
|
14
|
+
env: app.ctx.env
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
fileManagerBucketId: output["fileManagerBucketId"],
|
|
18
|
+
primaryDynamodbTableArn: output["primaryDynamodbTableArn"],
|
|
19
|
+
primaryDynamodbTableName: output["primaryDynamodbTableName"],
|
|
20
|
+
primaryDynamodbTableHashKey: output["primaryDynamodbTableHashKey"],
|
|
21
|
+
primaryDynamodbTableRangeKey: output["primaryDynamodbTableRangeKey"],
|
|
22
|
+
cognitoUserPoolId: output["cognitoUserPoolId"],
|
|
23
|
+
cognitoUserPoolArn: output["cognitoUserPoolArn"],
|
|
24
|
+
cognitoUserPoolPasswordPolicy: output["cognitoUserPoolPasswordPolicy"],
|
|
25
|
+
cognitoAppClientId: output["cognitoAppClientId"],
|
|
26
|
+
eventBusArn: output["eventBusArn"]
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["getStorageOutput.ts"],"names":["getStorageOutput","app","addHandler","output","folder","env","ctx","fileManagerBucketId","primaryDynamodbTableArn","primaryDynamodbTableName","primaryDynamodbTableHashKey","primaryDynamodbTableRangeKey","cognitoUserPoolId","cognitoUserPoolArn","cognitoUserPoolPasswordPolicy","cognitoAppClientId","eventBusArn"],"mappings":";;;;;;;AACA;;AAEO,SAASA,gBAAT,CAA0BC,GAA1B,EAA0C;AAC7C,SAAOA,GAAG,CAACC,UAAJ,CAAe,YAAY;AAC9B,UAAMC,MAAM,GAAG,MAAM,2BAAe;AAChCC,MAAAA,MAAM,EAAE,cADwB;AAEhCC,MAAAA,GAAG,EAAEJ,GAAG,CAACK,GAAJ,CAAQD;AAFmB,KAAf,CAArB;AAKA,WAAO;AACHE,MAAAA,mBAAmB,EAAEJ,MAAM,CAAC,qBAAD,CADxB;AAEHK,MAAAA,uBAAuB,EAAEL,MAAM,CAAC,yBAAD,CAF5B;AAGHM,MAAAA,wBAAwB,EAAEN,MAAM,CAAC,0BAAD,CAH7B;AAIHO,MAAAA,2BAA2B,EAAEP,MAAM,CAAC,6BAAD,CAJhC;AAKHQ,MAAAA,4BAA4B,EAAER,MAAM,CAAC,8BAAD,CALjC;AAMHS,MAAAA,iBAAiB,EAAET,MAAM,CAAC,mBAAD,CANtB;AAOHU,MAAAA,kBAAkB,EAAEV,MAAM,CAAC,oBAAD,CAPvB;AAQHW,MAAAA,6BAA6B,EAAEX,MAAM,CAAC,+BAAD,CARlC;AASHY,MAAAA,kBAAkB,EAAEZ,MAAM,CAAC,oBAAD,CATvB;AAUHa,MAAAA,WAAW,EAAEb,MAAM,CAAC,aAAD;AAVhB,KAAP;AAYH,GAlBM,CAAP;AAmBH","sourcesContent":["import { PulumiApp } from \"@webiny/pulumi-sdk\";\nimport { getStackOutput } from \"@webiny/cli-plugin-deploy-pulumi/utils\";\n\nexport function getStorageOutput(app: PulumiApp) {\n return app.addHandler(async () => {\n const output = await getStackOutput({\n folder: \"apps/storage\",\n env: app.ctx.env\n });\n\n return {\n fileManagerBucketId: output[\"fileManagerBucketId\"] as string,\n primaryDynamodbTableArn: output[\"primaryDynamodbTableArn\"] as string,\n primaryDynamodbTableName: output[\"primaryDynamodbTableName\"] as string,\n primaryDynamodbTableHashKey: output[\"primaryDynamodbTableHashKey\"] as string,\n primaryDynamodbTableRangeKey: output[\"primaryDynamodbTableRangeKey\"] as string,\n cognitoUserPoolId: output[\"cognitoUserPoolId\"] as string,\n cognitoUserPoolArn: output[\"cognitoUserPoolArn\"] as string,\n cognitoUserPoolPasswordPolicy: output[\"cognitoUserPoolPasswordPolicy\"],\n cognitoAppClientId: output[\"cognitoAppClientId\"] as string,\n eventBusArn: output[\"eventBusArn\"] as string\n };\n });\n}\n"]}
|
package/apps/index.d.ts
ADDED
package/apps/index.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
CustomDomainParams: true
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "CustomDomainParams", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _customDomain.CustomDomainParams;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
var _storage = require("./storage");
|
|
17
|
+
|
|
18
|
+
Object.keys(_storage).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
21
|
+
if (key in exports && exports[key] === _storage[key]) return;
|
|
22
|
+
Object.defineProperty(exports, key, {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () {
|
|
25
|
+
return _storage[key];
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
var _api = require("./api");
|
|
31
|
+
|
|
32
|
+
Object.keys(_api).forEach(function (key) {
|
|
33
|
+
if (key === "default" || key === "__esModule") return;
|
|
34
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
35
|
+
if (key in exports && exports[key] === _api[key]) return;
|
|
36
|
+
Object.defineProperty(exports, key, {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _api[key];
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
var _AdminApp = require("./admin/AdminApp");
|
|
45
|
+
|
|
46
|
+
Object.keys(_AdminApp).forEach(function (key) {
|
|
47
|
+
if (key === "default" || key === "__esModule") return;
|
|
48
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
49
|
+
if (key in exports && exports[key] === _AdminApp[key]) return;
|
|
50
|
+
Object.defineProperty(exports, key, {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function () {
|
|
53
|
+
return _AdminApp[key];
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
var _WebsiteApp = require("./website/WebsiteApp");
|
|
59
|
+
|
|
60
|
+
Object.keys(_WebsiteApp).forEach(function (key) {
|
|
61
|
+
if (key === "default" || key === "__esModule") return;
|
|
62
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
63
|
+
if (key in exports && exports[key] === _WebsiteApp[key]) return;
|
|
64
|
+
Object.defineProperty(exports, key, {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function () {
|
|
67
|
+
return _WebsiteApp[key];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
var _customDomain = require("./customDomain");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA","sourcesContent":["export * from \"./storage\";\nexport * from \"./api\";\nexport * from \"./admin/AdminApp\";\nexport * from \"./website/WebsiteApp\";\nexport { CustomDomainParams } from \"./customDomain\";\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ApplicationContext, ApplicationHooks, ApplicationConfig } from "@webiny/pulumi-sdk";
|
|
2
|
+
export interface StorageAppConfig extends Partial<ApplicationHooks> {
|
|
3
|
+
protect?(ctx: ApplicationContext): boolean;
|
|
4
|
+
legacy?(ctx: ApplicationContext): StorageAppLegacyConfig;
|
|
5
|
+
}
|
|
6
|
+
export interface StorageAppLegacyConfig {
|
|
7
|
+
useEmailAsUsername?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const StorageApp: new (ctx: ApplicationContext) => import("@webiny/pulumi-sdk").PulumiApp<StorageAppConfig> & {
|
|
10
|
+
fileManagerBucket: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/s3").Bucket>;
|
|
11
|
+
userPool: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/cognito").UserPool>;
|
|
12
|
+
userPoolClient: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/cognito").UserPoolClient>;
|
|
13
|
+
dynamoDbTable: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/dynamodb").Table>;
|
|
14
|
+
};
|
|
15
|
+
export declare type StorageApp = InstanceType<typeof StorageApp>;
|
|
16
|
+
export declare function createStorageApp(config?: StorageAppConfig & ApplicationConfig<StorageApp>): import("@webiny/pulumi-sdk").ApplicationBuilderGeneric;
|