Skip to content

Commit 2fb42be

Browse files
committed
Replace cluster resource with id and name properties
1 parent 834bc48 commit 2fb42be

File tree

6 files changed

+37
-19
lines changed

6 files changed

+37
-19
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,8 @@ new WebServer(name: string, args: WebServerArgs, opts?: pulumi.ComponentResource
479479
export type WebServerArgs = {
480480
image: pulumi.Input<string>;
481481
port: pulumi.Input<number>;
482-
cluster: aws.ecs.Cluster;
482+
clusterId: pulumi.Input<string>;
483+
clusterName: pulumi.Input<string>;
483484
vpcId: pulumi.Input<string>;
484485
vpcCidrBlock: pulumi.Input<string>;
485486
publicSubnetIds: pulumi.Input<pulumi.Input<string>[]>;
@@ -534,7 +535,8 @@ new NuxtSSR(name: string, args: NuxtSSRArgs, opts?: pulumi.ComponentResourceOpti
534535
export type NuxtSSRArgs = {
535536
image: pulumi.Input<string>;
536537
port: pulumi.Input<number>;
537-
cluster: aws.ecs.Cluster;
538+
clusterId: pulumi.Input<string>;
539+
clusterName: pulumi.Input<string>;
538540
vpcId: pulumi.Input<string>;
539541
vpcCidrBlock: pulumi.Input<string>;
540542
publicSubnetIds: pulumi.Input<pulumi.Input<string>[]>;
@@ -581,7 +583,8 @@ new Mongo(name: string, args: MongoArgs, opts?: pulumi.ComponentResourceOptions
581583

582584
```ts
583585
export type MongoArgs = {
584-
cluster: aws.ecs.Cluster;
586+
clusterId: pulumi.Input<string>;
587+
clusterName: pulumi.Input<string>;
585588
vpcId: pulumi.Input<string>;
586589
vpcCidrBlock: pulumi.Input<string>;
587590
privateSubnetIds: pulumi.Input<pulumi.Input<string>[]>;
@@ -627,7 +630,8 @@ new EcsService(name: string, args: EcsServiceArgs, opts?: pulumi.ComponentResour
627630
export type EcsServiceArgs = {
628631
image: pulumi.Input<string>;
629632
port: pulumi.Input<number>;
630-
cluster: aws.ecs.Cluster;
633+
clusterId: pulumi.Input<string>;
634+
clusterName: pulumi.Input<string>;
631635
vpcId: pulumi.Input<string>;
632636
vpcCidrBlock: pulumi.Input<string>;
633637
subnetIds: pulumi.Input<pulumi.Input<string>[]>;

src/components/ecs-service.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,13 @@ export type EcsServiceArgs = {
4242
*/
4343
port: pulumi.Input<number>;
4444
/**
45-
* The aws.ecs.Cluster resource.
45+
* The aws.ecs.Cluster id.
4646
*/
47-
cluster: aws.ecs.Cluster;
47+
clusterId: pulumi.Input<string>;
48+
/**
49+
* The aws.ecs.Cluster name.
50+
*/
51+
clusterName: pulumi.Input<string>;
4852
vpcId: pulumi.Input<string>;
4953
/**
5054
* The IPv4 CIDR block for the VPC.
@@ -494,7 +498,7 @@ export class EcsService extends pulumi.ComponentResource {
494498
`${this.name}-service`,
495499
{
496500
name: this.name,
497-
cluster: argsWithDefaults.cluster.id,
501+
cluster: argsWithDefaults.clusterId,
498502
launchType: 'FARGATE',
499503
desiredCount: argsWithDefaults.desiredCount,
500504
taskDefinition: this.taskDefinition.arn,
@@ -537,7 +541,7 @@ export class EcsService extends pulumi.ComponentResource {
537541
{
538542
minCapacity: argsWithDefaults.autoscaling.minCount,
539543
maxCapacity: argsWithDefaults.autoscaling.maxCount,
540-
resourceId: pulumi.interpolate`service/${argsWithDefaults.cluster.name}/${this.service.name}`,
544+
resourceId: pulumi.interpolate`service/${argsWithDefaults.clusterName}/${this.service.name}`,
541545
serviceNamespace: 'ecs',
542546
scalableDimension: 'ecs:service:DesiredCount',
543547
tags: commonTags,

src/components/mongo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { EcsService, EcsServiceArgs } from './ecs-service';
66

77
export type MongoArgs = Pick<
88
EcsServiceArgs,
9-
'size' | 'cluster' | 'vpcId' | 'vpcCidrBlock' | 'tags'
9+
'size' | 'clusterId' | 'clusterName' | 'vpcId' | 'vpcCidrBlock' | 'tags'
1010
> & {
1111
/**
1212
* Username for the master DB user.

src/components/nuxt-ssr.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ export type NuxtSSRArgs = Pick<
99
EcsServiceArgs,
1010
| 'image'
1111
| 'port'
12-
| 'cluster'
12+
| 'clusterId'
13+
| 'clusterName'
1314
| 'vpcId'
1415
| 'vpcCidrBlock'
1516
| 'desiredCount'

src/components/project.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ export type WebServerServiceOptions = {
4646
} & ServiceArgs &
4747
Omit<
4848
WebServerArgs,
49-
| 'cluster'
49+
| 'clusterId'
50+
| 'clusterName'
5051
| 'vpcId'
5152
| 'vpcCidrBlock'
5253
| 'publicSubnetIds'
@@ -63,7 +64,8 @@ export type NuxtSSRServiceOptions = {
6364
} & ServiceArgs &
6465
Omit<
6566
NuxtSSRArgs,
66-
| 'cluster'
67+
| 'clusterId'
68+
| 'clusterName'
6769
| 'vpcId'
6870
| 'vpcCidrBlock'
6971
| 'publicSubnetIds'
@@ -76,7 +78,8 @@ export type MongoServiceOptions = {
7678
} & ServiceArgs &
7779
Omit<
7880
MongoArgs,
79-
| 'cluster'
81+
| 'clusterId'
82+
| 'clusterName'
8083
| 'vpcId'
8184
| 'vpcCidrBlock'
8285
| 'privateSubnetIds'
@@ -93,7 +96,8 @@ export type EcsServiceOptions = {
9396
} & ServiceArgs &
9497
Omit<
9598
EcsServiceArgs,
96-
| 'cluster'
99+
| 'clusterId'
100+
| 'clusterName'
97101
| 'vpcId'
98102
| 'vpcCidrBlock'
99103
| 'subnetIds'
@@ -263,7 +267,8 @@ export class Project extends pulumi.ComponentResource {
263267
serviceName,
264268
{
265269
...ecsOptions,
266-
cluster: this.cluster,
270+
clusterId: this.cluster.id,
271+
clusterName: this.cluster.name,
267272
vpcId: this.vpc.vpcId,
268273
vpcCidrBlock: this.vpc.vpc.cidrBlock,
269274
publicSubnetIds: this.vpc.publicSubnetIds,
@@ -291,7 +296,8 @@ export class Project extends pulumi.ComponentResource {
291296
serviceName,
292297
{
293298
...ecsOptions,
294-
cluster: this.cluster,
299+
clusterId: this.cluster.id,
300+
clusterName: this.cluster.name,
295301
vpcId: this.vpc.vpcId,
296302
vpcCidrBlock: this.vpc.vpc.cidrBlock,
297303
publicSubnetIds: this.vpc.publicSubnetIds,
@@ -312,7 +318,8 @@ export class Project extends pulumi.ComponentResource {
312318
serviceName,
313319
{
314320
...mongoOptions,
315-
cluster: this.cluster,
321+
clusterId: this.cluster.id,
322+
clusterName: this.cluster.name,
316323
vpcId: this.vpc.vpcId,
317324
vpcCidrBlock: this.vpc.vpc.cidrBlock,
318325
privateSubnetIds: this.vpc.privateSubnetIds,
@@ -338,7 +345,8 @@ export class Project extends pulumi.ComponentResource {
338345
serviceName,
339346
{
340347
...ecsOptions,
341-
cluster: this.cluster,
348+
clusterId: this.cluster.id,
349+
clusterName: this.cluster.name,
342350
vpcId: this.vpc.vpcId,
343351
vpcCidrBlock: this.vpc.vpc.cidrBlock,
344352
subnetIds: ecsOptions.assignPublicIp

src/components/web-server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ export type WebServerArgs = Pick<
88
EcsServiceArgs,
99
| 'image'
1010
| 'port'
11-
| 'cluster'
11+
| 'clusterId'
12+
| 'clusterName'
1213
| 'vpcId'
1314
| 'vpcCidrBlock'
1415
| 'desiredCount'

0 commit comments

Comments
 (0)