dcl-ops-lib 5.26.3 → 5.26.4
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/StaticWebsite.d.ts +1 -1
- package/acceptAlb.d.ts +10 -4
- package/acceptAlb.js +40 -6
- package/acceptBastion.d.ts +9 -3
- package/acceptBastion.js +29 -4
- package/acceptDb.d.ts +3 -3
- package/acceptDb.js +2 -2
- package/accessTheInternet.d.ts +14 -3
- package/accessTheInternet.js +44 -9
- package/alb.d.ts +3 -2
- package/alb.js +4 -2
- package/cloudflare.d.ts +5 -6
- package/cloudflare.js +2 -11
- package/createBucketWithUser.d.ts +2 -1
- package/createFargateTask.d.ts +27 -25
- package/createFargateTask.js +54 -65
- package/createImageFromContext.d.ts +4 -3
- package/createImageFromContext.js +1 -1
- package/exposePublicService.d.ts +11 -9
- package/exposePublicService.js +9 -8
- package/getSecurityGroup.d.ts +6 -0
- package/getSecurityGroup.js +51 -0
- package/lambda.d.ts +6 -5
- package/lambda.js +12 -16
- package/package.json +11 -13
- package/prometheus.d.ts +6 -2
- package/prometheus.js +18 -7
- package/secrets.d.ts +2 -1
- package/setupDatabasePermissions.d.ts +2 -0
- package/setupDatabasePermissions.js +18 -0
- package/values.d.ts +5 -4
- package/values.js +4 -4
- package/vpc.d.ts +2 -2
- package/vpc.js +3 -3
package/StaticWebsite.d.ts
CHANGED
package/acceptAlb.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
/**
|
|
3
|
-
export declare
|
|
4
|
-
|
|
1
|
+
import * as awsx from "@pulumi/awsx";
|
|
2
|
+
/** @deprecated use makeSecurityGroupAccessibleFromSharedAlb instead */
|
|
3
|
+
export declare const acceptAlbSecurityGroup: () => Promise<awsx.ec2.SecurityGroup>;
|
|
4
|
+
/** @deprecated use makeSecurityGroupAccessibleFromSharedAlb instead */
|
|
5
|
+
export declare function acceptAlbSecurityGroupId(): Promise<import("@pulumi/pulumi").Output<string>>;
|
|
6
|
+
/** @deprecated use makeSecurityGroupAccessibleFromSharedAlbV2 */
|
|
7
|
+
export declare function makeSecurityGroupAccessibleFromSharedAlb(securityGroup: awsx.ec2.SecurityGroup): void;
|
|
8
|
+
/** @deprecated Makes a given securityGropup accesible by the shared supra ALB */
|
|
9
|
+
export declare function makeSecurityGroupAccessibleFromSharedAlbV2(securityGroup: awsx.ec2.SecurityGroup, ruleName?: string): void;
|
|
10
|
+
export default acceptAlbSecurityGroup;
|
package/acceptAlb.js
CHANGED
|
@@ -1,12 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeSecurityGroupAccessibleFromSharedAlb = void 0;
|
|
12
|
+
exports.makeSecurityGroupAccessibleFromSharedAlbV2 = exports.makeSecurityGroupAccessibleFromSharedAlb = exports.acceptAlbSecurityGroupId = exports.acceptAlbSecurityGroup = void 0;
|
|
13
|
+
const awsx = require("@pulumi/awsx");
|
|
4
14
|
const aws = require("@pulumi/aws");
|
|
5
15
|
const utils_1 = require("./utils");
|
|
6
16
|
const values_1 = require("./values");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
17
|
+
const withCache_1 = require("./withCache");
|
|
18
|
+
/** @deprecated use makeSecurityGroupAccessibleFromSharedAlb instead */
|
|
19
|
+
exports.acceptAlbSecurityGroup = (0, withCache_1.default)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
const config = yield (0, values_1.getEnvConfiguration)();
|
|
21
|
+
return awsx.ec2.SecurityGroup.fromExistingId(`accept-alb-sg-reference`, config.acceptAlb);
|
|
22
|
+
}));
|
|
23
|
+
/** @deprecated use makeSecurityGroupAccessibleFromSharedAlb instead */
|
|
24
|
+
function acceptAlbSecurityGroupId() {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
return (yield (0, exports.acceptAlbSecurityGroup)()).id;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
exports.acceptAlbSecurityGroupId = acceptAlbSecurityGroupId;
|
|
30
|
+
/** @deprecated use makeSecurityGroupAccessibleFromSharedAlbV2 */
|
|
31
|
+
function makeSecurityGroupAccessibleFromSharedAlb(securityGroup) {
|
|
32
|
+
new awsx.ec2.IngressSecurityGroupRule("accept-alb-ingress-rule", securityGroup, {
|
|
33
|
+
sourceSecurityGroupId: (0, values_1.getEnvConfiguration)().then(($) => $.albSecurityGroupId),
|
|
34
|
+
description: `Allow access from the supra ALB`,
|
|
35
|
+
fromPort: 0,
|
|
36
|
+
toPort: 0,
|
|
37
|
+
protocol: "-1",
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
exports.makeSecurityGroupAccessibleFromSharedAlb = makeSecurityGroupAccessibleFromSharedAlb;
|
|
41
|
+
/** @deprecated Makes a given securityGropup accesible by the shared supra ALB */
|
|
42
|
+
function makeSecurityGroupAccessibleFromSharedAlbV2(securityGroup, ruleName = "") {
|
|
43
|
+
new aws.ec2.SecurityGroupRule((0, utils_1.withRuleName)("accept-alb-ingress-rule-v2", ruleName), {
|
|
10
44
|
securityGroupId: securityGroup.id,
|
|
11
45
|
sourceSecurityGroupId: (0, values_1.getEnvConfiguration)().then(($) => $.albSecurityGroupId),
|
|
12
46
|
description: `Allow access from the supra ALB`,
|
|
@@ -16,6 +50,6 @@ function makeSecurityGroupAccessibleFromSharedAlb(securityGroup, ruleName = "")
|
|
|
16
50
|
type: "egress",
|
|
17
51
|
}, { deleteBeforeReplace: true });
|
|
18
52
|
}
|
|
19
|
-
exports.
|
|
20
|
-
exports.default =
|
|
53
|
+
exports.makeSecurityGroupAccessibleFromSharedAlbV2 = makeSecurityGroupAccessibleFromSharedAlbV2;
|
|
54
|
+
exports.default = exports.acceptAlbSecurityGroup;
|
|
21
55
|
//# sourceMappingURL=acceptAlb.js.map
|
package/acceptBastion.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
|
|
3
|
-
export
|
|
1
|
+
import * as awsx from "@pulumi/awsx";
|
|
2
|
+
/** @deprecated please use makeSecurityGroupAccessTheInternet */
|
|
3
|
+
export declare const acceptBastionSecurityGroup: () => Promise<awsx.ec2.SecurityGroup>;
|
|
4
|
+
/** @deprecated please use makeSecurityGroupAccessTheInternet */
|
|
5
|
+
export declare function acceptBastionSecurityGroupId(): Promise<import("@pulumi/pulumi").Output<string>>;
|
|
6
|
+
/** @deprecated use makeSecurityGroupAccessibleFromBastionV2 */
|
|
7
|
+
export declare function makeSecurityGroupAccessibleFromBastion(securityGroup: awsx.ec2.SecurityGroup): void;
|
|
8
|
+
export declare function makeSecurityGroupAccessibleFromBastionV2(securityGroup: awsx.ec2.SecurityGroup, ruleName?: string): void;
|
|
9
|
+
export default acceptBastionSecurityGroup;
|
package/acceptBastion.js
CHANGED
|
@@ -9,17 +9,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.makeSecurityGroupAccessibleFromBastion = void 0;
|
|
12
|
+
exports.makeSecurityGroupAccessibleFromBastionV2 = exports.makeSecurityGroupAccessibleFromBastion = exports.acceptBastionSecurityGroupId = exports.acceptBastionSecurityGroup = void 0;
|
|
13
|
+
const awsx = require("@pulumi/awsx");
|
|
13
14
|
const aws = require("@pulumi/aws");
|
|
14
15
|
const values_1 = require("./values");
|
|
15
16
|
const withCache_1 = require("./withCache");
|
|
16
17
|
const utils_1 = require("./utils");
|
|
18
|
+
/** @deprecated please use makeSecurityGroupAccessTheInternet */
|
|
19
|
+
exports.acceptBastionSecurityGroup = (0, withCache_1.default)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
const config = yield (0, values_1.getEnvConfiguration)();
|
|
21
|
+
return awsx.ec2.SecurityGroup.fromExistingId(`accept-bastion-sg-reference`, config.acceptBastion);
|
|
22
|
+
}));
|
|
23
|
+
/** @deprecated please use makeSecurityGroupAccessTheInternet */
|
|
24
|
+
function acceptBastionSecurityGroupId() {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
return (yield (0, exports.acceptBastionSecurityGroup)()).id;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
exports.acceptBastionSecurityGroupId = acceptBastionSecurityGroupId;
|
|
17
30
|
const bastionSecurityGroupId = (0, withCache_1.default)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
31
|
const config = yield (0, values_1.getEnvConfiguration)();
|
|
19
32
|
return config.bastionSecurityGroupId;
|
|
20
33
|
}));
|
|
21
|
-
|
|
22
|
-
|
|
34
|
+
/** @deprecated use makeSecurityGroupAccessibleFromBastionV2 */
|
|
35
|
+
function makeSecurityGroupAccessibleFromBastion(securityGroup) {
|
|
36
|
+
new aws.ec2.SecurityGroupRule("accesible-from-bastion", {
|
|
23
37
|
securityGroupId: securityGroup.id,
|
|
24
38
|
sourceSecurityGroupId: bastionSecurityGroupId(),
|
|
25
39
|
fromPort: -1,
|
|
@@ -29,5 +43,16 @@ function makeSecurityGroupAccessibleFromBastion(securityGroup, ruleName = "") {
|
|
|
29
43
|
}, { deleteBeforeReplace: true });
|
|
30
44
|
}
|
|
31
45
|
exports.makeSecurityGroupAccessibleFromBastion = makeSecurityGroupAccessibleFromBastion;
|
|
32
|
-
|
|
46
|
+
function makeSecurityGroupAccessibleFromBastionV2(securityGroup, ruleName = "") {
|
|
47
|
+
new aws.ec2.SecurityGroupRule((0, utils_1.withRuleName)("accesible-from-bastion-v2", ruleName), {
|
|
48
|
+
securityGroupId: securityGroup.id,
|
|
49
|
+
sourceSecurityGroupId: bastionSecurityGroupId(),
|
|
50
|
+
fromPort: -1,
|
|
51
|
+
toPort: -1,
|
|
52
|
+
type: "ingress",
|
|
53
|
+
protocol: "-1",
|
|
54
|
+
}, { deleteBeforeReplace: true });
|
|
55
|
+
}
|
|
56
|
+
exports.makeSecurityGroupAccessibleFromBastionV2 = makeSecurityGroupAccessibleFromBastionV2;
|
|
57
|
+
exports.default = exports.acceptBastionSecurityGroup;
|
|
33
58
|
//# sourceMappingURL=acceptBastion.js.map
|
package/acceptDb.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
export declare const acceptDbSecurityGroup: () => Promise<
|
|
3
|
-
export declare function acceptDbSecurityGroupId(): Promise<string
|
|
1
|
+
import * as awsx from "@pulumi/awsx";
|
|
2
|
+
export declare const acceptDbSecurityGroup: () => Promise<awsx.ec2.SecurityGroup>;
|
|
3
|
+
export declare function acceptDbSecurityGroupId(): Promise<import("@pulumi/pulumi").Output<string>>;
|
|
4
4
|
export default acceptDbSecurityGroup;
|
package/acceptDb.js
CHANGED
|
@@ -10,12 +10,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.acceptDbSecurityGroupId = exports.acceptDbSecurityGroup = void 0;
|
|
13
|
-
const
|
|
13
|
+
const awsx = require("@pulumi/awsx");
|
|
14
14
|
const values_1 = require("./values");
|
|
15
15
|
const withCache_1 = require("./withCache");
|
|
16
16
|
exports.acceptDbSecurityGroup = (0, withCache_1.default)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
17
|
const config = yield (0, values_1.getEnvConfiguration)();
|
|
18
|
-
return
|
|
18
|
+
return awsx.ec2.SecurityGroup.fromExistingId(`accept-db-sg-reference`, config.dbSecurity);
|
|
19
19
|
}));
|
|
20
20
|
function acceptDbSecurityGroupId() {
|
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
package/accessTheInternet.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as awsx from "@pulumi/awsx";
|
|
2
|
+
/** @deprecated please use makeSecurityGroupAccessibleByCloudflare */
|
|
3
|
+
export declare const accessCloudflareSecurityGroup: () => Promise<awsx.ec2.SecurityGroup>;
|
|
4
|
+
/** @deprecated please use makeSecurityGroupAccessTheInternet */
|
|
5
|
+
export declare const accessTheInternetSecurityGroup: () => Promise<awsx.ec2.SecurityGroup>;
|
|
6
|
+
/** @deprecated please use makeSecurityGroupAccessTheInternet */
|
|
7
|
+
export declare function accessTheInternetSecurityGroupId(): Promise<import("@pulumi/pulumi").Output<string>>;
|
|
8
|
+
export default accessTheInternetSecurityGroup;
|
|
9
|
+
/** @deprecated please use makeSecurityGroupAccessibleByCloudflare */
|
|
10
|
+
export declare function accessFromCloudflareSecurityGroup(): Promise<import("@pulumi/pulumi").Output<string>>;
|
|
11
|
+
/** @deprecated use makeSecurityGroupAccessTheInternetV2 */
|
|
12
|
+
export declare function makeSecurityGroupAccessTheInternet(securityGroup: awsx.ec2.SecurityGroup): void;
|
|
2
13
|
/** Enables egress traffic to 0.0.0.0/0/all */
|
|
3
|
-
export declare function makeSecurityGroupAccessTheInternetV2(securityGroup:
|
|
14
|
+
export declare function makeSecurityGroupAccessTheInternetV2(securityGroup: awsx.ec2.SecurityGroup, ruleName?: string): void;
|
|
4
15
|
/** Enables ingress traffic from cloudflare CIDRs */
|
|
5
|
-
export declare function makeSecurityGroupAccessibleByCloudflare(securityGroup:
|
|
16
|
+
export declare function makeSecurityGroupAccessibleByCloudflare(securityGroup: awsx.ec2.SecurityGroup): Promise<void>;
|
package/accessTheInternet.js
CHANGED
|
@@ -9,10 +9,49 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.makeSecurityGroupAccessibleByCloudflare = exports.makeSecurityGroupAccessTheInternetV2 = void 0;
|
|
12
|
+
exports.makeSecurityGroupAccessibleByCloudflare = exports.makeSecurityGroupAccessTheInternetV2 = exports.makeSecurityGroupAccessTheInternet = exports.accessFromCloudflareSecurityGroup = exports.accessTheInternetSecurityGroupId = exports.accessTheInternetSecurityGroup = exports.accessCloudflareSecurityGroup = void 0;
|
|
13
|
+
const awsx = require("@pulumi/awsx");
|
|
13
14
|
const aws = require("@pulumi/aws");
|
|
14
15
|
const cloudflare = require("@pulumi/cloudflare");
|
|
16
|
+
const supra_1 = require("./supra");
|
|
17
|
+
const values_1 = require("./values");
|
|
18
|
+
const withCache_1 = require("./withCache");
|
|
15
19
|
const utils_1 = require("./utils");
|
|
20
|
+
/** @deprecated please use makeSecurityGroupAccessibleByCloudflare */
|
|
21
|
+
exports.accessCloudflareSecurityGroup = (0, withCache_1.default)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
+
const config = yield (0, values_1.getEnvConfiguration)(); // ?
|
|
23
|
+
return awsx.ec2.SecurityGroup.fromExistingId(`accept-cloudflare-web-sg-reference`, supra_1.supra.getOutputValue(`cloudflareAcceptWeb`));
|
|
24
|
+
}));
|
|
25
|
+
/** @deprecated please use makeSecurityGroupAccessTheInternet */
|
|
26
|
+
exports.accessTheInternetSecurityGroup = (0, withCache_1.default)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
+
const config = yield (0, values_1.getEnvConfiguration)(); // ?
|
|
28
|
+
return awsx.ec2.SecurityGroup.fromExistingId(`access-the-internet-sg-reference`, supra_1.supra.getOutputValue(`accessTheInternet`));
|
|
29
|
+
}));
|
|
30
|
+
/** @deprecated please use makeSecurityGroupAccessTheInternet */
|
|
31
|
+
function accessTheInternetSecurityGroupId() {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
return (yield (0, exports.accessTheInternetSecurityGroup)()).id;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
exports.accessTheInternetSecurityGroupId = accessTheInternetSecurityGroupId;
|
|
37
|
+
exports.default = exports.accessTheInternetSecurityGroup;
|
|
38
|
+
/** @deprecated please use makeSecurityGroupAccessibleByCloudflare */
|
|
39
|
+
function accessFromCloudflareSecurityGroup() {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
return (yield (0, exports.accessCloudflareSecurityGroup)()).id;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
exports.accessFromCloudflareSecurityGroup = accessFromCloudflareSecurityGroup;
|
|
45
|
+
/** @deprecated use makeSecurityGroupAccessTheInternetV2 */
|
|
46
|
+
function makeSecurityGroupAccessTheInternet(securityGroup) {
|
|
47
|
+
securityGroup.createEgressRule("access-the-internet", {
|
|
48
|
+
cidrBlocks: ["0.0.0.0/0"],
|
|
49
|
+
fromPort: -1,
|
|
50
|
+
toPort: -1,
|
|
51
|
+
protocol: "-1",
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
exports.makeSecurityGroupAccessTheInternet = makeSecurityGroupAccessTheInternet;
|
|
16
55
|
/** Enables egress traffic to 0.0.0.0/0/all */
|
|
17
56
|
function makeSecurityGroupAccessTheInternetV2(securityGroup, ruleName = "") {
|
|
18
57
|
new aws.ec2.SecurityGroupRule((0, utils_1.withRuleName)("access-the-internet-v2", ruleName), {
|
|
@@ -31,24 +70,20 @@ function makeSecurityGroupAccessibleByCloudflare(securityGroup) {
|
|
|
31
70
|
const ips = yield cloudflare.getIpRanges({});
|
|
32
71
|
for (let block of ips.ipv4CidrBlocks) {
|
|
33
72
|
const hash = (0, utils_1.sha256hash)(block).substring(0, 6);
|
|
34
|
-
|
|
73
|
+
securityGroup.createIngressRule(`accept-cf-80-${hash}`, {
|
|
35
74
|
protocol: "tcp",
|
|
36
75
|
fromPort: 80,
|
|
37
76
|
toPort: 80,
|
|
38
77
|
cidrBlocks: [block],
|
|
39
|
-
type: "ingress",
|
|
40
|
-
securityGroupId: securityGroup.id,
|
|
41
78
|
description: `pulumi-supra-${hash}`,
|
|
42
|
-
}
|
|
43
|
-
|
|
79
|
+
});
|
|
80
|
+
securityGroup.createIngressRule(`accept-cf-443-${hash}`, {
|
|
44
81
|
protocol: "tcp",
|
|
45
82
|
fromPort: 443,
|
|
46
83
|
toPort: 443,
|
|
47
84
|
cidrBlocks: [block],
|
|
48
|
-
type: "ingress",
|
|
49
|
-
securityGroupId: securityGroup.id,
|
|
50
85
|
description: `pulumi-supra-${hash}`,
|
|
51
|
-
}
|
|
86
|
+
});
|
|
52
87
|
}
|
|
53
88
|
});
|
|
54
89
|
}
|
package/alb.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as aws from "@pulumi/aws";
|
|
2
|
-
|
|
2
|
+
import * as awsx from "@pulumi/awsx";
|
|
3
|
+
export declare type ElbValues = {
|
|
3
4
|
dns: string;
|
|
4
5
|
elbArn: string;
|
|
5
6
|
elbUrn: string;
|
|
@@ -8,6 +9,6 @@ export type ElbValues = {
|
|
|
8
9
|
};
|
|
9
10
|
export declare const getAlb: () => Promise<{
|
|
10
11
|
dns: string;
|
|
11
|
-
alb:
|
|
12
|
+
alb: awsx.elasticloadbalancingv2.ApplicationLoadBalancer;
|
|
12
13
|
listener: aws.lb.GetListenerResult;
|
|
13
14
|
}>;
|
package/alb.js
CHANGED
|
@@ -11,6 +11,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.getAlb = void 0;
|
|
13
13
|
const aws = require("@pulumi/aws");
|
|
14
|
+
const awsx = require("@pulumi/awsx");
|
|
15
|
+
const domain_1 = require("./domain");
|
|
14
16
|
const supra_1 = require("./supra");
|
|
15
17
|
const withCache_1 = require("./withCache");
|
|
16
18
|
const cache = {
|
|
@@ -23,9 +25,9 @@ const cache = {
|
|
|
23
25
|
};
|
|
24
26
|
exports.getAlb = (0, withCache_1.default)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
27
|
const dns = yield supra_1.supra.getOutputValue("dns");
|
|
26
|
-
const loadBalancer = yield supra_1.supra.
|
|
28
|
+
const loadBalancer = yield supra_1.supra.getOutputValue("albInstance");
|
|
27
29
|
const elbValues = yield supra_1.supra.getOutputValue("elbValues");
|
|
28
|
-
const alb =
|
|
30
|
+
const alb = new awsx.lb.ApplicationLoadBalancer(`${domain_1.env}-alb-all`, { loadBalancer });
|
|
29
31
|
const listener = yield aws.lb.getListener({ arn: elbValues.listenerArn });
|
|
30
32
|
return { dns, alb, listener };
|
|
31
33
|
}));
|
package/cloudflare.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as pulumi from "@pulumi/pulumi";
|
|
2
2
|
import * as cloudflare from "@pulumi/cloudflare";
|
|
3
|
-
export type DeployWorkerConfig = {
|
|
3
|
+
export declare type DeployWorkerConfig = {
|
|
4
4
|
jsWorkerFileName: string;
|
|
5
5
|
routes: pulumi.Input<string>[];
|
|
6
6
|
env?: Record<string, pulumi.Input<string>>;
|
|
7
7
|
overrides?: cloudflare.WorkerScriptArgs;
|
|
8
8
|
};
|
|
9
|
-
export type SetRecordConfig = {
|
|
9
|
+
export declare type SetRecordConfig = {
|
|
10
10
|
recordName: string;
|
|
11
11
|
type: "CNAME" | "A" | "TXT";
|
|
12
12
|
value: pulumi.Input<string>;
|
|
@@ -17,9 +17,8 @@ export type SetRecordConfig = {
|
|
|
17
17
|
proxied: true;
|
|
18
18
|
});
|
|
19
19
|
export declare function getZoneId(): Promise<string>;
|
|
20
|
-
export declare function getAccountId(): string;
|
|
21
20
|
export declare function deployWorker(workerName: string, config: DeployWorkerConfig): Promise<{
|
|
22
|
-
[x: string]: pulumi.Output<string> |
|
|
23
|
-
worker:
|
|
21
|
+
[x: string]: pulumi.Output<string> | cloudflare.WorkerScript;
|
|
22
|
+
worker: cloudflare.WorkerScript;
|
|
24
23
|
}>;
|
|
25
|
-
export declare function setRecord(config: SetRecordConfig): Promise<
|
|
24
|
+
export declare function setRecord(config: SetRecordConfig): Promise<cloudflare.Record>;
|
package/cloudflare.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.setRecord = exports.deployWorker = exports.
|
|
12
|
+
exports.setRecord = exports.deployWorker = exports.getZoneId = void 0;
|
|
13
13
|
const pulumi = require("@pulumi/pulumi");
|
|
14
14
|
const cloudflare = require("@pulumi/cloudflare");
|
|
15
15
|
const domain_1 = require("./domain");
|
|
@@ -23,15 +23,6 @@ function getZoneId() {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
exports.getZoneId = getZoneId;
|
|
26
|
-
function getAccountId() {
|
|
27
|
-
if (process.env.CLOUDFLARE_ACCOUNT_ID) {
|
|
28
|
-
return process.env.CLOUDFLARE_ACCOUNT_ID;
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
throw new Error("CLOUDFLARE_ACCOUNT_ID not set");
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.getAccountId = getAccountId;
|
|
35
26
|
function deployWorker(workerName, config) {
|
|
36
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
28
|
// get file contents
|
|
@@ -43,7 +34,7 @@ function deployWorker(workerName, config) {
|
|
|
43
34
|
});
|
|
44
35
|
// create the worker
|
|
45
36
|
const worker = new cloudflare.WorkerScript(`${workerName}-${domain_1.publicTLD}`, Object.assign({ name: `${workerName}-${domain_1.publicTLD}`, content,
|
|
46
|
-
plainTextBindings
|
|
37
|
+
plainTextBindings }, (config.overrides || {})));
|
|
47
38
|
const ret = { [workerName + "-" + domain_1.publicTLD]: worker.id, worker };
|
|
48
39
|
// create the routes
|
|
49
40
|
let count = 0;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import * as aws from "@pulumi/aws";
|
|
1
2
|
import { BucketArgs } from "@pulumi/aws/s3/bucket";
|
|
2
3
|
import * as pulumi from "@pulumi/pulumi";
|
|
3
4
|
export declare function createBucketWithUser(name: string, bucketArgs?: BucketArgs): {
|
|
4
|
-
role:
|
|
5
|
+
role: aws.iam.Role;
|
|
5
6
|
user: pulumi.Output<string>;
|
|
6
7
|
bucket: pulumi.Output<string>;
|
|
7
8
|
bucketPolicyId: pulumi.Output<string>;
|
package/createFargateTask.d.ts
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import * as aws from "@pulumi/aws";
|
|
2
|
+
import * as awsx from "@pulumi/awsx";
|
|
3
|
+
import { ApplicationTargetGroupHealthCheck } from "@pulumi/awsx/lb";
|
|
2
4
|
import * as pulumi from "@pulumi/pulumi";
|
|
3
5
|
import { ExtraExposedServiceOptions } from "./exposePublicService";
|
|
4
|
-
export declare const getDefaultLogs: (serviceName: string, logGroup: aws.cloudwatch.LogGroup) => aws.ecs.LogConfiguration
|
|
5
|
-
export declare function getClusterInstance(cluster: string |
|
|
6
|
-
export type ALBMapping = {
|
|
6
|
+
export declare const getDefaultLogs: (serviceName: string, logGroup: aws.cloudwatch.LogGroup) => pulumi.Output<aws.ecs.LogConfiguration>;
|
|
7
|
+
export declare function getClusterInstance(cluster: string | awsx.ecs.Cluster | undefined): awsx.ecs.Cluster;
|
|
8
|
+
export declare type ALBMapping = {
|
|
7
9
|
domain: string;
|
|
8
10
|
dockerListeningPort: number;
|
|
9
|
-
healthCheck?: Partial<
|
|
11
|
+
healthCheck?: Partial<ApplicationTargetGroupHealthCheck>;
|
|
10
12
|
extraExposedServiceOptions?: ExtraExposedServiceOptions;
|
|
11
13
|
};
|
|
12
14
|
export declare function getFargateExecutionRole(name: string, policyArnNamedMap: Record<string, pulumi.Input<string> | aws.iam.Policy>): {
|
|
13
|
-
role:
|
|
14
|
-
policies:
|
|
15
|
+
role: aws.iam.Role;
|
|
16
|
+
policies: aws.iam.RolePolicyAttachment[];
|
|
15
17
|
};
|
|
16
18
|
export declare function getFargateTaskRole(name: string, policyArnNamedMap: Record<string, pulumi.Input<string> | aws.iam.Policy>): {
|
|
17
|
-
role:
|
|
18
|
-
policies:
|
|
19
|
+
role: aws.iam.Role;
|
|
20
|
+
policies: aws.iam.RolePolicyAttachment[];
|
|
19
21
|
};
|
|
20
|
-
export type FargateTaskOptions = {
|
|
22
|
+
export declare type FargateTaskOptions = {
|
|
21
23
|
securityGroups?: (string | pulumi.Output<string>)[];
|
|
22
|
-
cluster?:
|
|
23
|
-
healthCheck?: Partial<
|
|
24
|
+
cluster?: awsx.ecs.Cluster | string;
|
|
25
|
+
healthCheck?: Partial<ApplicationTargetGroupHealthCheck>;
|
|
24
26
|
desiredCount?: number;
|
|
25
27
|
memoryReservation?: number;
|
|
26
28
|
cpuReservation?: number;
|
|
@@ -36,7 +38,7 @@ export type FargateTaskOptions = {
|
|
|
36
38
|
extraALBMappings?: ALBMapping[];
|
|
37
39
|
executionRolePolicies?: Record<string, pulumi.Input<string> | aws.iam.Policy>;
|
|
38
40
|
taskRolePolicies?: Record<string, pulumi.Input<string> | aws.iam.Policy>;
|
|
39
|
-
secrets?: aws.ecs.Secret[]
|
|
41
|
+
secrets?: aws.ecs.Secret[] | pulumi.Input<aws.ecs.Secret[]>;
|
|
40
42
|
ignoreServiceDiscovery?: boolean;
|
|
41
43
|
team: "dapps" | "platform" | "data" | "marketing" | "infra";
|
|
42
44
|
metrics?: {
|
|
@@ -48,8 +50,8 @@ export type FargateTaskOptions = {
|
|
|
48
50
|
dependsOn?: pulumi.Resource[];
|
|
49
51
|
volumes?: aws.types.input.ecs.TaskDefinitionVolume[] | pulumi.Input<aws.types.input.ecs.TaskDefinitionVolume[]>;
|
|
50
52
|
deregistrationDelay?: pulumi.Input<number>;
|
|
51
|
-
mountPoints?: aws.ecs.MountPoint[]
|
|
52
|
-
repositoryCredentials?: aws.ecs.RepositoryCredentials
|
|
53
|
+
mountPoints?: pulumi.Input<aws.ecs.MountPoint[]>;
|
|
54
|
+
repositoryCredentials?: pulumi.Input<aws.ecs.RepositoryCredentials>;
|
|
53
55
|
};
|
|
54
56
|
/**
|
|
55
57
|
*
|
|
@@ -63,38 +65,38 @@ export type FargateTaskOptions = {
|
|
|
63
65
|
* @param options.healthCheckPath
|
|
64
66
|
* @param options.policyArnNamedMap key-value named map of policies to attach to the default execution role for this task
|
|
65
67
|
*/
|
|
66
|
-
export declare function createFargateTask(serviceName: string, dockerImage: string | Promise<string> | pulumi.OutputInstance<string
|
|
68
|
+
export declare function createFargateTask(serviceName: string, dockerImage: string | Promise<string> | pulumi.OutputInstance<string> | awsx.ecs.ContainerImageProvider, dockerListeningPort: number, environment: {
|
|
67
69
|
name: string;
|
|
68
70
|
value: pulumi.Input<string>;
|
|
69
71
|
secret?: boolean;
|
|
70
72
|
}[], hostname: string, options: FargateTaskOptions): Promise<{
|
|
71
|
-
service:
|
|
73
|
+
service: awsx.ecs.FargateService;
|
|
72
74
|
endpoint: string;
|
|
73
75
|
exposed?: undefined;
|
|
74
76
|
} | {
|
|
75
77
|
endpoint: string;
|
|
76
|
-
service:
|
|
78
|
+
service: awsx.ecs.FargateService;
|
|
77
79
|
exposed: {
|
|
78
80
|
domain: string;
|
|
79
81
|
certificate: pulumi.Input<string>;
|
|
80
|
-
record:
|
|
81
|
-
targetGroup:
|
|
82
|
-
cloudflareRecord: import("@pulumi/cloudflare
|
|
82
|
+
record: void | aws.route53.Record;
|
|
83
|
+
targetGroup: awsx.elasticloadbalancingv2.ApplicationTargetGroup;
|
|
84
|
+
cloudflareRecord: void | import("@pulumi/cloudflare").Record;
|
|
83
85
|
};
|
|
84
86
|
}>;
|
|
85
|
-
export type InternalServiceOptions = {
|
|
87
|
+
export declare type InternalServiceOptions = {
|
|
86
88
|
serviceName: string;
|
|
87
|
-
cluster?: string |
|
|
88
|
-
securityGroups?:
|
|
89
|
+
cluster?: string | awsx.ecs.Cluster;
|
|
90
|
+
securityGroups?: awsx.ec2.SecurityGroupOrId[];
|
|
89
91
|
ignoreServiceDiscovery?: boolean;
|
|
90
92
|
serviceDiscoveryPort?: number;
|
|
91
93
|
desiredCount?: number;
|
|
92
94
|
executionRole?: aws.iam.Role;
|
|
93
95
|
taskRole?: aws.iam.Role;
|
|
94
|
-
containerInfo:
|
|
96
|
+
containerInfo: awsx.ecs.Container;
|
|
95
97
|
assignPublicIp?: boolean;
|
|
96
98
|
dependsOn?: pulumi.Resource[];
|
|
97
99
|
volumes?: pulumi.Input<aws.types.input.ecs.TaskDefinitionVolume[]>;
|
|
98
100
|
team: string;
|
|
99
101
|
};
|
|
100
|
-
export declare function createInternalService(config: InternalServiceOptions): Promise<
|
|
102
|
+
export declare function createInternalService(config: InternalServiceOptions): Promise<awsx.ecs.FargateService>;
|
package/createFargateTask.js
CHANGED
|
@@ -11,27 +11,27 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.createInternalService = exports.createFargateTask = exports.getFargateTaskRole = exports.getFargateExecutionRole = exports.getClusterInstance = exports.getDefaultLogs = void 0;
|
|
13
13
|
const aws = require("@pulumi/aws");
|
|
14
|
+
const awsx = require("@pulumi/awsx");
|
|
14
15
|
const pulumi = require("@pulumi/pulumi");
|
|
15
16
|
const acceptAlb_1 = require("./acceptAlb");
|
|
16
17
|
const acceptBastion_1 = require("./acceptBastion");
|
|
17
18
|
const domain_1 = require("./domain");
|
|
18
19
|
const exposePublicService_1 = require("./exposePublicService");
|
|
19
20
|
const network_1 = require("./network");
|
|
21
|
+
const utils_1 = require("./utils");
|
|
20
22
|
const vpc_1 = require("./vpc");
|
|
21
23
|
const supra_1 = require("./supra");
|
|
22
24
|
const stack_1 = require("./stack");
|
|
23
25
|
const prometheus_1 = require("./prometheus");
|
|
24
26
|
const accessTheInternet_1 = require("./accessTheInternet");
|
|
25
|
-
const getDefaultLogs = (serviceName, logGroup) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
};
|
|
27
|
+
const getDefaultLogs = (serviceName, logGroup) => pulumi.all([logGroup.id]).apply(([logGroupId]) => ({
|
|
28
|
+
logDriver: "awslogs",
|
|
29
|
+
options: {
|
|
30
|
+
"awslogs-group": logGroupId,
|
|
31
|
+
"awslogs-region": "us-east-1",
|
|
32
|
+
"awslogs-stream-prefix": serviceName,
|
|
33
|
+
},
|
|
34
|
+
}));
|
|
35
35
|
exports.getDefaultLogs = getDefaultLogs;
|
|
36
36
|
const extraOpts = {
|
|
37
37
|
customTimeouts: {
|
|
@@ -42,28 +42,29 @@ const extraOpts = {
|
|
|
42
42
|
};
|
|
43
43
|
const cachedClusterInstances = {};
|
|
44
44
|
function getClusterInstance(cluster) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
return cachedClusterInstances[cluster];
|
|
45
|
+
if (undefined === cluster) {
|
|
46
|
+
const defaultClusterName = `${domain_1.env}-main`;
|
|
47
|
+
cluster = defaultClusterName;
|
|
48
|
+
}
|
|
49
|
+
if (typeof cluster === "string") {
|
|
50
|
+
if (!cachedClusterInstances[cluster]) {
|
|
51
|
+
cachedClusterInstances[cluster] = new awsx.ecs.Cluster(cluster + "-ref", {
|
|
52
|
+
cluster: aws.ecs.Cluster.get(cluster + "-ref-2", cluster),
|
|
53
|
+
});
|
|
55
54
|
}
|
|
56
|
-
return cluster
|
|
57
|
-
}
|
|
55
|
+
return cachedClusterInstances[cluster];
|
|
56
|
+
}
|
|
57
|
+
return cluster;
|
|
58
58
|
}
|
|
59
59
|
exports.getClusterInstance = getClusterInstance;
|
|
60
60
|
function getFargateExecutionRole(name, policyArnNamedMap) {
|
|
61
|
-
const assumeRolePolicy =
|
|
62
|
-
Service: "ecs-tasks.amazonaws.com",
|
|
63
|
-
});
|
|
61
|
+
const assumeRolePolicy = awsx.ecs.TaskDefinition.defaultRoleAssumeRolePolicy();
|
|
64
62
|
const dependsOn = Object.values(policyArnNamedMap).filter(($) => $ instanceof pulumi.Resource);
|
|
65
63
|
const role = new aws.iam.Role(name, { assumeRolePolicy }, { dependsOn });
|
|
66
64
|
const policies = [];
|
|
65
|
+
awsx.ecs.TaskDefinition.defaultExecutionRolePolicyARNs().forEach((policyArn) => {
|
|
66
|
+
policies.push(new aws.iam.RolePolicyAttachment(`${name}-default-${(0, utils_1.sha256hash)(policyArn)}`, { role, policyArn }, { parent: role }));
|
|
67
|
+
});
|
|
67
68
|
Object.entries(policyArnNamedMap).forEach(([key, policyArn]) => {
|
|
68
69
|
if (policyArn instanceof aws.iam.Policy) {
|
|
69
70
|
policies.push(new aws.iam.RolePolicyAttachment(`${name}-${key}`, { role, policyArn: policyArn.arn }, { parent: role }));
|
|
@@ -76,12 +77,13 @@ function getFargateExecutionRole(name, policyArnNamedMap) {
|
|
|
76
77
|
}
|
|
77
78
|
exports.getFargateExecutionRole = getFargateExecutionRole;
|
|
78
79
|
function getFargateTaskRole(name, policyArnNamedMap) {
|
|
79
|
-
const assumeRolePolicy =
|
|
80
|
-
Service: "ecs-tasks.amazonaws.com",
|
|
81
|
-
});
|
|
80
|
+
const assumeRolePolicy = awsx.ecs.TaskDefinition.defaultRoleAssumeRolePolicy();
|
|
82
81
|
const dependsOn = Object.values(policyArnNamedMap).filter(($) => $ instanceof pulumi.Resource);
|
|
83
82
|
const role = new aws.iam.Role(name, { assumeRolePolicy }, { dependsOn });
|
|
84
83
|
const policies = [];
|
|
84
|
+
awsx.ecs.TaskDefinition.defaultTaskRolePolicyARNs().forEach((policyArn) => {
|
|
85
|
+
policies.push(new aws.iam.RolePolicyAttachment(`${name}-default-${(0, utils_1.sha256hash)(policyArn)}`, { role, policyArn }, { parent: role }));
|
|
86
|
+
});
|
|
85
87
|
Object.entries(policyArnNamedMap).forEach(([key, policyArn]) => {
|
|
86
88
|
if (policyArn instanceof aws.iam.Policy) {
|
|
87
89
|
policies.push(new aws.iam.RolePolicyAttachment(`${name}-${key}`, { role, policyArn: policyArn.arn }, { parent: role }));
|
|
@@ -136,10 +138,7 @@ function createFargateTask(serviceName, dockerImage, dockerListeningPort, enviro
|
|
|
136
138
|
dependsOn = [];
|
|
137
139
|
}
|
|
138
140
|
if (undefined === mountPoints) {
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
if (undefined === secrets) {
|
|
142
|
-
secrets = [];
|
|
141
|
+
dependsOn = [];
|
|
143
142
|
}
|
|
144
143
|
const { role: executionRole, policies: executionPolicies } = getFargateExecutionRole(`${serviceName}-${version}-execution`, executionRolePolicies || {});
|
|
145
144
|
dependsOn.push(...executionPolicies);
|
|
@@ -159,9 +158,8 @@ function createFargateTask(serviceName, dockerImage, dockerListeningPort, enviro
|
|
|
159
158
|
// this port should be the internal port used for administrative purposes
|
|
160
159
|
let serviceDiscoveryPort = dockerListeningPort;
|
|
161
160
|
const vpc = yield (0, vpc_1.getVpc)();
|
|
162
|
-
const taskSecurityGroup = new
|
|
163
|
-
|
|
164
|
-
tags: { ServiceName: serviceName, Team: team },
|
|
161
|
+
const taskSecurityGroup = new awsx.ec2.SecurityGroup(`${serviceName}-${version}`, {
|
|
162
|
+
vpc,
|
|
165
163
|
});
|
|
166
164
|
if (dockerLabels.ECS_PROMETHEUS_EXPORTER_PORT) {
|
|
167
165
|
let fromPort = 0;
|
|
@@ -172,13 +170,11 @@ function createFargateTask(serviceName, dockerImage, dockerListeningPort, enviro
|
|
|
172
170
|
if (toPort == 0 || toPort < port)
|
|
173
171
|
toPort = port;
|
|
174
172
|
// create a security group to enable metrics access by cwagent from inside the VPC
|
|
175
|
-
|
|
176
|
-
type: "ingress",
|
|
173
|
+
taskSecurityGroup.createIngressRule(`metrics-${port}`, {
|
|
177
174
|
fromPort: port,
|
|
178
175
|
toPort: port,
|
|
179
176
|
protocol: "tcp",
|
|
180
|
-
cidrBlocks: [vpc.cidrBlock],
|
|
181
|
-
securityGroupId: taskSecurityGroup.id,
|
|
177
|
+
cidrBlocks: [vpc.vpc.cidrBlock],
|
|
182
178
|
});
|
|
183
179
|
if (!extraPortMappings.find(($) => $.hostPort != metrics.port) && (port != dockerListeningPort || dontExpose)) {
|
|
184
180
|
extraPortMappings.push({
|
|
@@ -193,7 +189,7 @@ function createFargateTask(serviceName, dockerImage, dockerListeningPort, enviro
|
|
|
193
189
|
(0, prometheus_1.makeSecurityGroupAccessibleByPrometheus)(taskSecurityGroup, fromPort, toPort);
|
|
194
190
|
}
|
|
195
191
|
// enable egress traffic from the task to the internet
|
|
196
|
-
(0, accessTheInternet_1.
|
|
192
|
+
(0, accessTheInternet_1.makeSecurityGroupAccessTheInternet)(taskSecurityGroup);
|
|
197
193
|
// make the container fully accessible from the bastion of the environment
|
|
198
194
|
(0, acceptBastion_1.makeSecurityGroupAccessibleFromBastion)(taskSecurityGroup);
|
|
199
195
|
if (dontExpose) {
|
|
@@ -206,8 +202,7 @@ function createFargateTask(serviceName, dockerImage, dockerListeningPort, enviro
|
|
|
206
202
|
ignoreServiceDiscovery,
|
|
207
203
|
securityGroups: [taskSecurityGroup.id, ...securityGroups],
|
|
208
204
|
containerInfo: {
|
|
209
|
-
|
|
210
|
-
secrets: [],
|
|
205
|
+
secrets,
|
|
211
206
|
environment,
|
|
212
207
|
essential,
|
|
213
208
|
image: dockerImage,
|
|
@@ -233,12 +228,8 @@ function createFargateTask(serviceName, dockerImage, dockerListeningPort, enviro
|
|
|
233
228
|
for (let extraALBMapping of extraALBMappings) {
|
|
234
229
|
const exposedExtra = yield (0, exposePublicService_1.exposePublicService)(`${serviceName}-${extraALBMapping.dockerListeningPort}-${version}`, extraALBMapping.domain, extraALBMapping.dockerListeningPort, extraALBMapping.healthCheck, undefined, extraALBMapping.extraExposedServiceOptions);
|
|
235
230
|
extraALBMappingsExposed.push(exposedExtra.targetGroup);
|
|
236
|
-
extraPortMappings.push({
|
|
237
|
-
containerPort: extraALBMapping.dockerListeningPort,
|
|
238
|
-
hostPort: extraALBMapping.dockerListeningPort,
|
|
239
|
-
});
|
|
240
231
|
}
|
|
241
|
-
const portMapping =
|
|
232
|
+
const portMapping = exposed.targetGroup;
|
|
242
233
|
// make the service accesible by the ALB
|
|
243
234
|
(0, acceptAlb_1.makeSecurityGroupAccessibleFromSharedAlb)(taskSecurityGroup);
|
|
244
235
|
const service = yield createInternalService({
|
|
@@ -252,10 +243,9 @@ function createFargateTask(serviceName, dockerImage, dockerListeningPort, enviro
|
|
|
252
243
|
securityGroups: [taskSecurityGroup.id, ...securityGroups],
|
|
253
244
|
serviceDiscoveryPort,
|
|
254
245
|
containerInfo: {
|
|
255
|
-
name: serviceName,
|
|
256
246
|
secrets,
|
|
257
247
|
environment,
|
|
258
|
-
portMappings: [...extraPortMappings, portMapping],
|
|
248
|
+
portMappings: [...extraPortMappings, ...extraALBMappingsExposed, portMapping],
|
|
259
249
|
essential,
|
|
260
250
|
image: dockerImage,
|
|
261
251
|
command,
|
|
@@ -302,27 +292,26 @@ function createInternalService(config) {
|
|
|
302
292
|
retentionInDays: 60,
|
|
303
293
|
tags: { ServiceName: serviceName, Team: team },
|
|
304
294
|
});
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
taskRoleArn: taskRole === null || taskRole === void 0 ? void 0 : taskRole.arn,
|
|
308
|
-
tags: { ServiceName: serviceName, Team: team },
|
|
309
|
-
containerDefinitions: JSON.stringify([Object.assign(Object.assign({}, containerInfo), { logConfiguration: (0, exports.getDefaultLogs)(serviceName, logGroup) })]),
|
|
310
|
-
volumes: volumes,
|
|
311
|
-
family: (0, stack_1.getStackScopedName)(serviceName),
|
|
312
|
-
}, { dependsOn: [logGroup] });
|
|
313
|
-
return new aws.ecs.Service((0, stack_1.getStackScopedName)(serviceName), {
|
|
314
|
-
cluster: yield getClusterInstance(cluster),
|
|
295
|
+
return new awsx.ecs.FargateService((0, stack_1.getStackScopedName)(serviceName), {
|
|
296
|
+
cluster: getClusterInstance(cluster),
|
|
315
297
|
tags: { ServiceName: serviceName, StackId: (0, stack_1.getStackId)() },
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
securityGroups: securityGroups,
|
|
319
|
-
assignPublicIp
|
|
320
|
-
},
|
|
298
|
+
subnets: yield (0, network_1.getPrivateSubnetIds)(),
|
|
299
|
+
securityGroups: securityGroups,
|
|
321
300
|
serviceRegistries,
|
|
322
301
|
desiredCount,
|
|
323
302
|
enableEcsManagedTags: true,
|
|
303
|
+
assignPublicIp,
|
|
324
304
|
waitForSteadyState: false,
|
|
325
|
-
|
|
305
|
+
taskDefinitionArgs: {
|
|
306
|
+
executionRole,
|
|
307
|
+
taskRole,
|
|
308
|
+
tags: { ServiceName: serviceName, Team: team },
|
|
309
|
+
logGroup,
|
|
310
|
+
containers: {
|
|
311
|
+
[serviceName]: Object.assign({ logConfiguration: (0, exports.getDefaultLogs)(serviceName, logGroup) }, containerInfo),
|
|
312
|
+
},
|
|
313
|
+
volumes: volumes,
|
|
314
|
+
},
|
|
326
315
|
}, Object.assign(Object.assign({}, extraOpts), { dependsOn }));
|
|
327
316
|
});
|
|
328
317
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import * as aws from "@pulumi/aws";
|
|
1
2
|
import * as docker from "@pulumi/docker";
|
|
2
3
|
import * as pulumi from "@pulumi/pulumi";
|
|
3
|
-
export declare function createImageFromContext(name: string, context: string, options?: Partial<docker.
|
|
4
|
-
ecr:
|
|
4
|
+
export declare function createImageFromContext(name: string, context: string, options?: Partial<docker.DockerBuild>, imageOpts?: pulumi.ComponentResourceOptions): {
|
|
5
|
+
ecr: aws.ecr.Repository;
|
|
5
6
|
registry: pulumi.Output<{
|
|
6
7
|
server: string;
|
|
7
8
|
username: string;
|
|
8
9
|
password: string;
|
|
9
10
|
}>;
|
|
10
|
-
image:
|
|
11
|
+
image: docker.Image;
|
|
11
12
|
};
|
|
@@ -9,7 +9,7 @@ function createImageFromContext(name, context, options, imageOpts) {
|
|
|
9
9
|
const registry = (0, getImageRegistryAndCredentials_1.getImageRegistryAndCredentials)(ecr);
|
|
10
10
|
const image = new docker.Image(`${name}-image`, {
|
|
11
11
|
imageName: ecr.repositoryUrl,
|
|
12
|
-
build: Object.assign({ context,
|
|
12
|
+
build: Object.assign({ context, cacheFrom: true, env: {
|
|
13
13
|
DOCKER_BUILDKIT: "1",
|
|
14
14
|
} }, options),
|
|
15
15
|
registry: registry,
|
package/exposePublicService.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import * as pulumi from "@pulumi/pulumi";
|
|
2
2
|
import * as aws from "@pulumi/aws";
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import * as awsx from "@pulumi/awsx";
|
|
4
|
+
import * as cf from "@pulumi/cloudflare";
|
|
5
|
+
import { ApplicationTargetGroupHealthCheck } from "@pulumi/awsx/lb";
|
|
6
|
+
export declare type ProxiedCloudflareDomain = {
|
|
5
7
|
createCloudflareProxiedSubdomain: true;
|
|
6
8
|
};
|
|
7
|
-
export type UnproxiedCloudflareDomain = {
|
|
9
|
+
export declare type UnproxiedCloudflareDomain = {
|
|
8
10
|
createCloudflareDNSWithoutProxy: true;
|
|
9
11
|
ttl: number;
|
|
10
12
|
};
|
|
11
|
-
export type CloudflareDomainOptions = ProxiedCloudflareDomain | UnproxiedCloudflareDomain | {};
|
|
12
|
-
export type ExtraExposedServiceOptions = CloudflareDomainOptions & {
|
|
13
|
+
export declare type CloudflareDomainOptions = ProxiedCloudflareDomain | UnproxiedCloudflareDomain | {};
|
|
14
|
+
export declare type ExtraExposedServiceOptions = CloudflareDomainOptions & {
|
|
13
15
|
skipInternalDomain?: boolean;
|
|
14
16
|
targetGroupConditions?: pulumi.Input<aws.types.input.alb.ListenerRuleCondition>[];
|
|
15
17
|
};
|
|
@@ -22,10 +24,10 @@ export type ExtraExposedServiceOptions = CloudflareDomainOptions & {
|
|
|
22
24
|
* @param domain
|
|
23
25
|
* @param port
|
|
24
26
|
*/
|
|
25
|
-
export declare function exposePublicService(name: string, domain: string, port: number, healthCheck?: Partial<
|
|
27
|
+
export declare function exposePublicService(name: string, domain: string, port: number, healthCheck?: Partial<ApplicationTargetGroupHealthCheck>, vpc?: awsx.ec2.Vpc, extraOptions?: ExtraExposedServiceOptions, deregistrationDelay?: pulumi.Input<number>): Promise<{
|
|
26
28
|
domain: string;
|
|
27
29
|
certificate: pulumi.Input<string>;
|
|
28
|
-
record:
|
|
29
|
-
targetGroup:
|
|
30
|
-
cloudflareRecord:
|
|
30
|
+
record: void | aws.route53.Record;
|
|
31
|
+
targetGroup: awsx.elasticloadbalancingv2.ApplicationTargetGroup;
|
|
32
|
+
cloudflareRecord: void | cf.Record;
|
|
31
33
|
}>;
|
package/exposePublicService.js
CHANGED
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.exposePublicService = void 0;
|
|
13
13
|
const aws = require("@pulumi/aws");
|
|
14
|
+
const awsx = require("@pulumi/awsx");
|
|
14
15
|
const domain_1 = require("./domain");
|
|
15
16
|
const alb_1 = require("./alb");
|
|
16
17
|
const certificate_1 = require("./certificate");
|
|
@@ -49,13 +50,13 @@ function exposePublicService(name, domain, port, healthCheck = {}, vpc, extraOpt
|
|
|
49
50
|
const createInternalDomain = !onlyCloudflare;
|
|
50
51
|
const certificate = (0, certificate_1.getCertificateFor)(domain);
|
|
51
52
|
const slug = name;
|
|
52
|
-
const targetVpc = vpc ? vpc :
|
|
53
|
+
const targetVpc = vpc ? vpc : awsx.ec2.Vpc.getDefault();
|
|
53
54
|
const targetDeregistrationDelay = deregistrationDelay ? deregistrationDelay : 300;
|
|
54
|
-
const targetGroup =
|
|
55
|
+
const targetGroup = alb.createTargetGroup("tg-" + slug.substr(-32 + 12) /* last 32 chars, and take 7 chars for the -hash appended by pulumi */, {
|
|
55
56
|
protocol: "HTTP",
|
|
56
57
|
port,
|
|
57
58
|
healthCheck: healthCheckValue,
|
|
58
|
-
|
|
59
|
+
vpc: targetVpc,
|
|
59
60
|
deregistrationDelay: targetDeregistrationDelay,
|
|
60
61
|
});
|
|
61
62
|
const domainParts = (0, getDomainAndSubdomain_1.getDomainAndSubdomain)(domain);
|
|
@@ -70,8 +71,8 @@ function exposePublicService(name, domain, port, healthCheck = {}, vpc, extraOpt
|
|
|
70
71
|
type: "A",
|
|
71
72
|
aliases: [
|
|
72
73
|
{
|
|
73
|
-
name: alb.dnsName,
|
|
74
|
-
zoneId: alb.zoneId,
|
|
74
|
+
name: alb.loadBalancer.dnsName,
|
|
75
|
+
zoneId: alb.loadBalancer.zoneId,
|
|
75
76
|
evaluateTargetHealth: false,
|
|
76
77
|
},
|
|
77
78
|
],
|
|
@@ -84,7 +85,7 @@ function exposePublicService(name, domain, port, healthCheck = {}, vpc, extraOpt
|
|
|
84
85
|
cloudflareRecord = yield (0, cloudflare_1.setRecord)({
|
|
85
86
|
recordName: domainParts.subdomain,
|
|
86
87
|
type: "CNAME",
|
|
87
|
-
value: alb.dnsName,
|
|
88
|
+
value: alb.loadBalancer.dnsName,
|
|
88
89
|
proxied: false,
|
|
89
90
|
ttl: extraOptions.ttl || 600,
|
|
90
91
|
});
|
|
@@ -93,7 +94,7 @@ function exposePublicService(name, domain, port, healthCheck = {}, vpc, extraOpt
|
|
|
93
94
|
cloudflareRecord = yield (0, cloudflare_1.setRecord)({
|
|
94
95
|
recordName: domainParts.subdomain,
|
|
95
96
|
type: "CNAME",
|
|
96
|
-
value: alb.dnsName,
|
|
97
|
+
value: alb.loadBalancer.dnsName,
|
|
97
98
|
proxied: true,
|
|
98
99
|
});
|
|
99
100
|
}
|
|
@@ -105,7 +106,7 @@ function exposePublicService(name, domain, port, healthCheck = {}, vpc, extraOpt
|
|
|
105
106
|
actions: [
|
|
106
107
|
{
|
|
107
108
|
type: "forward",
|
|
108
|
-
targetGroupArn: targetGroup.arn,
|
|
109
|
+
targetGroupArn: targetGroup.targetGroup.arn,
|
|
109
110
|
},
|
|
110
111
|
],
|
|
111
112
|
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as awsx from "@pulumi/awsx";
|
|
2
|
+
import { Output } from '@pulumi/pulumi';
|
|
3
|
+
export declare function createSecurityGroupFunction(name: string, id: string | Output<string>): {
|
|
4
|
+
getSecurityGroup: () => Promise<awsx.ec2.SecurityGroup | Output<awsx.ec2.SecurityGroup>>;
|
|
5
|
+
getSecurityGroupId: () => Promise<Output<string>>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.createSecurityGroupFunction = void 0;
|
|
13
|
+
const awsx = require("@pulumi/awsx");
|
|
14
|
+
function createSecurityGroupFunction(name, id) {
|
|
15
|
+
let securityGroupOutput;
|
|
16
|
+
let securityGroupPromise;
|
|
17
|
+
function getSecurityGroup() {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
if (!securityGroupOutput) {
|
|
20
|
+
if (!securityGroupPromise) {
|
|
21
|
+
securityGroupPromise = new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
try {
|
|
23
|
+
resolve(awsx.ec2.SecurityGroup.fromExistingId(name, id));
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
reject(e);
|
|
27
|
+
}
|
|
28
|
+
}));
|
|
29
|
+
return yield securityGroupPromise;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return yield securityGroupPromise;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
return securityGroupOutput;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function getSecurityGroupId() {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
return (yield getSecurityGroup()).id;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
getSecurityGroup: getSecurityGroup,
|
|
47
|
+
getSecurityGroupId: getSecurityGroupId
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
exports.createSecurityGroupFunction = createSecurityGroupFunction;
|
|
51
|
+
//# sourceMappingURL=getSecurityGroup.js.map
|
package/lambda.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import * as awsx from "@pulumi/awsx";
|
|
1
2
|
import * as aws from "@pulumi/aws";
|
|
2
|
-
import * as apigateway from "@pulumi/aws-apigateway";
|
|
3
3
|
import * as pulumi from "@pulumi/pulumi";
|
|
4
|
-
export type LambdaOptions = {
|
|
4
|
+
export declare type LambdaOptions = {
|
|
5
5
|
folderName: string;
|
|
6
6
|
extra?: Partial<aws.lambda.FunctionArgs>;
|
|
7
7
|
attachRolePolicyArn?: Record<string, pulumi.Input<string>>;
|
|
@@ -9,10 +9,11 @@ export type LambdaOptions = {
|
|
|
9
9
|
export declare function createGateway(options: {
|
|
10
10
|
fullyQualifiedDomainName: string;
|
|
11
11
|
}, fn: (addRoute: (config: LambdaOptions & {
|
|
12
|
-
method: apigateway.
|
|
12
|
+
method: awsx.apigateway.Method;
|
|
13
13
|
path: string;
|
|
14
|
+
extraRoute?: awsx.apigateway.BaseRoute;
|
|
14
15
|
}) => Promise<void>) => Promise<void>): Promise<{
|
|
15
|
-
gateway:
|
|
16
|
-
record:
|
|
16
|
+
gateway: awsx.apigateway.API;
|
|
17
|
+
record: aws.route53.Record;
|
|
17
18
|
lambdasDomain: string;
|
|
18
19
|
}>;
|
package/lambda.js
CHANGED
|
@@ -10,8 +10,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.createGateway = void 0;
|
|
13
|
+
const awsx = require("@pulumi/awsx");
|
|
13
14
|
const aws = require("@pulumi/aws");
|
|
14
|
-
const apigateway = require("@pulumi/aws-apigateway");
|
|
15
15
|
const pulumi = require("@pulumi/pulumi");
|
|
16
16
|
const path_1 = require("path");
|
|
17
17
|
const domain_1 = require("./domain");
|
|
@@ -66,7 +66,7 @@ function createLambda(fullyQualifiedDomainName, config) {
|
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
const name = (0, stack_1.getStackScopedName)((subdomain || "ROOTDOMAIN") + "-" + lambdaName);
|
|
69
|
-
const lambda = new aws.lambda.Function(name, Object.assign({ name: name, handler: `${(0, path_1.basename)(file, ".js")}.handler`, timeout: 900, memorySize: 1024, runtime: "
|
|
69
|
+
const lambda = new aws.lambda.Function(name, Object.assign({ name: name, handler: `${(0, path_1.basename)(file, ".js")}.handler`, timeout: 900, memorySize: 1024, runtime: "nodejs14.x", code: (extra === null || extra === void 0 ? void 0 : extra.code) ||
|
|
70
70
|
new pulumi.asset.AssetArchive({
|
|
71
71
|
[(0, path_1.basename)(file)]: new pulumi.asset.FileAsset(file),
|
|
72
72
|
}), role: (extra === null || extra === void 0 ? void 0 : extra.role) || lambdaApiGatewayRole.arn }, extra));
|
|
@@ -78,13 +78,9 @@ function createGateway(options, fn) {
|
|
|
78
78
|
const routes = [];
|
|
79
79
|
yield fn(function configureApiGatewayLambda(config) {
|
|
80
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
-
const { method, path } = config;
|
|
81
|
+
const { method, path, extraRoute } = config;
|
|
82
82
|
const lambda = yield createLambda(options.fullyQualifiedDomainName, config);
|
|
83
|
-
routes.push({
|
|
84
|
-
method: method,
|
|
85
|
-
path,
|
|
86
|
-
eventHandler: lambda
|
|
87
|
-
});
|
|
83
|
+
routes.push(Object.assign({ method: method, path, eventHandler: lambda }, extraRoute));
|
|
88
84
|
});
|
|
89
85
|
});
|
|
90
86
|
if (routes.length == 0) {
|
|
@@ -92,15 +88,15 @@ function createGateway(options, fn) {
|
|
|
92
88
|
}
|
|
93
89
|
const stageName = domain_1.env;
|
|
94
90
|
// Create a public HTTP endpoint (using AWS APIGateway)
|
|
95
|
-
const gateway = new apigateway.
|
|
91
|
+
const gateway = new awsx.apigateway.API((0, stack_1.getStackScopedName)(options.fullyQualifiedDomainName.replace(/\./g, "-")), {
|
|
96
92
|
routes: routes,
|
|
97
|
-
stageName
|
|
98
|
-
});
|
|
99
|
-
new aws.apigateway.Stage((0, stack_1.getStackScopedName)(`${options.fullyQualifiedDomainName.replace(/\./g, "-")}-stage`), {
|
|
100
|
-
restApi: gateway.api.id,
|
|
101
|
-
deployment: gateway.deployment.id,
|
|
102
93
|
stageName,
|
|
103
|
-
|
|
94
|
+
restApiArgs: {
|
|
95
|
+
name: "rest-api",
|
|
96
|
+
},
|
|
97
|
+
stageArgs: {
|
|
98
|
+
xrayTracingEnabled: true,
|
|
99
|
+
},
|
|
104
100
|
});
|
|
105
101
|
const { record, lambdasDomain } = yield configureApiGatewayDomain(options.fullyQualifiedDomainName, gateway);
|
|
106
102
|
return {
|
|
@@ -124,7 +120,7 @@ function configureApiGatewayDomain(fullyQualifiedDomainName, gateway) {
|
|
|
124
120
|
deleteBeforeReplace: true,
|
|
125
121
|
});
|
|
126
122
|
const webDomainMapping = new aws.apigateway.BasePathMapping((0, stack_1.getStackScopedName)(subdomain + "-bpm"), {
|
|
127
|
-
restApi: gateway.
|
|
123
|
+
restApi: gateway.restAPI,
|
|
128
124
|
stageName: gateway.stage.stageName,
|
|
129
125
|
domainName: webDomain.id,
|
|
130
126
|
}, { dependsOn: [webDomain], deleteBeforeReplace: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dcl-ops-lib",
|
|
3
|
-
"version": "5.26.
|
|
3
|
+
"version": "5.26.4",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "tsc && cp bin/* . && node test.js",
|
|
6
6
|
"clean": "rm *.d.ts *.js *.js.map"
|
|
@@ -20,20 +20,18 @@
|
|
|
20
20
|
"extends": "@semantic-release/gitlab-config"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@semantic-release/gitlab-config": "^
|
|
24
|
-
"@types/mime": "^3.0.
|
|
25
|
-
"@types/node": "^
|
|
26
|
-
"semantic-release": "^
|
|
27
|
-
"typescript": "^
|
|
23
|
+
"@semantic-release/gitlab-config": "^10.0.1",
|
|
24
|
+
"@types/mime": "^3.0.1",
|
|
25
|
+
"@types/node": "^18.7.13",
|
|
26
|
+
"semantic-release": "^19.0.5",
|
|
27
|
+
"typescript": "^4.7.4"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@pulumi/aws": "
|
|
31
|
-
"@pulumi/
|
|
32
|
-
"@pulumi/
|
|
33
|
-
"@pulumi/
|
|
34
|
-
"@pulumi/
|
|
35
|
-
"@pulumi/docker": "4.5.0",
|
|
36
|
-
"@pulumi/pulumi": "3.94.2",
|
|
30
|
+
"@pulumi/aws": "5.11.0",
|
|
31
|
+
"@pulumi/awsx": "0.40.0",
|
|
32
|
+
"@pulumi/cloudflare": "4.9.0",
|
|
33
|
+
"@pulumi/docker": "3.4.1",
|
|
34
|
+
"@pulumi/pulumi": "3.38.0",
|
|
37
35
|
"mime": "^3.0.0"
|
|
38
36
|
}
|
|
39
37
|
}
|
package/prometheus.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import * as pulumi from "@pulumi/pulumi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as awsx from "@pulumi/awsx";
|
|
3
3
|
export declare const prometheusStack: () => Promise<pulumi.StackReference>;
|
|
4
4
|
export declare const prometheusSecurityGroupId: () => Promise<string>;
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated use makeSecurityGroupAccessibleByPrometheusV2
|
|
7
|
+
*/
|
|
8
|
+
export declare function makeSecurityGroupAccessibleByPrometheus(securityGroup: awsx.ec2.SecurityGroup, fromPort?: number, toPort?: number): void;
|
|
9
|
+
export declare function makeSecurityGroupAccessibleByPrometheusV2(securityGroup: awsx.ec2.SecurityGroup, fromPort?: number, toPort?: number, ruleName?: string): void;
|
package/prometheus.js
CHANGED
|
@@ -9,9 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.makeSecurityGroupAccessibleByPrometheus = exports.prometheusSecurityGroupId = exports.prometheusStack = void 0;
|
|
12
|
+
exports.makeSecurityGroupAccessibleByPrometheusV2 = exports.makeSecurityGroupAccessibleByPrometheus = exports.prometheusSecurityGroupId = exports.prometheusStack = void 0;
|
|
13
13
|
const pulumi = require("@pulumi/pulumi");
|
|
14
|
-
const
|
|
14
|
+
const awsx = require("@pulumi/awsx");
|
|
15
15
|
const domain_1 = require("./domain");
|
|
16
16
|
const withCache_1 = require("./withCache");
|
|
17
17
|
const utils_1 = require("./utils");
|
|
@@ -22,16 +22,27 @@ exports.prometheusSecurityGroupId = (0, withCache_1.default)(() => __awaiter(voi
|
|
|
22
22
|
const prom = yield (0, exports.prometheusStack)();
|
|
23
23
|
return (yield prom.requireOutputValue("prometheusSecurityGroupId"));
|
|
24
24
|
}));
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated use makeSecurityGroupAccessibleByPrometheusV2
|
|
27
|
+
*/
|
|
28
|
+
function makeSecurityGroupAccessibleByPrometheus(securityGroup, fromPort = 0, toPort = 0) {
|
|
29
|
+
new awsx.ec2.IngressSecurityGroupRule(`accept-prom-${fromPort}-${toPort}`, securityGroup, {
|
|
27
30
|
sourceSecurityGroupId: (0, exports.prometheusSecurityGroupId)(),
|
|
28
31
|
description: `Allow access from prometheus`,
|
|
29
32
|
fromPort,
|
|
30
33
|
toPort,
|
|
31
34
|
protocol: "-1",
|
|
32
|
-
|
|
33
|
-
securityGroupId: securityGroup.id,
|
|
34
|
-
}, { deleteBeforeReplace: true });
|
|
35
|
+
});
|
|
35
36
|
}
|
|
36
37
|
exports.makeSecurityGroupAccessibleByPrometheus = makeSecurityGroupAccessibleByPrometheus;
|
|
38
|
+
function makeSecurityGroupAccessibleByPrometheusV2(securityGroup, fromPort = 0, toPort = 0, ruleName = "") {
|
|
39
|
+
new awsx.ec2.IngressSecurityGroupRule((0, utils_1.withRuleName)(`accept-prom-${fromPort}-${toPort}-v2`, ruleName), securityGroup, {
|
|
40
|
+
sourceSecurityGroupId: (0, exports.prometheusSecurityGroupId)(),
|
|
41
|
+
description: `Allow access from prometheus`,
|
|
42
|
+
fromPort,
|
|
43
|
+
toPort,
|
|
44
|
+
protocol: "-1",
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
exports.makeSecurityGroupAccessibleByPrometheusV2 = makeSecurityGroupAccessibleByPrometheusV2;
|
|
37
48
|
//# sourceMappingURL=prometheus.js.map
|
package/secrets.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import * as aws from '@pulumi/aws';
|
|
1
2
|
import * as pulumi from '@pulumi/pulumi';
|
|
2
|
-
export declare function secretToSSM(name: string, secureString: pulumi.Output<string>):
|
|
3
|
+
export declare function secretToSSM(name: string, secureString: pulumi.Output<string>): aws.ssm.Parameter;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupDatabasePermissions = void 0;
|
|
4
|
+
function setupDatabasePermissions(databaseName, databaseUsername, databasePassword) {
|
|
5
|
+
// Creating users in terraform+pulumi+aws+postgres is utterly broken.
|
|
6
|
+
// Need to do this manually.
|
|
7
|
+
//
|
|
8
|
+
// CREATE DATABASE databaseName;
|
|
9
|
+
// CREATE ROLE databaseUsername WITH LOGIN PASSWORD 'password';
|
|
10
|
+
// GRANT ALL PRIVILEGES ON DATABASE databaseUsername TO databaseUsername;
|
|
11
|
+
throw new Error(`You need to do the DB setup manually. Sorry about it!
|
|
12
|
+
Please connect to the db through the bastion node and run:
|
|
13
|
+
CREATE DATABASE databaseName;
|
|
14
|
+
CREATE ROLE databaseUsername WITH LOGIN PASSWORD 'password';
|
|
15
|
+
GRANT ALL PRIVILEGES ON DATABASE databaseUsername TO databaseUsername;`);
|
|
16
|
+
}
|
|
17
|
+
exports.setupDatabasePermissions = setupDatabasePermissions;
|
|
18
|
+
//# sourceMappingURL=setupDatabasePermissions.js.map
|
package/values.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { Subnet } from "@pulumi/awsx/ec2";
|
|
2
|
+
export declare type EnvironmentValues = {
|
|
2
3
|
defaultSecurityGroupId: string;
|
|
3
|
-
publicSubnets:
|
|
4
|
-
privateSubnets:
|
|
5
|
-
internalSubnets:
|
|
4
|
+
publicSubnets: Subnet[];
|
|
5
|
+
privateSubnets: Subnet[];
|
|
6
|
+
internalSubnets: Subnet[];
|
|
6
7
|
/** @deprecated */
|
|
7
8
|
acceptAlb: string;
|
|
8
9
|
/** @deprecated */
|
package/values.js
CHANGED
|
@@ -10,16 +10,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.getEnvConfiguration = void 0;
|
|
13
|
-
const aws = require("@pulumi/aws");
|
|
14
13
|
const supra_1 = require("./supra");
|
|
14
|
+
const vpc_1 = require("./vpc");
|
|
15
15
|
const withCache_1 = require("./withCache");
|
|
16
16
|
exports.getEnvConfiguration = (0, withCache_1.default)(function () {
|
|
17
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
18
|
return {
|
|
19
19
|
defaultSecurityGroupId: yield supra_1.supra.getOutputValue("acceptBastionSecurityGroupId"),
|
|
20
|
-
publicSubnets: (yield
|
|
21
|
-
privateSubnets: (yield
|
|
22
|
-
internalSubnets: (yield
|
|
20
|
+
publicSubnets: yield (yield (0, vpc_1.vpc)()).publicSubnets,
|
|
21
|
+
privateSubnets: yield (yield (0, vpc_1.vpc)()).privateSubnets,
|
|
22
|
+
internalSubnets: yield (yield (0, vpc_1.vpc)()).isolatedSubnets,
|
|
23
23
|
acceptAlb: yield supra_1.supra.getOutputValue("acceptAlbSecurityGroupId"),
|
|
24
24
|
acceptBastion: yield supra_1.supra.getOutputValue("acceptBastionSecurityGroupId"),
|
|
25
25
|
dbSecurity: yield supra_1.supra.getOutputValue("acceptDbSecurityGroupId"),
|
package/vpc.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
export declare function vpc(): Promise<
|
|
1
|
+
import * as awsx from '@pulumi/awsx';
|
|
2
|
+
export declare function vpc(): Promise<awsx.ec2.Vpc>;
|
|
3
3
|
export declare const getVpc: typeof vpc;
|
package/vpc.js
CHANGED
|
@@ -10,14 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.getVpc = exports.vpc = void 0;
|
|
13
|
-
const
|
|
13
|
+
const awsx = require("@pulumi/awsx");
|
|
14
14
|
const supra_1 = require("./supra");
|
|
15
15
|
let vpcReference;
|
|
16
16
|
function vpc() {
|
|
17
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
18
|
if (!vpcReference) {
|
|
19
|
-
vpcReference =
|
|
20
|
-
|
|
19
|
+
vpcReference = awsx.ec2.Vpc.fromExistingIds(`vpc-reference`, {
|
|
20
|
+
vpcId: yield supra_1.supra.getOutputValue('vpcId')
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
return vpcReference;
|