@studion/infra-code-blocks 0.1.9 → 0.2.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/README.md +272 -28
- package/dist/components/database.d.ts +12 -8
- package/dist/components/database.js +8 -8
- package/dist/components/ec2-ssm-connect.d.ts +6 -2
- package/dist/components/ec2-ssm-connect.js +7 -7
- package/dist/components/ecs-service.d.ts +125 -0
- package/dist/components/ecs-service.js +323 -0
- package/dist/components/mongo.d.ts +27 -0
- package/dist/components/mongo.js +63 -0
- package/dist/components/nuxt-ssr.d.ts +43 -0
- package/dist/components/nuxt-ssr.js +277 -0
- package/dist/components/project.d.ts +32 -15
- package/dist/components/project.js +62 -20
- package/dist/components/web-server.d.ts +12 -81
- package/dist/components/web-server.js +60 -254
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,6 +61,9 @@ $ pulumi up
|
|
|
61
61
|
3. [Redis](#redis)
|
|
62
62
|
4. [StaticSite](#static-site)
|
|
63
63
|
5. [WebServer](#web-server)
|
|
64
|
+
6. [Nuxt SSR](#nuxt-ssr-preset)
|
|
65
|
+
7. [Mongo](#mongo)
|
|
66
|
+
8. [EcsService](#ecs-service)
|
|
64
67
|
|
|
65
68
|
### Project
|
|
66
69
|
|
|
@@ -82,12 +85,14 @@ new Project(name: string, args: ProjectArgs, opts?: pulumi.CustomResourceOptions
|
|
|
82
85
|
```ts
|
|
83
86
|
type ProjectArgs = {
|
|
84
87
|
services: (
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
88
|
+
| DatabaseServiceOptions
|
|
89
|
+
| RedisServiceOptions
|
|
90
|
+
| StaticSiteServiceOptions
|
|
91
|
+
| WebServerServiceOptions
|
|
92
|
+
| NuxtSSRServiceOptions
|
|
93
|
+
| MongoServiceOptions
|
|
94
|
+
| EcsServiceOptions
|
|
89
95
|
)[];
|
|
90
|
-
hostedZoneId?: pulumi.Input<string>;
|
|
91
96
|
enableSSMConnect?: pulumi.Input<boolean>;
|
|
92
97
|
};
|
|
93
98
|
```
|
|
@@ -95,11 +100,10 @@ type ProjectArgs = {
|
|
|
95
100
|
| Argument | Description |
|
|
96
101
|
| :--------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------: |
|
|
97
102
|
| services \* | Service list. |
|
|
98
|
-
| hostedZoneId | Route53 hosted zone ID responsible for managing records for the domain. Required for 'STATIC_SITE' and 'WEB_SERVER' |
|
|
99
103
|
| enableSSMConnect | Setup ec2 instance and SSM in order to connect to the database in the private subnet. Please refer to the [SSM Connect](#ssm-connect) section for more info. |
|
|
100
104
|
|
|
101
105
|
```ts
|
|
102
|
-
type
|
|
106
|
+
type DatabaseServiceOptions = {
|
|
103
107
|
type: 'DATABASE';
|
|
104
108
|
serviceName: string;
|
|
105
109
|
dbName: pulumi.Input<string>;
|
|
@@ -117,7 +121,7 @@ type DatabaseService = {
|
|
|
117
121
|
```
|
|
118
122
|
|
|
119
123
|
```ts
|
|
120
|
-
export type
|
|
124
|
+
export type RedisServiceOptions = {
|
|
121
125
|
type: 'REDIS';
|
|
122
126
|
serviceName: string;
|
|
123
127
|
dbName: pulumi.Input<string>;
|
|
@@ -126,10 +130,11 @@ export type RedisService = {
|
|
|
126
130
|
```
|
|
127
131
|
|
|
128
132
|
```ts
|
|
129
|
-
export type
|
|
133
|
+
export type StaticSiteServiceOptions = {
|
|
130
134
|
type: 'STATIC_SITE';
|
|
131
135
|
serviceName: string;
|
|
132
136
|
domain?: pulumi.Input<string>;
|
|
137
|
+
hostedZoneId?: pulumi.Input<string>;
|
|
133
138
|
tags?: pulumi.Input<{
|
|
134
139
|
[key: string]: pulumi.Input<string>;
|
|
135
140
|
}>;
|
|
@@ -137,21 +142,103 @@ export type StaticSiteService = {
|
|
|
137
142
|
```
|
|
138
143
|
|
|
139
144
|
```ts
|
|
140
|
-
export type
|
|
145
|
+
export type WebServerServiceOptions = {
|
|
141
146
|
type: 'WEB_SERVER';
|
|
142
147
|
serviceName: string;
|
|
148
|
+
image: pulumi.Input<string>;
|
|
149
|
+
port: pulumi.Input<number>;
|
|
150
|
+
domain?: pulumi.Input<string>;
|
|
151
|
+
hostedZoneId?: pulumi.Input<string>;
|
|
152
|
+
environment?:
|
|
153
|
+
| aws.ecs.KeyValuePair[]
|
|
154
|
+
| ((services: Services) => aws.ecs.KeyValuePair[]);
|
|
155
|
+
secrets?: aws.ecs.Secret[] | ((services: Services) => aws.ecs.Secret[]);
|
|
156
|
+
desiredCount?: pulumi.Input<number>;
|
|
157
|
+
autoscaling?: pulumi.Input<{
|
|
158
|
+
enabled: pulumi.Input<boolean>;
|
|
159
|
+
minCount?: pulumi.Input<number>;
|
|
160
|
+
maxCount?: pulumi.Input<number>;
|
|
161
|
+
}>;
|
|
162
|
+
size?: pulumi.Input<Size>;
|
|
163
|
+
healthCheckPath?: pulumi.Input<string>;
|
|
164
|
+
taskExecutionRoleInlinePolicies?: pulumi.Input<
|
|
165
|
+
pulumi.Input<RoleInlinePolicy>[]
|
|
166
|
+
>;
|
|
167
|
+
taskRoleInlinePolicies?: pulumi.Input<pulumi.Input<RoleInlinePolicy>[]>;
|
|
168
|
+
tags?: pulumi.Input<{
|
|
169
|
+
[key: string]: pulumi.Input<string>;
|
|
170
|
+
}>;
|
|
171
|
+
};
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
export type NuxtSSRServiceOptions = {
|
|
176
|
+
type: 'NUXT_SSR';
|
|
177
|
+
serviceName: string;
|
|
178
|
+
image: pulumi.Input<string>;
|
|
179
|
+
port: pulumi.Input<number>;
|
|
180
|
+
domain?: pulumi.Input<string>;
|
|
181
|
+
hostedZoneId?: pulumi.Input<string>;
|
|
143
182
|
environment?:
|
|
144
183
|
| aws.ecs.KeyValuePair[]
|
|
145
184
|
| ((services: Services) => aws.ecs.KeyValuePair[]);
|
|
146
185
|
secrets?: aws.ecs.Secret[] | ((services: Services) => aws.ecs.Secret[]);
|
|
186
|
+
desiredCount?: pulumi.Input<number>;
|
|
187
|
+
autoscaling?: pulumi.Input<{
|
|
188
|
+
enabled: pulumi.Input<boolean>;
|
|
189
|
+
minCount?: pulumi.Input<number>;
|
|
190
|
+
maxCount?: pulumi.Input<number>;
|
|
191
|
+
}>;
|
|
192
|
+
size?: pulumi.Input<Size>;
|
|
193
|
+
healthCheckPath?: pulumi.Input<string>;
|
|
194
|
+
taskExecutionRoleInlinePolicies?: pulumi.Input<
|
|
195
|
+
pulumi.Input<RoleInlinePolicy>[]
|
|
196
|
+
>;
|
|
197
|
+
taskRoleInlinePolicies?: pulumi.Input<pulumi.Input<RoleInlinePolicy>[]>;
|
|
198
|
+
tags?: pulumi.Input<{
|
|
199
|
+
[key: string]: pulumi.Input<string>;
|
|
200
|
+
}>;
|
|
201
|
+
};
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
```ts
|
|
205
|
+
type MongoServiceOptions = {
|
|
206
|
+
type: 'MONGO';
|
|
207
|
+
serviceName: string;
|
|
208
|
+
username: pulumi.Input<string>;
|
|
209
|
+
password?: pulumi.Input<string>;
|
|
210
|
+
port?: pulumi.Input<number>;
|
|
211
|
+
size?: pulumi.Input<Size>;
|
|
212
|
+
tags?: pulumi.Input<{
|
|
213
|
+
[key: string]: pulumi.Input<string>;
|
|
214
|
+
}>;
|
|
215
|
+
};
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
```ts
|
|
219
|
+
type EcsServiceOptions = {
|
|
220
|
+
type: 'ECS_SERVICE';
|
|
221
|
+
serviceName: string;
|
|
147
222
|
image: pulumi.Input<string>;
|
|
148
223
|
port: pulumi.Input<number>;
|
|
149
|
-
|
|
224
|
+
enableServiceAutoDiscovery: pulumi.Input<boolean>;
|
|
225
|
+
lbTargetGroupArn?: aws.lb.TargetGroup['arn'];
|
|
226
|
+
persistentStorageVolumePath?: pulumi.Input<string>;
|
|
227
|
+
securityGroup?: aws.ec2.SecurityGroup;
|
|
228
|
+
assignPublicIp?: pulumi.Input<boolean>;
|
|
229
|
+
dockerCommand?: pulumi.Input<string[]>;
|
|
230
|
+
environment?:
|
|
231
|
+
| aws.ecs.KeyValuePair[]
|
|
232
|
+
| ((services: Services) => aws.ecs.KeyValuePair[]);
|
|
233
|
+
secrets?: aws.ecs.Secret[] | ((services: Services) => aws.ecs.Secret[]);
|
|
150
234
|
desiredCount?: pulumi.Input<number>;
|
|
151
|
-
|
|
152
|
-
|
|
235
|
+
autoscaling?: pulumi.Input<{
|
|
236
|
+
enabled: pulumi.Input<boolean>;
|
|
237
|
+
minCount?: pulumi.Input<number>;
|
|
238
|
+
maxCount?: pulumi.Input<number>;
|
|
239
|
+
}>;
|
|
153
240
|
size?: pulumi.Input<Size>;
|
|
154
|
-
|
|
241
|
+
healthCheckPath?: pulumi.Input<string>;
|
|
155
242
|
taskExecutionRoleInlinePolicies?: pulumi.Input<
|
|
156
243
|
pulumi.Input<RoleInlinePolicy>[]
|
|
157
244
|
>;
|
|
@@ -168,7 +255,6 @@ recieves services bag as argument.
|
|
|
168
255
|
|
|
169
256
|
```ts
|
|
170
257
|
const project = new studion.Project('demo-project', {
|
|
171
|
-
environment: 'DEVELOPMENT',
|
|
172
258
|
services: [
|
|
173
259
|
{
|
|
174
260
|
type: 'REDIS',
|
|
@@ -181,6 +267,7 @@ const project = new studion.Project('demo-project', {
|
|
|
181
267
|
image: imageUri,
|
|
182
268
|
port: 3000,
|
|
183
269
|
domain: 'api.my-domain.com',
|
|
270
|
+
hostedZoneId: 'my-domain.com-hostedZoneId',
|
|
184
271
|
environment: (services: Services) => {
|
|
185
272
|
const redisServiceName = 'redis';
|
|
186
273
|
const redis = services[redisServiceName];
|
|
@@ -199,7 +286,6 @@ Secret Manager based on arn that is provided for the `valueFrom` field.
|
|
|
199
286
|
|
|
200
287
|
```ts
|
|
201
288
|
const project = new studion.Project('demo-project', {
|
|
202
|
-
environment: 'DEVELOPMENT',
|
|
203
289
|
services: [
|
|
204
290
|
{
|
|
205
291
|
type: 'WEB_SERVER',
|
|
@@ -207,6 +293,7 @@ const project = new studion.Project('demo-project', {
|
|
|
207
293
|
image: imageUri,
|
|
208
294
|
port: 3000,
|
|
209
295
|
domain: 'api.my-domain.com',
|
|
296
|
+
hostedZoneId: 'my-domain.com-hostedZoneId',
|
|
210
297
|
secrets: [
|
|
211
298
|
{ name: 'DB_PASSWORD', valueFrom: 'arn-of-the-secret-manager-secret' },
|
|
212
299
|
],
|
|
@@ -217,7 +304,6 @@ const project = new studion.Project('demo-project', {
|
|
|
217
304
|
|
|
218
305
|
```ts
|
|
219
306
|
const project = new studion.Project('demo-project', {
|
|
220
|
-
environment: 'DEVELOPMENT',
|
|
221
307
|
services: [
|
|
222
308
|
{
|
|
223
309
|
type: 'REDIS',
|
|
@@ -230,6 +316,7 @@ const project = new studion.Project('demo-project', {
|
|
|
230
316
|
image: imageUri,
|
|
231
317
|
port: 3000,
|
|
232
318
|
domain: 'api.my-domain.com',
|
|
319
|
+
hostedZoneId: 'my-domain.com-hostedZoneId',
|
|
233
320
|
secrets: (services: Services) => {
|
|
234
321
|
const redisServiceName = 'redis';
|
|
235
322
|
const redis = services[redisServiceName];
|
|
@@ -268,7 +355,9 @@ new Database(name: string, args: DatabaseArgs, opts?: pulumi.CustomResourceOptio
|
|
|
268
355
|
type DatabaseArgs = {
|
|
269
356
|
dbName: pulumi.Input<string>;
|
|
270
357
|
username: pulumi.Input<string>;
|
|
271
|
-
|
|
358
|
+
vpcId: pulumi.Input<string>;
|
|
359
|
+
isolatedSubnetIds: pulumi.Input<pulumi.Input<string>[]>;
|
|
360
|
+
vpcCidrBlock: pulumi.Input<string>;
|
|
272
361
|
password?: pulumi.Input<string>;
|
|
273
362
|
applyImmediately?: pulumi.Input<boolean>;
|
|
274
363
|
skipFinalSnapshot?: pulumi.Input<boolean>;
|
|
@@ -331,7 +420,7 @@ will exist on the resource.
|
|
|
331
420
|
|
|
332
421
|
### Static Site
|
|
333
422
|
|
|
334
|
-
AWS S3 + Cloudfront
|
|
423
|
+
AWS S3 + Cloudfront.
|
|
335
424
|
|
|
336
425
|
Features:
|
|
337
426
|
|
|
@@ -364,11 +453,11 @@ type StaticSiteArgs = {
|
|
|
364
453
|
|
|
365
454
|
### Web Server
|
|
366
455
|
|
|
367
|
-
AWS ECS Fargate
|
|
456
|
+
AWS ECS Fargate.
|
|
368
457
|
|
|
369
458
|
Features:
|
|
370
459
|
|
|
371
|
-
-
|
|
460
|
+
- memory and CPU autoscaling enabled
|
|
372
461
|
- creates TLS certificate for the specified domain
|
|
373
462
|
- redirects HTTP traffic to HTTPS
|
|
374
463
|
- creates CloudWatch log group
|
|
@@ -390,17 +479,173 @@ new WebServer(name: string, args: WebServerArgs, opts?: pulumi.ComponentResource
|
|
|
390
479
|
export type WebServerArgs = {
|
|
391
480
|
image: pulumi.Input<string>;
|
|
392
481
|
port: pulumi.Input<number>;
|
|
393
|
-
domain: pulumi.Input<string>;
|
|
394
482
|
cluster: aws.ecs.Cluster;
|
|
395
|
-
|
|
396
|
-
|
|
483
|
+
vpcId: pulumi.Input<string>;
|
|
484
|
+
vpcCidrBlock: pulumi.Input<string>;
|
|
485
|
+
publicSubnetIds: pulumi.Input<pulumi.Input<string>[]>;
|
|
486
|
+
domain?: pulumi.Input<string>;
|
|
487
|
+
hostedZoneId?: pulumi.Input<string>;
|
|
397
488
|
desiredCount?: pulumi.Input<number>;
|
|
398
|
-
|
|
399
|
-
|
|
489
|
+
autoscaling?: pulumi.Input<{
|
|
490
|
+
enabled: pulumi.Input<boolean>;
|
|
491
|
+
minCount?: pulumi.Input<number>;
|
|
492
|
+
maxCount?: pulumi.Input<number>;
|
|
493
|
+
}>;
|
|
494
|
+
size?: pulumi.Input<Size>;
|
|
495
|
+
environment?: aws.ecs.KeyValuePair[];
|
|
496
|
+
secrets?: aws.ecs.Secret[];
|
|
497
|
+
healthCheckPath?: pulumi.Input<string>;
|
|
498
|
+
taskExecutionRoleInlinePolicies?: pulumi.Input<
|
|
499
|
+
pulumi.Input<RoleInlinePolicy>[]
|
|
500
|
+
>;
|
|
501
|
+
taskRoleInlinePolicies?: pulumi.Input<pulumi.Input<RoleInlinePolicy>[]>;
|
|
502
|
+
tags?: pulumi.Input<{
|
|
503
|
+
[key: string]: pulumi.Input<string>;
|
|
504
|
+
}>;
|
|
505
|
+
};
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
### Nuxt SSR preset
|
|
509
|
+
|
|
510
|
+
AWS ECS Fargate + Cloudfront.
|
|
511
|
+
|
|
512
|
+
Features:
|
|
513
|
+
|
|
514
|
+
- memory and CPU autoscaling enabled
|
|
515
|
+
- creates TLS certificate for the specified domain
|
|
516
|
+
- redirects HTTP traffic to HTTPS
|
|
517
|
+
- creates CloudWatch log group
|
|
518
|
+
- comes with predefined cpu and memory options: `small`, `medium`, `large`, `xlarge`
|
|
519
|
+
- CDN in front of the application load balancer for static resource caching
|
|
520
|
+
|
|
521
|
+
<br>
|
|
522
|
+
|
|
523
|
+
```ts
|
|
524
|
+
new NuxtSSR(name: string, args: NuxtSSRArgs, opts?: pulumi.ComponentResourceOptions );
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
| Argument | Description |
|
|
528
|
+
| :------- | :--------------------------------------------: |
|
|
529
|
+
| name \* | The unique name of the resource. |
|
|
530
|
+
| args \* | The arguments to resource properties. |
|
|
531
|
+
| opts | Bag of options to control resource's behavior. |
|
|
532
|
+
|
|
533
|
+
```ts
|
|
534
|
+
export type NuxtSSRArgs = {
|
|
535
|
+
image: pulumi.Input<string>;
|
|
536
|
+
port: pulumi.Input<number>;
|
|
537
|
+
cluster: aws.ecs.Cluster;
|
|
538
|
+
vpcId: pulumi.Input<string>;
|
|
539
|
+
vpcCidrBlock: pulumi.Input<string>;
|
|
540
|
+
publicSubnetIds: pulumi.Input<pulumi.Input<string>[]>;
|
|
541
|
+
domain?: pulumi.Input<string>;
|
|
542
|
+
hostedZoneId?: pulumi.Input<string>;
|
|
543
|
+
desiredCount?: pulumi.Input<number>;
|
|
544
|
+
autoscaling?: pulumi.Input<{
|
|
545
|
+
enabled: pulumi.Input<boolean>;
|
|
546
|
+
minCount?: pulumi.Input<number>;
|
|
547
|
+
maxCount?: pulumi.Input<number>;
|
|
548
|
+
}>;
|
|
549
|
+
size?: pulumi.Input<Size>;
|
|
550
|
+
environment?: aws.ecs.KeyValuePair[];
|
|
551
|
+
secrets?: aws.ecs.Secret[];
|
|
552
|
+
healthCheckPath?: pulumi.Input<string>;
|
|
553
|
+
tags?: pulumi.Input<{
|
|
554
|
+
[key: string]: pulumi.Input<string>;
|
|
555
|
+
}>;
|
|
556
|
+
};
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
### Mongo
|
|
560
|
+
|
|
561
|
+
AWS ECS Fargate.
|
|
562
|
+
|
|
563
|
+
Features:
|
|
564
|
+
|
|
565
|
+
- persistent storage
|
|
566
|
+
- service auto-discovery
|
|
567
|
+
- creates CloudWatch log group
|
|
568
|
+
- comes with predefined cpu and memory options: `small`, `medium`, `large`, `xlarge`
|
|
569
|
+
|
|
570
|
+
<br>
|
|
571
|
+
|
|
572
|
+
```ts
|
|
573
|
+
new Mongo(name: string, args: MongoArgs, opts?: pulumi.ComponentResourceOptions );
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
| Argument | Description |
|
|
577
|
+
| :------- | :--------------------------------------------: |
|
|
578
|
+
| name \* | The unique name of the resource. |
|
|
579
|
+
| args \* | The arguments to resource properties. |
|
|
580
|
+
| opts | Bag of options to control resource's behavior. |
|
|
581
|
+
|
|
582
|
+
```ts
|
|
583
|
+
export type MongoArgs = {
|
|
584
|
+
cluster: aws.ecs.Cluster;
|
|
585
|
+
vpcId: pulumi.Input<string>;
|
|
586
|
+
vpcCidrBlock: pulumi.Input<string>;
|
|
587
|
+
privateSubnetIds: pulumi.Input<pulumi.Input<string>[]>;
|
|
588
|
+
username: pulumi.Input<string>;
|
|
589
|
+
password?: pulumi.Input<string>;
|
|
590
|
+
port?: pulumi.Input<number>;
|
|
591
|
+
size?: pulumi.Input<Size>;
|
|
592
|
+
tags?: pulumi.Input<{
|
|
593
|
+
[key: string]: pulumi.Input<string>;
|
|
594
|
+
}>;
|
|
595
|
+
};
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
If the password is not specified it will be autogenerated.
|
|
599
|
+
The mongo password is stored as a secret inside AWS Secret Manager.
|
|
600
|
+
The secret will be available on the `Mongo` resource as `passwordSecret`.
|
|
601
|
+
|
|
602
|
+
### Ecs Service
|
|
603
|
+
|
|
604
|
+
AWS ECS Fargate.
|
|
605
|
+
|
|
606
|
+
Features:
|
|
607
|
+
|
|
608
|
+
- memory and CPU autoscaling
|
|
609
|
+
- service auto discovery
|
|
610
|
+
- persistent storage
|
|
611
|
+
- CloudWatch logs
|
|
612
|
+
- comes with predefined cpu and memory options: `small`, `medium`, `large`, `xlarge`
|
|
613
|
+
|
|
614
|
+
<br>
|
|
615
|
+
|
|
616
|
+
```ts
|
|
617
|
+
new EcsService(name: string, args: EcsServiceArgs, opts?: pulumi.ComponentResourceOptions );
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
| Argument | Description |
|
|
621
|
+
| :------- | :--------------------------------------------: |
|
|
622
|
+
| name \* | The unique name of the resource. |
|
|
623
|
+
| args \* | The arguments to resource properties. |
|
|
624
|
+
| opts | Bag of options to control resource's behavior. |
|
|
625
|
+
|
|
626
|
+
```ts
|
|
627
|
+
export type EcsServiceArgs = {
|
|
628
|
+
image: pulumi.Input<string>;
|
|
629
|
+
port: pulumi.Input<number>;
|
|
630
|
+
cluster: aws.ecs.Cluster;
|
|
631
|
+
vpcId: pulumi.Input<string>;
|
|
632
|
+
vpcCidrBlock: pulumi.Input<string>;
|
|
633
|
+
subnetIds: pulumi.Input<pulumi.Input<string>[]>;
|
|
634
|
+
desiredCount?: pulumi.Input<number>;
|
|
635
|
+
autoscaling?: pulumi.Input<{
|
|
636
|
+
enabled: pulumi.Input<boolean>;
|
|
637
|
+
minCount?: pulumi.Input<number>;
|
|
638
|
+
maxCount?: pulumi.Input<number>;
|
|
639
|
+
}>;
|
|
400
640
|
size?: pulumi.Input<Size>;
|
|
401
641
|
environment?: aws.ecs.KeyValuePair[];
|
|
402
642
|
secrets?: aws.ecs.Secret[];
|
|
403
|
-
|
|
643
|
+
enableServiceAutoDiscovery: pulumi.Input<boolean>;
|
|
644
|
+
persistentStorageVolumePath?: pulumi.Input<string>;
|
|
645
|
+
dockerCommand?: pulumi.Input<string[]>;
|
|
646
|
+
lbTargetGroupArn?: aws.lb.TargetGroup['arn'];
|
|
647
|
+
securityGroup?: aws.ec2.SecurityGroup;
|
|
648
|
+
assignPublicIp?: pulumi.Input<boolean>;
|
|
404
649
|
taskExecutionRoleInlinePolicies?: pulumi.Input<
|
|
405
650
|
pulumi.Input<RoleInlinePolicy>[]
|
|
406
651
|
>;
|
|
@@ -512,5 +757,4 @@ const project = new studion.Project('demo-project', {
|
|
|
512
757
|
## 🚧 TODO
|
|
513
758
|
|
|
514
759
|
- [ ] Add worker service for executing tasks
|
|
515
|
-
- [ ] Add MongoDB service
|
|
516
760
|
- [ ] Enable RDS password rotation
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as aws from '@pulumi/aws';
|
|
2
|
-
import * as awsx from '@pulumi/awsx';
|
|
3
2
|
import * as pulumi from '@pulumi/pulumi';
|
|
4
3
|
export type DatabaseArgs = {
|
|
5
4
|
/**
|
|
@@ -10,33 +9,38 @@ export type DatabaseArgs = {
|
|
|
10
9
|
* Username for the master DB user.
|
|
11
10
|
*/
|
|
12
11
|
username: pulumi.Input<string>;
|
|
12
|
+
vpcId: pulumi.Input<string>;
|
|
13
|
+
isolatedSubnetIds: pulumi.Input<pulumi.Input<string>[]>;
|
|
13
14
|
/**
|
|
14
|
-
* The
|
|
15
|
+
* The IPv4 CIDR block for the VPC.
|
|
15
16
|
*/
|
|
16
|
-
|
|
17
|
+
vpcCidrBlock: pulumi.Input<string>;
|
|
17
18
|
/**
|
|
18
19
|
* Password for the master DB user. If not specified it will be autogenerated.
|
|
19
20
|
* The value will be stored as a secret in AWS Secret Manager.
|
|
20
21
|
*/
|
|
21
22
|
password?: pulumi.Input<string>;
|
|
22
23
|
/**
|
|
23
|
-
* Specifies whether any database modifications are applied immediately,
|
|
24
|
+
* Specifies whether any database modifications are applied immediately,
|
|
25
|
+
* or during the next maintenance window. Default is false.
|
|
24
26
|
*/
|
|
25
27
|
applyImmediately?: pulumi.Input<boolean>;
|
|
26
28
|
/**
|
|
27
|
-
* Determines whether a final DB snapshot is created before the DB
|
|
29
|
+
* Determines whether a final DB snapshot is created before the DB
|
|
30
|
+
* instance is deleted. Defaults to false.
|
|
28
31
|
*/
|
|
29
32
|
skipFinalSnapshot?: pulumi.Input<boolean>;
|
|
30
33
|
/**
|
|
31
|
-
* The allocated storage in gibibytes.
|
|
34
|
+
* The allocated storage in gibibytes. Defaults to 20GB.
|
|
32
35
|
*/
|
|
33
36
|
allocatedStorage?: pulumi.Input<number>;
|
|
34
37
|
/**
|
|
35
|
-
* The upper limit to which Amazon RDS can automatically scale
|
|
38
|
+
* The upper limit to which Amazon RDS can automatically scale
|
|
39
|
+
* the storage of the DB instance. Defaults to 100GB.
|
|
36
40
|
*/
|
|
37
41
|
maxAllocatedStorage?: pulumi.Input<number>;
|
|
38
42
|
/**
|
|
39
|
-
* The instance type of the RDS instance.
|
|
43
|
+
* The instance type of the RDS instance. Defaults to 'db.t4g.micro'.
|
|
40
44
|
*/
|
|
41
45
|
instanceClass?: pulumi.Input<string>;
|
|
42
46
|
/**
|
|
@@ -16,31 +16,31 @@ class Database extends pulumi.ComponentResource {
|
|
|
16
16
|
constructor(name, args, opts = {}) {
|
|
17
17
|
super('studion:Database', name, {}, opts);
|
|
18
18
|
this.name = name;
|
|
19
|
-
const {
|
|
20
|
-
this.dbSubnetGroup = this.createSubnetGroup({
|
|
21
|
-
this.dbSecurityGroup = this.createSecurityGroup({
|
|
19
|
+
const { vpcId, isolatedSubnetIds, vpcCidrBlock } = args;
|
|
20
|
+
this.dbSubnetGroup = this.createSubnetGroup({ isolatedSubnetIds });
|
|
21
|
+
this.dbSecurityGroup = this.createSecurityGroup({ vpcId, vpcCidrBlock });
|
|
22
22
|
this.kms = this.createEncryptionKey();
|
|
23
23
|
const { instance, passwordSecret } = this.createDatabaseInstance(args);
|
|
24
24
|
this.instance = instance;
|
|
25
25
|
this.passwordSecret = passwordSecret;
|
|
26
26
|
this.registerOutputs();
|
|
27
27
|
}
|
|
28
|
-
createSubnetGroup({
|
|
28
|
+
createSubnetGroup({ isolatedSubnetIds, }) {
|
|
29
29
|
const dbSubnetGroup = new aws.rds.SubnetGroup(`${this.name}-subnet-group`, {
|
|
30
|
-
subnetIds:
|
|
30
|
+
subnetIds: isolatedSubnetIds,
|
|
31
31
|
tags: constants_1.commonTags,
|
|
32
32
|
}, { parent: this });
|
|
33
33
|
return dbSubnetGroup;
|
|
34
34
|
}
|
|
35
|
-
createSecurityGroup({
|
|
35
|
+
createSecurityGroup({ vpcId, vpcCidrBlock, }) {
|
|
36
36
|
const dbSecurityGroup = new aws.ec2.SecurityGroup(`${this.name}-security-group`, {
|
|
37
|
-
vpcId
|
|
37
|
+
vpcId,
|
|
38
38
|
ingress: [
|
|
39
39
|
{
|
|
40
40
|
protocol: 'tcp',
|
|
41
41
|
fromPort: 5432,
|
|
42
42
|
toPort: 5432,
|
|
43
|
-
cidrBlocks: [
|
|
43
|
+
cidrBlocks: [vpcCidrBlock],
|
|
44
44
|
},
|
|
45
45
|
],
|
|
46
46
|
tags: constants_1.commonTags,
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import * as pulumi from '@pulumi/pulumi';
|
|
2
2
|
import * as aws from '@pulumi/aws';
|
|
3
|
-
import * as awsx from '@pulumi/awsx';
|
|
4
3
|
export type Ec2SSMConnectArgs = {
|
|
5
|
-
|
|
4
|
+
vpcId: pulumi.Input<string>;
|
|
5
|
+
privateSubnetId: pulumi.Input<string>;
|
|
6
|
+
/**
|
|
7
|
+
* The IPv4 CIDR block for the VPC.
|
|
8
|
+
*/
|
|
9
|
+
vpcCidrBlock: pulumi.Input<string>;
|
|
6
10
|
tags?: pulumi.Input<{
|
|
7
11
|
[key: string]: pulumi.Input<string>;
|
|
8
12
|
}>;
|
|
@@ -20,26 +20,26 @@ const AmazonLinux2023_ARM_EC2_AMI = aws.ec2.getAmiOutput({
|
|
|
20
20
|
class Ec2SSMConnect extends pulumi.ComponentResource {
|
|
21
21
|
constructor(name, args, opts = {}) {
|
|
22
22
|
super('studion:Ec2BastionSSMConnect', name, {}, opts);
|
|
23
|
-
const subnetId = args.
|
|
23
|
+
const subnetId = args.privateSubnetId;
|
|
24
24
|
this.ec2SecurityGroup = new aws.ec2.SecurityGroup(`${name}-ec2-security-group`, {
|
|
25
25
|
ingress: [
|
|
26
26
|
{
|
|
27
27
|
protocol: 'tcp',
|
|
28
28
|
fromPort: 22,
|
|
29
29
|
toPort: 22,
|
|
30
|
-
cidrBlocks: [args.
|
|
30
|
+
cidrBlocks: [args.vpcCidrBlock],
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
protocol: 'tcp',
|
|
34
34
|
fromPort: 443,
|
|
35
35
|
toPort: 443,
|
|
36
|
-
cidrBlocks: [args.
|
|
36
|
+
cidrBlocks: [args.vpcCidrBlock],
|
|
37
37
|
},
|
|
38
38
|
],
|
|
39
39
|
egress: [
|
|
40
40
|
{ protocol: '-1', fromPort: 0, toPort: 0, cidrBlocks: ['0.0.0.0/0'] },
|
|
41
41
|
],
|
|
42
|
-
vpcId: args.
|
|
42
|
+
vpcId: args.vpcId,
|
|
43
43
|
tags: constants_1.commonTags,
|
|
44
44
|
}, { parent: this });
|
|
45
45
|
const role = new aws.iam.Role(`${name}-ec2-role`, {
|
|
@@ -75,7 +75,7 @@ class Ec2SSMConnect extends pulumi.ComponentResource {
|
|
|
75
75
|
tags: Object.assign(Object.assign(Object.assign({}, constants_1.commonTags), { Name: `${name}-ec2` }), args.tags),
|
|
76
76
|
}, { parent: this });
|
|
77
77
|
this.ssmVpcEndpoint = new aws.ec2.VpcEndpoint(`${name}-ssm-vpc-endpoint`, {
|
|
78
|
-
vpcId: args.
|
|
78
|
+
vpcId: args.vpcId,
|
|
79
79
|
ipAddressType: 'ipv4',
|
|
80
80
|
serviceName: `com.amazonaws.${awsRegion}.ssm`,
|
|
81
81
|
vpcEndpointType: 'Interface',
|
|
@@ -85,7 +85,7 @@ class Ec2SSMConnect extends pulumi.ComponentResource {
|
|
|
85
85
|
tags: constants_1.commonTags,
|
|
86
86
|
}, { parent: this, dependsOn: [this.ec2] });
|
|
87
87
|
this.ec2MessagesVpcEndpoint = new aws.ec2.VpcEndpoint(`${name}-ec2messages-vpc-endpoint`, {
|
|
88
|
-
vpcId: args.
|
|
88
|
+
vpcId: args.vpcId,
|
|
89
89
|
ipAddressType: 'ipv4',
|
|
90
90
|
serviceName: `com.amazonaws.${awsRegion}.ec2messages`,
|
|
91
91
|
vpcEndpointType: 'Interface',
|
|
@@ -95,7 +95,7 @@ class Ec2SSMConnect extends pulumi.ComponentResource {
|
|
|
95
95
|
tags: constants_1.commonTags,
|
|
96
96
|
}, { parent: this, dependsOn: [this.ec2] });
|
|
97
97
|
this.ssmMessagesVpcEndpoint = new aws.ec2.VpcEndpoint(`${name}-ssmmessages-vpc-endpoint`, {
|
|
98
|
-
vpcId: args.
|
|
98
|
+
vpcId: args.vpcId,
|
|
99
99
|
ipAddressType: 'ipv4',
|
|
100
100
|
serviceName: `com.amazonaws.${awsRegion}.ssmmessages`,
|
|
101
101
|
vpcEndpointType: 'Interface',
|