@studion/infra-code-blocks 0.8.0-next.2 → 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/acm-certificate/index.d.ts +20 -0
- package/dist/components/acm-certificate/index.d.ts.map +1 -0
- package/dist/components/acm-certificate/index.js +40 -0
- package/dist/components/cloudfront/index.d.ts +97 -0
- package/dist/components/cloudfront/index.d.ts.map +1 -0
- package/dist/components/cloudfront/index.js +215 -0
- package/dist/components/cloudfront/lb-cache-strategy.d.ts +21 -0
- package/dist/components/cloudfront/lb-cache-strategy.d.ts.map +1 -0
- package/dist/components/cloudfront/lb-cache-strategy.js +93 -0
- package/dist/components/cloudfront/s3-cache-strategy.d.ts +22 -0
- package/dist/components/cloudfront/s3-cache-strategy.d.ts.map +1 -0
- package/dist/components/cloudfront/s3-cache-strategy.js +79 -0
- package/dist/components/cloudfront/types.d.ts +10 -0
- package/dist/components/cloudfront/types.d.ts.map +1 -0
- package/dist/components/database/builder.d.ts +32 -0
- package/dist/components/database/builder.d.ts.map +1 -0
- package/dist/components/database/builder.js +82 -0
- package/dist/components/database/database-replica.d.ts +35 -0
- package/dist/components/database/database-replica.d.ts.map +1 -0
- package/dist/components/database/database-replica.js +40 -0
- package/dist/components/database/ec2-ssm-connect.d.ts +26 -0
- package/dist/components/database/ec2-ssm-connect.d.ts.map +1 -0
- package/dist/components/{ec2-ssm-connect.js → database/ec2-ssm-connect.js} +42 -34
- package/dist/components/database/index.d.ts +67 -0
- package/dist/components/database/index.d.ts.map +1 -0
- package/dist/components/database/index.js +144 -0
- package/dist/{v2/components → components}/ecs-service/index.d.ts +4 -3
- package/dist/components/ecs-service/index.d.ts.map +1 -0
- package/dist/{v2/components → components}/ecs-service/index.js +18 -29
- package/dist/components/ecs-service/policies.d.ts.map +1 -0
- package/dist/components/ecs-service/task-size.d.ts +37 -0
- package/dist/components/ecs-service/task-size.d.ts.map +1 -0
- package/dist/{constants.js → components/ecs-service/task-size.js} +17 -7
- package/dist/components/grafana/dashboards/index.d.ts.map +1 -0
- package/dist/components/grafana/dashboards/panels.d.ts.map +1 -0
- package/dist/components/grafana/dashboards/types.d.ts.map +1 -0
- package/dist/components/grafana/dashboards/web-server-slo.d.ts.map +1 -0
- package/dist/components/grafana/index.d.ts.map +1 -0
- package/dist/components/{password.d.ts → password/index.d.ts} +7 -5
- package/dist/components/password/index.d.ts.map +1 -0
- package/dist/components/{password.js → password/index.js} +5 -8
- package/dist/components/prometheus/index.d.ts.map +1 -0
- package/dist/components/prometheus/queries.d.ts.map +1 -0
- package/dist/components/prometheus/queries.test.d.ts.map +1 -0
- package/dist/components/redis/elasticache-redis.d.ts +38 -0
- package/dist/components/redis/elasticache-redis.d.ts.map +1 -0
- package/dist/components/redis/elasticache-redis.js +58 -0
- package/dist/components/redis/upstash-redis.d.ts +20 -0
- package/dist/components/redis/upstash-redis.d.ts.map +1 -0
- package/dist/components/redis/upstash-redis.js +29 -0
- package/dist/components/static-site/cache-rule-ttl.d.ts +13 -0
- package/dist/components/static-site/cache-rule-ttl.d.ts.map +1 -0
- package/dist/components/static-site/cache-rule-ttl.js +18 -0
- package/dist/components/static-site/index.d.ts +47 -0
- package/dist/components/static-site/index.d.ts.map +1 -0
- package/dist/components/static-site/index.js +45 -0
- package/dist/components/static-site/s3-assets.d.ts +20 -0
- package/dist/components/static-site/s3-assets.d.ts.map +1 -0
- package/dist/components/static-site/s3-assets.js +63 -0
- package/dist/components/vpc/index.d.ts +20 -0
- package/dist/components/vpc/index.d.ts.map +1 -0
- package/dist/components/vpc/index.js +31 -0
- package/dist/{v2/components → components}/web-server/builder.d.ts +5 -1
- package/dist/components/web-server/builder.d.ts.map +1 -0
- package/dist/{v2/components → components}/web-server/builder.js +11 -1
- package/dist/{v2/components → components}/web-server/index.d.ts +29 -7
- package/dist/components/web-server/index.d.ts.map +1 -0
- package/dist/{v2/components → components}/web-server/index.js +48 -39
- package/dist/{v2/components → components}/web-server/load-balancer.d.ts +2 -1
- package/dist/components/web-server/load-balancer.d.ts.map +1 -0
- package/dist/{v2/components → components}/web-server/load-balancer.js +16 -13
- package/dist/index.d.ts +24 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -26
- package/dist/otel/batch-processor.d.ts.map +1 -0
- package/dist/{v2/otel → otel}/builder.d.ts +14 -1
- package/dist/otel/builder.d.ts.map +1 -0
- package/dist/{v2/otel → otel}/builder.js +47 -2
- package/dist/{v2/otel → otel}/config.d.ts +13 -1
- package/dist/otel/config.d.ts.map +1 -0
- package/dist/{v2/otel → otel}/config.js +20 -3
- package/dist/{v2/otel → otel}/index.d.ts +8 -0
- package/dist/otel/index.d.ts.map +1 -0
- package/dist/otel/memory-limiter-processor.d.ts.map +1 -0
- package/dist/otel/otlp-receiver.d.ts.map +1 -0
- package/dist/otel/prometheus-remote-write-exporter.d.ts.map +1 -0
- package/dist/shared/common-tags.d.ts +5 -0
- package/dist/shared/common-tags.d.ts.map +1 -0
- package/dist/shared/common-tags.js +8 -0
- package/dist/shared/merge-with-defaults.d.ts +2 -0
- package/dist/shared/merge-with-defaults.d.ts.map +1 -0
- package/dist/shared/merge-with-defaults.js +7 -0
- package/package.json +35 -16
- package/dist/components/acm-certificate.d.ts +0 -11
- package/dist/components/acm-certificate.d.ts.map +0 -1
- package/dist/components/acm-certificate.js +0 -30
- package/dist/components/database-replica.d.ts +0 -69
- package/dist/components/database-replica.d.ts.map +0 -1
- package/dist/components/database-replica.js +0 -40
- package/dist/components/database.d.ts +0 -99
- package/dist/components/database.d.ts.map +0 -1
- package/dist/components/database.js +0 -118
- package/dist/components/ec2-ssm-connect.d.ts +0 -22
- package/dist/components/ec2-ssm-connect.d.ts.map +0 -1
- package/dist/components/ecs-service.d.ts +0 -143
- package/dist/components/ecs-service.d.ts.map +0 -1
- package/dist/components/ecs-service.js +0 -357
- package/dist/components/mongo.d.ts +0 -39
- package/dist/components/mongo.d.ts.map +0 -1
- package/dist/components/mongo.js +0 -54
- package/dist/components/nuxt-ssr.d.ts +0 -44
- package/dist/components/nuxt-ssr.d.ts.map +0 -1
- package/dist/components/nuxt-ssr.js +0 -277
- package/dist/components/password.d.ts.map +0 -1
- package/dist/components/project.d.ts +0 -77
- package/dist/components/project.d.ts.map +0 -1
- package/dist/components/project.js +0 -171
- package/dist/components/redis.d.ts +0 -23
- package/dist/components/redis.d.ts.map +0 -1
- package/dist/components/redis.js +0 -35
- package/dist/components/static-site.d.ts +0 -36
- package/dist/components/static-site.d.ts.map +0 -1
- package/dist/components/static-site.js +0 -138
- package/dist/components/web-server.d.ts +0 -38
- package/dist/components/web-server.d.ts.map +0 -1
- package/dist/components/web-server.js +0 -185
- package/dist/constants.d.ts +0 -23
- package/dist/constants.d.ts.map +0 -1
- package/dist/types/pulumi.d.ts +0 -5
- package/dist/types/pulumi.d.ts.map +0 -1
- package/dist/types/size.d.ts +0 -8
- package/dist/types/size.d.ts.map +0 -1
- package/dist/types/size.js +0 -2
- package/dist/v2/components/ecs-service/index.d.ts.map +0 -1
- package/dist/v2/components/ecs-service/policies.d.ts.map +0 -1
- package/dist/v2/components/grafana/dashboards/index.d.ts.map +0 -1
- package/dist/v2/components/grafana/dashboards/panels.d.ts.map +0 -1
- package/dist/v2/components/grafana/dashboards/types.d.ts.map +0 -1
- package/dist/v2/components/grafana/dashboards/web-server-slo.d.ts.map +0 -1
- package/dist/v2/components/grafana/index.d.ts.map +0 -1
- package/dist/v2/components/prometheus/index.d.ts.map +0 -1
- package/dist/v2/components/prometheus/queries.d.ts.map +0 -1
- package/dist/v2/components/prometheus/queries.test.d.ts.map +0 -1
- package/dist/v2/components/web-server/builder.d.ts.map +0 -1
- package/dist/v2/components/web-server/index.d.ts.map +0 -1
- package/dist/v2/components/web-server/load-balancer.d.ts.map +0 -1
- package/dist/v2/index.d.ts +0 -13
- package/dist/v2/index.d.ts.map +0 -1
- package/dist/v2/index.js +0 -16
- package/dist/v2/otel/batch-processor.d.ts.map +0 -1
- package/dist/v2/otel/builder.d.ts.map +0 -1
- package/dist/v2/otel/config.d.ts.map +0 -1
- package/dist/v2/otel/index.d.ts.map +0 -1
- package/dist/v2/otel/memory-limiter-processor.d.ts.map +0 -1
- package/dist/v2/otel/otlp-receiver.d.ts.map +0 -1
- package/dist/v2/otel/prometheus-remote-write-exporter.d.ts.map +0 -1
- /package/dist/{v2/components/grafana/dashboards → components/cloudfront}/types.js +0 -0
- /package/dist/{v2/components → components}/ecs-service/policies.d.ts +0 -0
- /package/dist/{v2/components → components}/ecs-service/policies.js +0 -0
- /package/dist/{v2/components → components}/grafana/dashboards/index.d.ts +0 -0
- /package/dist/{v2/components → components}/grafana/dashboards/index.js +0 -0
- /package/dist/{v2/components → components}/grafana/dashboards/panels.d.ts +0 -0
- /package/dist/{v2/components → components}/grafana/dashboards/panels.js +0 -0
- /package/dist/{v2/components → components}/grafana/dashboards/types.d.ts +0 -0
- /package/dist/{types/pulumi.js → components/grafana/dashboards/types.js} +0 -0
- /package/dist/{v2/components → components}/grafana/dashboards/web-server-slo.d.ts +0 -0
- /package/dist/{v2/components → components}/grafana/dashboards/web-server-slo.js +0 -0
- /package/dist/{v2/components → components}/grafana/index.d.ts +0 -0
- /package/dist/{v2/components → components}/grafana/index.js +0 -0
- /package/dist/{v2/components → components}/prometheus/index.d.ts +0 -0
- /package/dist/{v2/components → components}/prometheus/index.js +0 -0
- /package/dist/{v2/components → components}/prometheus/queries.d.ts +0 -0
- /package/dist/{v2/components → components}/prometheus/queries.js +0 -0
- /package/dist/{v2/components → components}/prometheus/queries.test.d.ts +0 -0
- /package/dist/{v2/components → components}/prometheus/queries.test.js +0 -0
- /package/dist/{v2/otel → otel}/batch-processor.d.ts +0 -0
- /package/dist/{v2/otel → otel}/batch-processor.js +0 -0
- /package/dist/{v2/otel → otel}/index.js +0 -0
- /package/dist/{v2/otel → otel}/memory-limiter-processor.d.ts +0 -0
- /package/dist/{v2/otel → otel}/memory-limiter-processor.js +0 -0
- /package/dist/{v2/otel → otel}/otlp-receiver.d.ts +0 -0
- /package/dist/{v2/otel → otel}/otlp-receiver.js +0 -0
- /package/dist/{v2/otel → otel}/prometheus-remote-write-exporter.d.ts +0 -0
- /package/dist/{v2/otel → otel}/prometheus-remote-write-exporter.js +0 -0
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NuxtSSR = void 0;
|
|
4
|
-
const pulumi = require("@pulumi/pulumi");
|
|
5
|
-
const aws = require("@pulumi/aws");
|
|
6
|
-
const random = require("@pulumi/random");
|
|
7
|
-
const constants_1 = require("../constants");
|
|
8
|
-
const acm_certificate_1 = require("./acm-certificate");
|
|
9
|
-
const ecs_service_1 = require("./ecs-service");
|
|
10
|
-
const defaults = {
|
|
11
|
-
healthCheckPath: '/',
|
|
12
|
-
};
|
|
13
|
-
class NuxtSSR extends pulumi.ComponentResource {
|
|
14
|
-
constructor(name, args, opts = {}) {
|
|
15
|
-
super('studion:NuxtSSR', name, args, opts);
|
|
16
|
-
const { vpcId, domain, hostedZoneId, tags } = args;
|
|
17
|
-
const hasCustomDomain = domain && hostedZoneId;
|
|
18
|
-
if (domain && !hostedZoneId) {
|
|
19
|
-
throw new Error('NuxtSSR:hostedZoneId must be provided when the domain is specified');
|
|
20
|
-
}
|
|
21
|
-
this.name = name;
|
|
22
|
-
if (hasCustomDomain) {
|
|
23
|
-
this.certificate = this.createTlsCertificate({ domain, hostedZoneId });
|
|
24
|
-
}
|
|
25
|
-
this.customCFHeader = this.createCustomCFHeader();
|
|
26
|
-
const { lb, lbTargetGroup, lbHttpListener, lbSecurityGroup } = this.createLoadBalancer(args);
|
|
27
|
-
this.lb = lb;
|
|
28
|
-
this.lbTargetGroup = lbTargetGroup;
|
|
29
|
-
this.lbHttpListener = lbHttpListener;
|
|
30
|
-
this.lbSecurityGroup = lbSecurityGroup;
|
|
31
|
-
this.serviceSecurityGroup = this.createSecurityGroup(vpcId);
|
|
32
|
-
this.service = this.createEcsService(args);
|
|
33
|
-
this.cloudfront = this.createCloudfrontDistribution({ domain, tags });
|
|
34
|
-
if (hasCustomDomain) {
|
|
35
|
-
this.createDnsRecord({ domain, hostedZoneId });
|
|
36
|
-
}
|
|
37
|
-
this.registerOutputs();
|
|
38
|
-
}
|
|
39
|
-
createTlsCertificate({ domain, hostedZoneId, }) {
|
|
40
|
-
const certificate = new acm_certificate_1.AcmCertificate(`${domain}-acm-certificate`, {
|
|
41
|
-
domain,
|
|
42
|
-
hostedZoneId,
|
|
43
|
-
}, { parent: this });
|
|
44
|
-
return certificate;
|
|
45
|
-
}
|
|
46
|
-
createCustomCFHeader() {
|
|
47
|
-
const headerNameOpts = {
|
|
48
|
-
length: 4,
|
|
49
|
-
special: false,
|
|
50
|
-
numeric: false,
|
|
51
|
-
lower: false,
|
|
52
|
-
upper: true,
|
|
53
|
-
};
|
|
54
|
-
const headerNameSegment1 = new random.RandomString(`${this.name}-cf-header-name-segment1`, headerNameOpts, { parent: this });
|
|
55
|
-
const headerNameSegment2 = new random.RandomString(`${this.name}-cf-header-name-segment2`, headerNameOpts, { parent: this });
|
|
56
|
-
const headerValue = new random.RandomString(`${this.name}-cf-header-value`, {
|
|
57
|
-
length: 36,
|
|
58
|
-
special: false,
|
|
59
|
-
numeric: true,
|
|
60
|
-
lower: true,
|
|
61
|
-
upper: true,
|
|
62
|
-
}, { parent: this });
|
|
63
|
-
const headerName = pulumi
|
|
64
|
-
.all([headerNameSegment1.result, headerNameSegment2.result])
|
|
65
|
-
.apply(([segment1, segment2]) => {
|
|
66
|
-
return `X-${segment1}-${segment2}`;
|
|
67
|
-
});
|
|
68
|
-
return { name: headerName, value: headerValue.result };
|
|
69
|
-
}
|
|
70
|
-
createLoadBalancer({ vpcId, publicSubnetIds, port, healthCheckPath, }) {
|
|
71
|
-
const lbSecurityGroup = new aws.ec2.SecurityGroup(`${this.name}-lb-security-group`, {
|
|
72
|
-
vpcId,
|
|
73
|
-
ingress: [
|
|
74
|
-
{
|
|
75
|
-
protocol: 'tcp',
|
|
76
|
-
fromPort: 80,
|
|
77
|
-
toPort: 80,
|
|
78
|
-
cidrBlocks: ['0.0.0.0/0'],
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
egress: [
|
|
82
|
-
{
|
|
83
|
-
fromPort: 0,
|
|
84
|
-
toPort: 0,
|
|
85
|
-
protocol: '-1',
|
|
86
|
-
cidrBlocks: ['0.0.0.0/0'],
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
tags: constants_1.commonTags,
|
|
90
|
-
}, { parent: this });
|
|
91
|
-
const lb = new aws.lb.LoadBalancer(`${this.name}-lb`, {
|
|
92
|
-
namePrefix: 'lb-',
|
|
93
|
-
loadBalancerType: 'application',
|
|
94
|
-
subnets: publicSubnetIds,
|
|
95
|
-
securityGroups: [lbSecurityGroup.id],
|
|
96
|
-
internal: false,
|
|
97
|
-
ipAddressType: 'ipv4',
|
|
98
|
-
tags: Object.assign(Object.assign({}, constants_1.commonTags), { Name: `${this.name}-lb` }),
|
|
99
|
-
}, { parent: this });
|
|
100
|
-
const lbTargetGroup = new aws.lb.TargetGroup(`${this.name}-lb-tg`, {
|
|
101
|
-
namePrefix: 'lb-tg-',
|
|
102
|
-
port,
|
|
103
|
-
protocol: 'HTTP',
|
|
104
|
-
targetType: 'ip',
|
|
105
|
-
vpcId,
|
|
106
|
-
healthCheck: {
|
|
107
|
-
healthyThreshold: 3,
|
|
108
|
-
unhealthyThreshold: 2,
|
|
109
|
-
interval: 60,
|
|
110
|
-
timeout: 5,
|
|
111
|
-
path: healthCheckPath || defaults.healthCheckPath,
|
|
112
|
-
},
|
|
113
|
-
tags: Object.assign(Object.assign({}, constants_1.commonTags), { Name: `${this.name}-lb-target-group` }),
|
|
114
|
-
}, { parent: this, dependsOn: [this.lb] });
|
|
115
|
-
const lbHttpListener = new aws.lb.Listener(`${this.name}-lb-listener-80`, {
|
|
116
|
-
loadBalancerArn: lb.arn,
|
|
117
|
-
port: 80,
|
|
118
|
-
defaultActions: [
|
|
119
|
-
{
|
|
120
|
-
type: 'fixed-response',
|
|
121
|
-
fixedResponse: {
|
|
122
|
-
statusCode: '403',
|
|
123
|
-
messageBody: 'Not Allowed',
|
|
124
|
-
contentType: 'text/plain',
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
],
|
|
128
|
-
tags: constants_1.commonTags,
|
|
129
|
-
}, { parent: this });
|
|
130
|
-
const lbHttpListenerRule = new aws.lb.ListenerRule(`${this.name}-lb-listener-rule`, {
|
|
131
|
-
listenerArn: lbHttpListener.arn,
|
|
132
|
-
priority: 1,
|
|
133
|
-
actions: [
|
|
134
|
-
{
|
|
135
|
-
type: 'forward',
|
|
136
|
-
targetGroupArn: lbTargetGroup.arn,
|
|
137
|
-
},
|
|
138
|
-
],
|
|
139
|
-
conditions: [
|
|
140
|
-
{
|
|
141
|
-
httpHeader: {
|
|
142
|
-
httpHeaderName: this.customCFHeader.name,
|
|
143
|
-
values: [this.customCFHeader.value],
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
],
|
|
147
|
-
}, { parent: this });
|
|
148
|
-
return {
|
|
149
|
-
lb,
|
|
150
|
-
lbTargetGroup,
|
|
151
|
-
lbHttpListener,
|
|
152
|
-
lbSecurityGroup,
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
createSecurityGroup(vpcId) {
|
|
156
|
-
const securityGroup = new aws.ec2.SecurityGroup(`${this.name}-security-group`, {
|
|
157
|
-
vpcId,
|
|
158
|
-
ingress: [
|
|
159
|
-
{
|
|
160
|
-
fromPort: 0,
|
|
161
|
-
toPort: 0,
|
|
162
|
-
protocol: '-1',
|
|
163
|
-
securityGroups: [this.lbSecurityGroup.id],
|
|
164
|
-
},
|
|
165
|
-
],
|
|
166
|
-
egress: [
|
|
167
|
-
{
|
|
168
|
-
fromPort: 0,
|
|
169
|
-
toPort: 0,
|
|
170
|
-
protocol: '-1',
|
|
171
|
-
cidrBlocks: ['0.0.0.0/0'],
|
|
172
|
-
},
|
|
173
|
-
],
|
|
174
|
-
tags: constants_1.commonTags,
|
|
175
|
-
}, { parent: this });
|
|
176
|
-
return securityGroup;
|
|
177
|
-
}
|
|
178
|
-
createEcsService(args) {
|
|
179
|
-
const service = new ecs_service_1.EcsService(this.name, Object.assign(Object.assign({}, args), { enableServiceAutoDiscovery: false, lbTargetGroupArn: this.lbTargetGroup.arn, assignPublicIp: true, subnetIds: args.publicSubnetIds, securityGroup: this.serviceSecurityGroup }), {
|
|
180
|
-
parent: this,
|
|
181
|
-
dependsOn: [this.lb, this.lbTargetGroup, this.lbHttpListener],
|
|
182
|
-
});
|
|
183
|
-
return service;
|
|
184
|
-
}
|
|
185
|
-
createCloudfrontDistribution({ domain, tags, }) {
|
|
186
|
-
const cachePolicy = new aws.cloudfront.CachePolicy(`${this.name}-cf-cache-policy`, {
|
|
187
|
-
comment: 'This cache policy is managed by Pulumi, changing its values will impact multiple services.',
|
|
188
|
-
defaultTtl: 0,
|
|
189
|
-
maxTtl: 31536000,
|
|
190
|
-
minTtl: 0,
|
|
191
|
-
parametersInCacheKeyAndForwardedToOrigin: {
|
|
192
|
-
cookiesConfig: {
|
|
193
|
-
cookieBehavior: 'none',
|
|
194
|
-
},
|
|
195
|
-
headersConfig: {
|
|
196
|
-
headerBehavior: 'none',
|
|
197
|
-
},
|
|
198
|
-
queryStringsConfig: {
|
|
199
|
-
queryStringBehavior: 'all',
|
|
200
|
-
},
|
|
201
|
-
},
|
|
202
|
-
}, { parent: this });
|
|
203
|
-
const originRequestPolicyId = aws.cloudfront
|
|
204
|
-
.getOriginRequestPolicyOutput({
|
|
205
|
-
name: 'Managed-AllViewer',
|
|
206
|
-
})
|
|
207
|
-
.apply(policy => policy.id);
|
|
208
|
-
const responseHeadersPolicyId = aws.cloudfront
|
|
209
|
-
.getResponseHeadersPolicyOutput({
|
|
210
|
-
name: 'Managed-SecurityHeadersPolicy',
|
|
211
|
-
})
|
|
212
|
-
.apply(policy => policy.id);
|
|
213
|
-
const cloudfront = new aws.cloudfront.Distribution(`${this.name}-cloudfront`, Object.assign(Object.assign({ enabled: true }, (domain && { aliases: [domain] })), { isIpv6Enabled: true, waitForDeployment: true, httpVersion: 'http2and3', viewerCertificate: Object.assign({}, (this.certificate
|
|
214
|
-
? {
|
|
215
|
-
acmCertificateArn: this.certificate.certificate.arn,
|
|
216
|
-
sslSupportMethod: 'sni-only',
|
|
217
|
-
minimumProtocolVersion: 'TLSv1.2_2021',
|
|
218
|
-
}
|
|
219
|
-
: {
|
|
220
|
-
cloudfrontDefaultCertificate: true,
|
|
221
|
-
})), origins: [
|
|
222
|
-
{
|
|
223
|
-
originId: this.lb.arn,
|
|
224
|
-
domainName: this.lb.dnsName,
|
|
225
|
-
connectionAttempts: 3,
|
|
226
|
-
connectionTimeout: 10,
|
|
227
|
-
customOriginConfig: {
|
|
228
|
-
originProtocolPolicy: 'http-only',
|
|
229
|
-
httpPort: 80,
|
|
230
|
-
httpsPort: 443,
|
|
231
|
-
originSslProtocols: ['SSLv3'],
|
|
232
|
-
},
|
|
233
|
-
customHeaders: [
|
|
234
|
-
{ name: 'X-Forwarded-Port', value: '443' },
|
|
235
|
-
{ name: 'X-Forwarded-Ssl', value: 'on' },
|
|
236
|
-
this.customCFHeader,
|
|
237
|
-
],
|
|
238
|
-
},
|
|
239
|
-
], defaultCacheBehavior: {
|
|
240
|
-
targetOriginId: this.lb.arn,
|
|
241
|
-
viewerProtocolPolicy: 'redirect-to-https',
|
|
242
|
-
allowedMethods: [
|
|
243
|
-
'GET',
|
|
244
|
-
'HEAD',
|
|
245
|
-
'OPTIONS',
|
|
246
|
-
'PUT',
|
|
247
|
-
'POST',
|
|
248
|
-
'PATCH',
|
|
249
|
-
'DELETE',
|
|
250
|
-
],
|
|
251
|
-
cachedMethods: ['GET', 'HEAD'],
|
|
252
|
-
compress: true,
|
|
253
|
-
cachePolicyId: cachePolicy.id,
|
|
254
|
-
originRequestPolicyId,
|
|
255
|
-
responseHeadersPolicyId,
|
|
256
|
-
}, priceClass: 'PriceClass_100', restrictions: {
|
|
257
|
-
geoRestriction: { restrictionType: 'none' },
|
|
258
|
-
}, tags: Object.assign(Object.assign({}, constants_1.commonTags), tags) }), { parent: this });
|
|
259
|
-
return cloudfront;
|
|
260
|
-
}
|
|
261
|
-
createDnsRecord({ domain, hostedZoneId, }) {
|
|
262
|
-
const cdnAliasRecord = new aws.route53.Record(`${this.name}-cdn-route53-record`, {
|
|
263
|
-
type: 'A',
|
|
264
|
-
name: domain,
|
|
265
|
-
zoneId: hostedZoneId,
|
|
266
|
-
aliases: [
|
|
267
|
-
{
|
|
268
|
-
name: this.cloudfront.domainName,
|
|
269
|
-
zoneId: this.cloudfront.hostedZoneId,
|
|
270
|
-
evaluateTargetHealth: true,
|
|
271
|
-
},
|
|
272
|
-
],
|
|
273
|
-
}, { parent: this });
|
|
274
|
-
return cdnAliasRecord;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
exports.NuxtSSR = NuxtSSR;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../src/components/password.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AACnC,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAIzC,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;CAC9B,CAAC;AAEF,qBAAa,QAAS,SAAQ,MAAM,CAAC,iBAAiB;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7B,MAAM,EAAE,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC;gBAGhC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,YAAY,EAClB,IAAI,GAAE,MAAM,CAAC,wBAA6B;IA2B5C,OAAO,CAAC,oBAAoB;CAwB7B"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import * as pulumi from '@pulumi/pulumi';
|
|
2
|
-
import * as aws from '@pulumi/aws';
|
|
3
|
-
import * as awsx from '@pulumi/awsx';
|
|
4
|
-
import * as upstash from '@upstash/pulumi';
|
|
5
|
-
import { Database, DatabaseArgs } from './database';
|
|
6
|
-
import { WebServer, WebServerArgs } from './web-server';
|
|
7
|
-
import { Mongo, MongoArgs } from './mongo';
|
|
8
|
-
import { Redis, RedisArgs } from './redis';
|
|
9
|
-
import { StaticSite, StaticSiteArgs } from './static-site';
|
|
10
|
-
import { Ec2SSMConnect } from './ec2-ssm-connect';
|
|
11
|
-
import { EcsService, EcsServiceArgs } from './ecs-service';
|
|
12
|
-
import { NuxtSSR, NuxtSSRArgs } from './nuxt-ssr';
|
|
13
|
-
export type Service = Database | Redis | StaticSite | WebServer | NuxtSSR | Mongo | EcsService;
|
|
14
|
-
export type Services = Record<string, Service>;
|
|
15
|
-
type ServiceArgs = {
|
|
16
|
-
/**
|
|
17
|
-
* The unique name for the service.
|
|
18
|
-
*/
|
|
19
|
-
serviceName: string;
|
|
20
|
-
};
|
|
21
|
-
export type DatabaseServiceOptions = {
|
|
22
|
-
type: 'DATABASE';
|
|
23
|
-
} & ServiceArgs & Omit<DatabaseArgs, 'vpcId' | 'vpcCidrBlock' | 'isolatedSubnetIds'>;
|
|
24
|
-
export type RedisServiceOptions = {
|
|
25
|
-
type: 'REDIS';
|
|
26
|
-
} & ServiceArgs & RedisArgs;
|
|
27
|
-
export type StaticSiteServiceOptions = {
|
|
28
|
-
type: 'STATIC_SITE';
|
|
29
|
-
} & ServiceArgs & StaticSiteArgs;
|
|
30
|
-
export type WebServerServiceOptions = {
|
|
31
|
-
type: 'WEB_SERVER';
|
|
32
|
-
environment?: aws.ecs.KeyValuePair[] | ((services: Services) => aws.ecs.KeyValuePair[]);
|
|
33
|
-
secrets?: aws.ecs.Secret[] | ((services: Services) => aws.ecs.Secret[]);
|
|
34
|
-
} & ServiceArgs & Omit<WebServerArgs, 'clusterId' | 'clusterName' | 'vpcId' | 'vpcCidrBlock' | 'publicSubnetIds' | 'environment' | 'secrets'>;
|
|
35
|
-
export type NuxtSSRServiceOptions = {
|
|
36
|
-
type: 'NUXT_SSR';
|
|
37
|
-
environment?: aws.ecs.KeyValuePair[] | ((services: Services) => aws.ecs.KeyValuePair[]);
|
|
38
|
-
secrets?: aws.ecs.Secret[] | ((services: Services) => aws.ecs.Secret[]);
|
|
39
|
-
} & ServiceArgs & Omit<NuxtSSRArgs, 'clusterId' | 'clusterName' | 'vpcId' | 'vpcCidrBlock' | 'publicSubnetIds' | 'environment' | 'secrets'>;
|
|
40
|
-
export type MongoServiceOptions = {
|
|
41
|
-
type: 'MONGO';
|
|
42
|
-
} & ServiceArgs & Omit<MongoArgs, 'clusterId' | 'clusterName' | 'vpcId' | 'vpcCidrBlock' | 'privateSubnetIds' | 'environment' | 'secrets'>;
|
|
43
|
-
export type EcsServiceOptions = {
|
|
44
|
-
type: 'ECS_SERVICE';
|
|
45
|
-
environment?: aws.ecs.KeyValuePair[] | ((services: Services) => aws.ecs.KeyValuePair[]);
|
|
46
|
-
secrets?: aws.ecs.Secret[] | ((services: Services) => aws.ecs.Secret[]);
|
|
47
|
-
} & ServiceArgs & Omit<EcsServiceArgs, 'clusterId' | 'clusterName' | 'vpcId' | 'vpcCidrBlock' | 'subnetIds' | 'environment' | 'secrets'>;
|
|
48
|
-
export type ProjectArgs = {
|
|
49
|
-
services: (DatabaseServiceOptions | RedisServiceOptions | StaticSiteServiceOptions | WebServerServiceOptions | NuxtSSRServiceOptions | MongoServiceOptions | EcsServiceOptions)[];
|
|
50
|
-
enableSSMConnect?: pulumi.Input<boolean>;
|
|
51
|
-
numberOfAvailabilityZones?: number;
|
|
52
|
-
};
|
|
53
|
-
export declare class MissingEcsCluster extends Error {
|
|
54
|
-
constructor();
|
|
55
|
-
}
|
|
56
|
-
export declare class Project extends pulumi.ComponentResource {
|
|
57
|
-
name: string;
|
|
58
|
-
vpc: awsx.ec2.Vpc;
|
|
59
|
-
cluster?: aws.ecs.Cluster;
|
|
60
|
-
upstashProvider?: upstash.Provider;
|
|
61
|
-
ec2SSMConnect?: Ec2SSMConnect;
|
|
62
|
-
services: Services;
|
|
63
|
-
constructor(name: string, args: ProjectArgs, opts?: pulumi.ComponentResourceOptions);
|
|
64
|
-
private createVpc;
|
|
65
|
-
private createServices;
|
|
66
|
-
private createRedisPrerequisites;
|
|
67
|
-
private createEcsCluster;
|
|
68
|
-
private createDatabaseService;
|
|
69
|
-
private createRedisService;
|
|
70
|
-
private createStaticSiteService;
|
|
71
|
-
private createWebServerService;
|
|
72
|
-
private createNuxtSSRService;
|
|
73
|
-
private createMongoService;
|
|
74
|
-
private createEcsService;
|
|
75
|
-
}
|
|
76
|
-
export {};
|
|
77
|
-
//# sourceMappingURL=project.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/components/project.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.Project = exports.MissingEcsCluster = void 0;
|
|
15
|
-
const pulumi = require("@pulumi/pulumi");
|
|
16
|
-
const aws = require("@pulumi/aws");
|
|
17
|
-
const awsx = require("@pulumi/awsx");
|
|
18
|
-
const upstash = require("@upstash/pulumi");
|
|
19
|
-
const database_1 = require("./database");
|
|
20
|
-
const web_server_1 = require("./web-server");
|
|
21
|
-
const mongo_1 = require("./mongo");
|
|
22
|
-
const redis_1 = require("./redis");
|
|
23
|
-
const static_site_1 = require("./static-site");
|
|
24
|
-
const ec2_ssm_connect_1 = require("./ec2-ssm-connect");
|
|
25
|
-
const constants_1 = require("../constants");
|
|
26
|
-
const ecs_service_1 = require("./ecs-service");
|
|
27
|
-
const nuxt_ssr_1 = require("./nuxt-ssr");
|
|
28
|
-
class MissingEcsCluster extends Error {
|
|
29
|
-
constructor() {
|
|
30
|
-
super('Ecs Cluster does not exist');
|
|
31
|
-
this.name = this.constructor.name;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.MissingEcsCluster = MissingEcsCluster;
|
|
35
|
-
class Project extends pulumi.ComponentResource {
|
|
36
|
-
constructor(name, args, opts = {}) {
|
|
37
|
-
super('studion:Project', name, {}, opts);
|
|
38
|
-
this.services = {};
|
|
39
|
-
this.name = name;
|
|
40
|
-
this.vpc = this.createVpc(args.numberOfAvailabilityZones);
|
|
41
|
-
this.createServices(args.services);
|
|
42
|
-
if (args.enableSSMConnect) {
|
|
43
|
-
this.ec2SSMConnect = new ec2_ssm_connect_1.Ec2SSMConnect(`${name}-ssm-connect`, {
|
|
44
|
-
vpcId: this.vpc.vpcId,
|
|
45
|
-
privateSubnetId: this.vpc.privateSubnetIds.apply(ids => ids[0]),
|
|
46
|
-
vpcCidrBlock: this.vpc.vpc.cidrBlock,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
this.registerOutputs();
|
|
50
|
-
}
|
|
51
|
-
createVpc(numberOfAvailabilityZones = 2) {
|
|
52
|
-
const vpc = new awsx.ec2.Vpc(`${this.name}-vpc`, {
|
|
53
|
-
numberOfAvailabilityZones,
|
|
54
|
-
enableDnsHostnames: true,
|
|
55
|
-
enableDnsSupport: true,
|
|
56
|
-
subnetSpecs: [
|
|
57
|
-
{ type: awsx.ec2.SubnetType.Public, cidrMask: 24 },
|
|
58
|
-
{ type: awsx.ec2.SubnetType.Private, cidrMask: 24 },
|
|
59
|
-
{ type: awsx.ec2.SubnetType.Isolated, cidrMask: 24 },
|
|
60
|
-
],
|
|
61
|
-
tags: constants_1.commonTags,
|
|
62
|
-
}, { parent: this });
|
|
63
|
-
return vpc;
|
|
64
|
-
}
|
|
65
|
-
createServices(services) {
|
|
66
|
-
const hasRedisService = services.some(it => it.type === 'REDIS');
|
|
67
|
-
const shouldCreateEcsCluster = services.some(it => it.type === 'WEB_SERVER' ||
|
|
68
|
-
it.type === 'NUXT_SSR' ||
|
|
69
|
-
it.type === 'MONGO' ||
|
|
70
|
-
it.type === 'ECS_SERVICE') && !this.cluster;
|
|
71
|
-
if (hasRedisService)
|
|
72
|
-
this.createRedisPrerequisites();
|
|
73
|
-
if (shouldCreateEcsCluster)
|
|
74
|
-
this.createEcsCluster();
|
|
75
|
-
services.forEach(it => {
|
|
76
|
-
if (it.type === 'DATABASE')
|
|
77
|
-
this.createDatabaseService(it);
|
|
78
|
-
if (it.type === 'REDIS')
|
|
79
|
-
this.createRedisService(it);
|
|
80
|
-
if (it.type === 'STATIC_SITE')
|
|
81
|
-
this.createStaticSiteService(it);
|
|
82
|
-
if (it.type === 'WEB_SERVER')
|
|
83
|
-
this.createWebServerService(it);
|
|
84
|
-
if (it.type === 'NUXT_SSR')
|
|
85
|
-
this.createNuxtSSRService(it);
|
|
86
|
-
if (it.type === 'MONGO')
|
|
87
|
-
this.createMongoService(it);
|
|
88
|
-
if (it.type === 'ECS_SERVICE')
|
|
89
|
-
this.createEcsService(it);
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
createRedisPrerequisites() {
|
|
93
|
-
const upstashConfig = new pulumi.Config('upstash');
|
|
94
|
-
this.upstashProvider = new upstash.Provider('upstash', {
|
|
95
|
-
email: upstashConfig.requireSecret('email'),
|
|
96
|
-
apiKey: upstashConfig.requireSecret('apiKey'),
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
createEcsCluster() {
|
|
100
|
-
const stack = pulumi.getStack();
|
|
101
|
-
this.cluster = new aws.ecs.Cluster(`${this.name}-cluster`, {
|
|
102
|
-
name: `${this.name}-${stack}`,
|
|
103
|
-
tags: constants_1.commonTags,
|
|
104
|
-
}, { parent: this });
|
|
105
|
-
}
|
|
106
|
-
createDatabaseService(options) {
|
|
107
|
-
const { serviceName, type } = options, databaseOptions = __rest(options, ["serviceName", "type"]);
|
|
108
|
-
const service = new database_1.Database(serviceName, Object.assign(Object.assign({}, databaseOptions), { vpcId: this.vpc.vpcId, isolatedSubnetIds: this.vpc.isolatedSubnetIds, vpcCidrBlock: this.vpc.vpc.cidrBlock }), { parent: this });
|
|
109
|
-
this.services[serviceName] = service;
|
|
110
|
-
}
|
|
111
|
-
createRedisService(options) {
|
|
112
|
-
if (!this.upstashProvider)
|
|
113
|
-
return;
|
|
114
|
-
const { serviceName } = options, redisOptions = __rest(options, ["serviceName"]);
|
|
115
|
-
const service = new redis_1.Redis(serviceName, redisOptions, {
|
|
116
|
-
parent: this,
|
|
117
|
-
provider: this.upstashProvider,
|
|
118
|
-
});
|
|
119
|
-
this.services[options.serviceName] = service;
|
|
120
|
-
}
|
|
121
|
-
createStaticSiteService(options) {
|
|
122
|
-
const { serviceName } = options, staticSiteOptions = __rest(options, ["serviceName"]);
|
|
123
|
-
const service = new static_site_1.StaticSite(serviceName, staticSiteOptions, {
|
|
124
|
-
parent: this,
|
|
125
|
-
});
|
|
126
|
-
this.services[serviceName] = service;
|
|
127
|
-
}
|
|
128
|
-
createWebServerService(options) {
|
|
129
|
-
if (!this.cluster)
|
|
130
|
-
throw new MissingEcsCluster();
|
|
131
|
-
const { serviceName, environment, secrets } = options, ecsOptions = __rest(options, ["serviceName", "environment", "secrets"]);
|
|
132
|
-
const parsedEnv = typeof environment === 'function'
|
|
133
|
-
? environment(this.services)
|
|
134
|
-
: environment;
|
|
135
|
-
const parsedSecrets = typeof secrets === 'function' ? secrets(this.services) : secrets;
|
|
136
|
-
const service = new web_server_1.WebServer(serviceName, Object.assign(Object.assign({}, ecsOptions), { clusterId: this.cluster.id, clusterName: this.cluster.name, vpcId: this.vpc.vpcId, vpcCidrBlock: this.vpc.vpc.cidrBlock, publicSubnetIds: this.vpc.publicSubnetIds, environment: parsedEnv, secrets: parsedSecrets }), { parent: this });
|
|
137
|
-
this.services[options.serviceName] = service;
|
|
138
|
-
}
|
|
139
|
-
createNuxtSSRService(options) {
|
|
140
|
-
if (!this.cluster)
|
|
141
|
-
throw new MissingEcsCluster();
|
|
142
|
-
const { serviceName, environment, secrets } = options, ecsOptions = __rest(options, ["serviceName", "environment", "secrets"]);
|
|
143
|
-
const parsedEnv = typeof environment === 'function'
|
|
144
|
-
? environment(this.services)
|
|
145
|
-
: environment;
|
|
146
|
-
const parsedSecrets = typeof secrets === 'function' ? secrets(this.services) : secrets;
|
|
147
|
-
const service = new nuxt_ssr_1.NuxtSSR(serviceName, Object.assign(Object.assign({}, ecsOptions), { clusterId: this.cluster.id, clusterName: this.cluster.name, vpcId: this.vpc.vpcId, vpcCidrBlock: this.vpc.vpc.cidrBlock, publicSubnetIds: this.vpc.publicSubnetIds, environment: parsedEnv, secrets: parsedSecrets }), { parent: this });
|
|
148
|
-
this.services[options.serviceName] = service;
|
|
149
|
-
}
|
|
150
|
-
createMongoService(options) {
|
|
151
|
-
if (!this.cluster)
|
|
152
|
-
throw new MissingEcsCluster();
|
|
153
|
-
const { serviceName } = options, mongoOptions = __rest(options, ["serviceName"]);
|
|
154
|
-
const service = new mongo_1.Mongo(serviceName, Object.assign(Object.assign({}, mongoOptions), { clusterId: this.cluster.id, clusterName: this.cluster.name, vpcId: this.vpc.vpcId, vpcCidrBlock: this.vpc.vpc.cidrBlock, privateSubnetIds: this.vpc.privateSubnetIds }), { parent: this });
|
|
155
|
-
this.services[options.serviceName] = service;
|
|
156
|
-
}
|
|
157
|
-
createEcsService(options) {
|
|
158
|
-
if (!this.cluster)
|
|
159
|
-
throw new MissingEcsCluster();
|
|
160
|
-
const { serviceName, environment, secrets } = options, ecsOptions = __rest(options, ["serviceName", "environment", "secrets"]);
|
|
161
|
-
const parsedEnv = typeof environment === 'function'
|
|
162
|
-
? environment(this.services)
|
|
163
|
-
: environment;
|
|
164
|
-
const parsedSecrets = typeof secrets === 'function' ? secrets(this.services) : secrets;
|
|
165
|
-
const service = new ecs_service_1.EcsService(serviceName, Object.assign(Object.assign({}, ecsOptions), { clusterId: this.cluster.id, clusterName: this.cluster.name, vpcId: this.vpc.vpcId, vpcCidrBlock: this.vpc.vpc.cidrBlock, subnetIds: ecsOptions.assignPublicIp
|
|
166
|
-
? this.vpc.publicSubnetIds
|
|
167
|
-
: this.vpc.privateSubnetIds, environment: parsedEnv, secrets: parsedSecrets }), { parent: this });
|
|
168
|
-
this.services[options.serviceName] = service;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
exports.Project = Project;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as pulumi from '@pulumi/pulumi';
|
|
2
|
-
import * as upstash from '@upstash/pulumi';
|
|
3
|
-
import * as aws from '@pulumi/aws';
|
|
4
|
-
export type RedisArgs = {
|
|
5
|
-
/**
|
|
6
|
-
* Redis database name.
|
|
7
|
-
*/
|
|
8
|
-
dbName: pulumi.Input<string>;
|
|
9
|
-
/**
|
|
10
|
-
* Region of the database. Possible values are: "global", "eu-west-1", "us-east-1", "us-west-1", "ap-northeast-1" , "eu-central1".
|
|
11
|
-
*/
|
|
12
|
-
region?: pulumi.Input<string>;
|
|
13
|
-
};
|
|
14
|
-
export interface RedisOptions extends pulumi.ComponentResourceOptions {
|
|
15
|
-
provider: upstash.Provider;
|
|
16
|
-
}
|
|
17
|
-
export declare class Redis extends pulumi.ComponentResource {
|
|
18
|
-
instance: upstash.RedisDatabase;
|
|
19
|
-
passwordSecret: aws.secretsmanager.Secret;
|
|
20
|
-
username: string;
|
|
21
|
-
constructor(name: string, args: RedisArgs, opts: RedisOptions);
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=redis.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"redis.d.ts","sourceRoot":"","sources":["../../src/components/redis.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAGnC,MAAM,MAAM,SAAS,GAAG;IACtB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;CAC/B,CAAC;AAMF,MAAM,WAAW,YAAa,SAAQ,MAAM,CAAC,wBAAwB;IACnE,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC;CAC5B;AAED,qBAAa,KAAM,SAAQ,MAAM,CAAC,iBAAiB;IACjD,QAAQ,EAAE,OAAO,CAAC,aAAa,CAAC;IAChC,cAAc,EAAE,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC;IAC1C,QAAQ,SAAa;gBAET,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY;CAuC9D"}
|
package/dist/components/redis.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Redis = void 0;
|
|
4
|
-
const pulumi = require("@pulumi/pulumi");
|
|
5
|
-
const upstash = require("@upstash/pulumi");
|
|
6
|
-
const aws = require("@pulumi/aws");
|
|
7
|
-
const constants_1 = require("../constants");
|
|
8
|
-
const defaults = {
|
|
9
|
-
region: 'us-east-1',
|
|
10
|
-
};
|
|
11
|
-
class Redis extends pulumi.ComponentResource {
|
|
12
|
-
constructor(name, args, opts) {
|
|
13
|
-
super('studion:Redis', name, {}, opts);
|
|
14
|
-
this.username = 'default';
|
|
15
|
-
const project = pulumi.getProject();
|
|
16
|
-
const stack = pulumi.getStack();
|
|
17
|
-
const argsWithDefaults = Object.assign({}, defaults, args);
|
|
18
|
-
this.instance = new upstash.RedisDatabase(name, {
|
|
19
|
-
databaseName: `${argsWithDefaults.dbName}-${stack}`,
|
|
20
|
-
region: argsWithDefaults.region,
|
|
21
|
-
eviction: true,
|
|
22
|
-
tls: true,
|
|
23
|
-
}, { provider: opts.provider, parent: this });
|
|
24
|
-
this.passwordSecret = new aws.secretsmanager.Secret(`${name}-password-secret`, {
|
|
25
|
-
namePrefix: `${stack}/${project}/RedisPassword-`,
|
|
26
|
-
tags: constants_1.commonTags,
|
|
27
|
-
}, { parent: this, dependsOn: [this.instance] });
|
|
28
|
-
const passwordSecretValue = new aws.secretsmanager.SecretVersion(`${name}-password-secret-value`, {
|
|
29
|
-
secretId: this.passwordSecret.id,
|
|
30
|
-
secretString: this.instance.password,
|
|
31
|
-
}, { parent: this, dependsOn: [this.passwordSecret] });
|
|
32
|
-
this.registerOutputs();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.Redis = Redis;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import * as aws from '@pulumi/aws';
|
|
2
|
-
import * as pulumi from '@pulumi/pulumi';
|
|
3
|
-
import { AcmCertificate } from './acm-certificate';
|
|
4
|
-
export type StaticSiteArgs = {
|
|
5
|
-
/**
|
|
6
|
-
* The domain which will be used to access the static site.
|
|
7
|
-
* The domain or subdomain must belong to the provided hostedZone.
|
|
8
|
-
*/
|
|
9
|
-
domain?: pulumi.Input<string>;
|
|
10
|
-
/**
|
|
11
|
-
* The ID of the hosted zone.
|
|
12
|
-
*/
|
|
13
|
-
hostedZoneId?: pulumi.Input<string>;
|
|
14
|
-
/**
|
|
15
|
-
* ARN of the CloudFront viewer-request function.
|
|
16
|
-
*/
|
|
17
|
-
viewerRequestFunctionArn?: pulumi.Input<string>;
|
|
18
|
-
/**
|
|
19
|
-
* A map of tags to assign to the resource.
|
|
20
|
-
*/
|
|
21
|
-
tags?: pulumi.Input<{
|
|
22
|
-
[key: string]: pulumi.Input<string>;
|
|
23
|
-
}>;
|
|
24
|
-
};
|
|
25
|
-
export declare class StaticSite extends pulumi.ComponentResource {
|
|
26
|
-
name: string;
|
|
27
|
-
certificate?: AcmCertificate;
|
|
28
|
-
bucket: aws.s3.Bucket;
|
|
29
|
-
cloudfront: aws.cloudfront.Distribution;
|
|
30
|
-
constructor(name: string, args: StaticSiteArgs, opts?: pulumi.ComponentResourceOptions);
|
|
31
|
-
private createTlsCertificate;
|
|
32
|
-
private createPublicBucket;
|
|
33
|
-
private createCloudfrontDistribution;
|
|
34
|
-
private createDnsRecord;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=static-site.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"static-site.d.ts","sourceRoot":"","sources":["../../src/components/static-site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AACnC,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD,MAAM,MAAM,cAAc,GAAG;IAC3B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACpC;;OAEG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAChD;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC;QAClB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;KACrC,CAAC,CAAC;CACJ,CAAC;AAEF,qBAAa,UAAW,SAAQ,MAAM,CAAC,iBAAiB;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC;IACtB,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC;gBAGtC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,cAAc,EACpB,IAAI,GAAE,MAAM,CAAC,wBAA6B;IA4B5C,OAAO,CAAC,oBAAoB;IAe5B,OAAO,CAAC,kBAAkB;IAoD1B,OAAO,CAAC,4BAA4B;IA0EpC,OAAO,CAAC,eAAe;CAsBxB"}
|