@studion/infra-code-blocks 0.2.3 → 0.4.0

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 CHANGED
@@ -372,7 +372,7 @@ type DatabaseArgs = {
372
372
 
373
373
  If the password is not specified it will be autogenerated.
374
374
  The database password is stored as a secret inside AWS Secret Manager.
375
- The secret will be available on the `Database` resource as `passwordSecret`.
375
+ The secret will be available on the `Database` resource as `password.secret`.
376
376
 
377
377
  ### Redis
378
378
 
@@ -479,7 +479,8 @@ new WebServer(name: string, args: WebServerArgs, opts?: pulumi.ComponentResource
479
479
  export type WebServerArgs = {
480
480
  image: pulumi.Input<string>;
481
481
  port: pulumi.Input<number>;
482
- cluster: aws.ecs.Cluster;
482
+ clusterId: pulumi.Input<string>;
483
+ clusterName: pulumi.Input<string>;
483
484
  vpcId: pulumi.Input<string>;
484
485
  vpcCidrBlock: pulumi.Input<string>;
485
486
  publicSubnetIds: pulumi.Input<pulumi.Input<string>[]>;
@@ -534,7 +535,8 @@ new NuxtSSR(name: string, args: NuxtSSRArgs, opts?: pulumi.ComponentResourceOpti
534
535
  export type NuxtSSRArgs = {
535
536
  image: pulumi.Input<string>;
536
537
  port: pulumi.Input<number>;
537
- cluster: aws.ecs.Cluster;
538
+ clusterId: pulumi.Input<string>;
539
+ clusterName: pulumi.Input<string>;
538
540
  vpcId: pulumi.Input<string>;
539
541
  vpcCidrBlock: pulumi.Input<string>;
540
542
  publicSubnetIds: pulumi.Input<pulumi.Input<string>[]>;
@@ -581,7 +583,8 @@ new Mongo(name: string, args: MongoArgs, opts?: pulumi.ComponentResourceOptions
581
583
 
582
584
  ```ts
583
585
  export type MongoArgs = {
584
- cluster: aws.ecs.Cluster;
586
+ clusterId: pulumi.Input<string>;
587
+ clusterName: pulumi.Input<string>;
585
588
  vpcId: pulumi.Input<string>;
586
589
  vpcCidrBlock: pulumi.Input<string>;
587
590
  privateSubnetIds: pulumi.Input<pulumi.Input<string>[]>;
@@ -597,7 +600,7 @@ export type MongoArgs = {
597
600
 
598
601
  If the password is not specified it will be autogenerated.
599
602
  The mongo password is stored as a secret inside AWS Secret Manager.
600
- The secret will be available on the `Mongo` resource as `passwordSecret`.
603
+ The secret will be available on the `Mongo` resource as `password.secret`.
601
604
 
602
605
  ### Ecs Service
603
606
 
@@ -627,7 +630,8 @@ new EcsService(name: string, args: EcsServiceArgs, opts?: pulumi.ComponentResour
627
630
  export type EcsServiceArgs = {
628
631
  image: pulumi.Input<string>;
629
632
  port: pulumi.Input<number>;
630
- cluster: aws.ecs.Cluster;
633
+ clusterId: pulumi.Input<string>;
634
+ clusterName: pulumi.Input<string>;
631
635
  vpcId: pulumi.Input<string>;
632
636
  vpcCidrBlock: pulumi.Input<string>;
633
637
  subnetIds: pulumi.Input<pulumi.Input<string>[]>;
@@ -1,5 +1,6 @@
1
1
  import * as aws from '@pulumi/aws';
2
2
  import * as pulumi from '@pulumi/pulumi';
3
+ import { Password } from './password';
3
4
  export type DatabaseArgs = {
4
5
  /**
5
6
  * The name of the database to create when the DB instance is created.
@@ -56,11 +57,10 @@ export declare class Database extends pulumi.ComponentResource {
56
57
  kms: aws.kms.Key;
57
58
  dbSubnetGroup: aws.rds.SubnetGroup;
58
59
  dbSecurityGroup: aws.ec2.SecurityGroup;
59
- passwordSecret: aws.secretsmanager.Secret;
60
+ password: Password;
60
61
  constructor(name: string, args: DatabaseArgs, opts?: pulumi.ComponentResourceOptions);
61
62
  private createSubnetGroup;
62
63
  private createSecurityGroup;
63
64
  private createEncryptionKey;
64
- private createPasswordSecret;
65
65
  private createDatabaseInstance;
66
66
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Database = void 0;
4
4
  const aws = require("@pulumi/aws");
5
5
  const pulumi = require("@pulumi/pulumi");
6
- const random = require("@pulumi/random");
6
+ const password_1 = require("./password");
7
7
  const constants_1 = require("../constants");
8
8
  const defaults = {
9
9
  applyImmediately: false,
@@ -20,9 +20,8 @@ class Database extends pulumi.ComponentResource {
20
20
  this.dbSubnetGroup = this.createSubnetGroup({ isolatedSubnetIds });
21
21
  this.dbSecurityGroup = this.createSecurityGroup({ vpcId, vpcCidrBlock });
22
22
  this.kms = this.createEncryptionKey();
23
- const { instance, passwordSecret } = this.createDatabaseInstance(args);
24
- this.instance = instance;
25
- this.passwordSecret = passwordSecret;
23
+ this.password = new password_1.Password(`${this.name}-database-password`, { value: args.password }, { parent: this });
24
+ this.instance = this.createDatabaseInstance(args);
26
25
  this.registerOutputs();
27
26
  }
28
27
  createSubnetGroup({ isolatedSubnetIds, }) {
@@ -59,29 +58,9 @@ class Database extends pulumi.ComponentResource {
59
58
  }, { parent: this });
60
59
  return kms;
61
60
  }
62
- createPasswordSecret({ password }) {
63
- const project = pulumi.getProject();
64
- const stack = pulumi.getStack();
65
- const passwordSecret = new aws.secretsmanager.Secret(`${this.name}-password-secret`, {
66
- namePrefix: `${stack}/${project}/DatabasePassword-`,
67
- tags: constants_1.commonTags,
68
- }, { parent: this });
69
- const passwordSecretValue = new aws.secretsmanager.SecretVersion(`${this.name}-password-secret-value`, {
70
- secretId: passwordSecret.id,
71
- secretString: password,
72
- }, { parent: this, dependsOn: [passwordSecret] });
73
- return passwordSecret;
74
- }
75
61
  createDatabaseInstance(args) {
76
62
  const argsWithDefaults = Object.assign({}, defaults, args);
77
63
  const stack = pulumi.getStack();
78
- const password = argsWithDefaults.password ||
79
- new random.RandomPassword(`${this.name}-db-password`, {
80
- length: 16,
81
- overrideSpecial: '_%$',
82
- special: true,
83
- }).result;
84
- const passwordSecret = this.createPasswordSecret({ password });
85
64
  const instance = new aws.rds.Instance(`${this.name}-rds`, {
86
65
  identifierPrefix: `${this.name}-`,
87
66
  engine: 'postgres',
@@ -91,7 +70,7 @@ class Database extends pulumi.ComponentResource {
91
70
  instanceClass: argsWithDefaults.instanceClass,
92
71
  dbName: argsWithDefaults.dbName,
93
72
  username: argsWithDefaults.username,
94
- password,
73
+ password: this.password.value,
95
74
  dbSubnetGroupName: this.dbSubnetGroup.name,
96
75
  vpcSecurityGroupIds: [this.dbSecurityGroup.id],
97
76
  storageEncrypted: true,
@@ -105,8 +84,8 @@ class Database extends pulumi.ComponentResource {
105
84
  backupWindow: '06:00-06:30',
106
85
  backupRetentionPeriod: 14,
107
86
  tags: Object.assign(Object.assign({}, constants_1.commonTags), argsWithDefaults.tags),
108
- }, { parent: this });
109
- return { instance, passwordSecret };
87
+ }, { parent: this, dependsOn: [this.password] });
88
+ return instance;
110
89
  }
111
90
  }
112
91
  exports.Database = Database;
@@ -23,9 +23,13 @@ export type EcsServiceArgs = {
23
23
  */
24
24
  port: pulumi.Input<number>;
25
25
  /**
26
- * The aws.ecs.Cluster resource.
26
+ * The aws.ecs.Cluster id.
27
27
  */
28
- cluster: aws.ecs.Cluster;
28
+ clusterId: pulumi.Input<string>;
29
+ /**
30
+ * The aws.ecs.Cluster name.
31
+ */
32
+ clusterName: pulumi.Input<string>;
29
33
  vpcId: pulumi.Input<string>;
30
34
  /**
31
35
  * The IPv4 CIDR block for the VPC.
@@ -261,7 +261,7 @@ class EcsService extends pulumi.ComponentResource {
261
261
  ],
262
262
  tags: constants_1.commonTags,
263
263
  }, { parent: this });
264
- const service = new aws.ecs.Service(`${this.name}-service`, Object.assign(Object.assign(Object.assign(Object.assign({ name: this.name, cluster: argsWithDefaults.cluster.id, launchType: 'FARGATE', desiredCount: argsWithDefaults.desiredCount, taskDefinition: this.taskDefinition.arn, enableExecuteCommand: true }, (argsWithDefaults.lbTargetGroupArn && {
264
+ const service = new aws.ecs.Service(`${this.name}-service`, Object.assign(Object.assign(Object.assign(Object.assign({ name: this.name, cluster: argsWithDefaults.clusterId, launchType: 'FARGATE', desiredCount: argsWithDefaults.desiredCount, taskDefinition: this.taskDefinition.arn, enableExecuteCommand: true }, (argsWithDefaults.lbTargetGroupArn && {
265
265
  loadBalancers: [
266
266
  {
267
267
  containerName: this.name,
@@ -289,7 +289,7 @@ class EcsService extends pulumi.ComponentResource {
289
289
  const autoscalingTarget = new aws.appautoscaling.Target(`${this.name}-autoscale-target`, {
290
290
  minCapacity: argsWithDefaults.autoscaling.minCount,
291
291
  maxCapacity: argsWithDefaults.autoscaling.maxCount,
292
- resourceId: pulumi.interpolate `service/${argsWithDefaults.cluster.name}/${this.service.name}`,
292
+ resourceId: pulumi.interpolate `service/${argsWithDefaults.clusterName}/${this.service.name}`,
293
293
  serviceNamespace: 'ecs',
294
294
  scalableDimension: 'ecs:service:DesiredCount',
295
295
  tags: constants_1.commonTags,
@@ -1,7 +1,7 @@
1
1
  import * as pulumi from '@pulumi/pulumi';
2
- import * as aws from '@pulumi/aws';
3
2
  import { EcsService, EcsServiceArgs } from './ecs-service';
4
- export type MongoArgs = Pick<EcsServiceArgs, 'size' | 'cluster' | 'vpcId' | 'vpcCidrBlock' | 'tags'> & {
3
+ import { Password } from './password';
4
+ export type MongoArgs = Pick<EcsServiceArgs, 'size' | 'clusterId' | 'clusterName' | 'vpcId' | 'vpcCidrBlock' | 'tags'> & {
5
5
  /**
6
6
  * Username for the master DB user.
7
7
  */
@@ -20,8 +20,6 @@ export type MongoArgs = Pick<EcsServiceArgs, 'size' | 'cluster' | 'vpcId' | 'vpc
20
20
  export declare class Mongo extends pulumi.ComponentResource {
21
21
  name: string;
22
22
  service: EcsService;
23
- passwordSecret: aws.secretsmanager.Secret;
23
+ password: Password;
24
24
  constructor(name: string, args: MongoArgs, opts?: pulumi.ComponentResourceOptions);
25
- private createRandomPassword;
26
- private createPasswordSecret;
27
25
  }
@@ -13,18 +13,15 @@ var __rest = (this && this.__rest) || function (s, e) {
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.Mongo = void 0;
15
15
  const pulumi = require("@pulumi/pulumi");
16
- const aws = require("@pulumi/aws");
17
- const random = require("@pulumi/random");
18
- const constants_1 = require("../constants");
19
16
  const ecs_service_1 = require("./ecs-service");
17
+ const password_1 = require("./password");
20
18
  class Mongo extends pulumi.ComponentResource {
21
19
  constructor(name, args, opts = {}) {
22
20
  super('studion:Mongo', name, args, opts);
23
21
  const port = args.port || 27017;
24
22
  const { username, password, privateSubnetIds } = args, ecsServiceArgs = __rest(args, ["username", "password", "privateSubnetIds"]);
25
23
  this.name = name;
26
- const mongoPassword = password || this.createRandomPassword();
27
- this.passwordSecret = this.createPasswordSecret(mongoPassword);
24
+ this.password = new password_1.Password(`${this.name}-mongo-password`, { value: password }, { parent: this });
28
25
  this.service = new ecs_service_1.EcsService(name, Object.assign(Object.assign({}, ecsServiceArgs), { port, image: 'mongo:7.0.3@sha256:238b1636bdd7820c752b91bec8a669f92568eb313ad89a1fc4a92903c1b40489', desiredCount: 1, autoscaling: { enabled: false }, enableServiceAutoDiscovery: true, persistentStorageVolumePath: '/data/db', dockerCommand: ['mongod', '--port', port.toString()], assignPublicIp: false, subnetIds: privateSubnetIds, environment: [
29
26
  {
30
27
  name: 'MONGO_INITDB_ROOT_USERNAME',
@@ -33,31 +30,10 @@ class Mongo extends pulumi.ComponentResource {
33
30
  ], secrets: [
34
31
  {
35
32
  name: 'MONGO_INITDB_ROOT_PASSWORD',
36
- valueFrom: this.passwordSecret.arn,
33
+ valueFrom: this.password.secret.arn,
37
34
  },
38
35
  ] }), Object.assign(Object.assign({}, opts), { parent: this }));
39
36
  this.registerOutputs();
40
37
  }
41
- createRandomPassword() {
42
- const password = new random.RandomPassword(`${this.name}-mongo-password`, {
43
- length: 16,
44
- overrideSpecial: '_%$',
45
- special: true,
46
- });
47
- return password.result;
48
- }
49
- createPasswordSecret(password) {
50
- const project = pulumi.getProject();
51
- const stack = pulumi.getStack();
52
- const passwordSecret = new aws.secretsmanager.Secret(`${this.name}-password-secret`, {
53
- namePrefix: `${stack}/${project}/MongoPassword-`,
54
- tags: constants_1.commonTags,
55
- }, { parent: this });
56
- const passwordSecretValue = new aws.secretsmanager.SecretVersion(`${this.name}-password-secret-value`, {
57
- secretId: passwordSecret.id,
58
- secretString: password,
59
- }, { parent: this, dependsOn: [passwordSecret] });
60
- return passwordSecret;
61
- }
62
38
  }
63
39
  exports.Mongo = Mongo;
@@ -2,7 +2,7 @@ import * as pulumi from '@pulumi/pulumi';
2
2
  import * as aws from '@pulumi/aws';
3
3
  import { AcmCertificate } from './acm-certificate';
4
4
  import { EcsService, EcsServiceArgs } from './ecs-service';
5
- export type NuxtSSRArgs = Pick<EcsServiceArgs, 'image' | 'port' | 'cluster' | 'vpcId' | 'vpcCidrBlock' | 'desiredCount' | 'autoscaling' | 'size' | 'environment' | 'secrets' | 'tags'> & {
5
+ export type NuxtSSRArgs = Pick<EcsServiceArgs, 'image' | 'port' | 'clusterId' | 'clusterName' | 'vpcId' | 'vpcCidrBlock' | 'desiredCount' | 'autoscaling' | 'size' | 'environment' | 'secrets' | 'tags'> & {
6
6
  publicSubnetIds: pulumi.Input<pulumi.Input<string>[]>;
7
7
  /**
8
8
  * The domain which will be used to access the service.
@@ -0,0 +1,12 @@
1
+ import * as aws from '@pulumi/aws';
2
+ import * as pulumi from '@pulumi/pulumi';
3
+ export type PasswordArgs = {
4
+ value?: pulumi.Input<string>;
5
+ };
6
+ export declare class Password extends pulumi.ComponentResource {
7
+ name: string;
8
+ value: pulumi.Output<string>;
9
+ secret: aws.secretsmanager.Secret;
10
+ constructor(name: string, args: PasswordArgs, opts?: pulumi.ComponentResourceOptions);
11
+ private createPasswordSecret;
12
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Password = void 0;
4
+ const aws = require("@pulumi/aws");
5
+ const pulumi = require("@pulumi/pulumi");
6
+ const random = require("@pulumi/random");
7
+ const constants_1 = require("../constants");
8
+ class Password extends pulumi.ComponentResource {
9
+ constructor(name, args, opts = {}) {
10
+ const optsWithDefauls = pulumi.mergeOptions(opts, {
11
+ additionalSecretOutputs: ['value'],
12
+ });
13
+ super('studion:Password', name, {}, optsWithDefauls);
14
+ this.name = name;
15
+ if (args.value) {
16
+ this.value = pulumi.output(args.value);
17
+ }
18
+ else {
19
+ const password = new random.RandomPassword(`${this.name}-random-password`, {
20
+ length: 16,
21
+ overrideSpecial: '_%$',
22
+ special: true,
23
+ }, { parent: this });
24
+ this.value = password.result;
25
+ }
26
+ this.secret = this.createPasswordSecret(this.value);
27
+ this.registerOutputs();
28
+ }
29
+ createPasswordSecret(password) {
30
+ const project = pulumi.getProject();
31
+ const stack = pulumi.getStack();
32
+ const passwordSecret = new aws.secretsmanager.Secret(`${this.name}-password-secret`, {
33
+ namePrefix: `${stack}/${project}/${this.name}-`,
34
+ tags: constants_1.commonTags,
35
+ }, { parent: this });
36
+ const passwordSecretValue = new aws.secretsmanager.SecretVersion(`${this.name}-password-secret-value`, {
37
+ secretId: passwordSecret.id,
38
+ secretString: password,
39
+ }, { parent: this, dependsOn: [passwordSecret] });
40
+ return passwordSecret;
41
+ }
42
+ }
43
+ exports.Password = Password;
@@ -31,20 +31,20 @@ export type WebServerServiceOptions = {
31
31
  type: 'WEB_SERVER';
32
32
  environment?: aws.ecs.KeyValuePair[] | ((services: Services) => aws.ecs.KeyValuePair[]);
33
33
  secrets?: aws.ecs.Secret[] | ((services: Services) => aws.ecs.Secret[]);
34
- } & ServiceArgs & Omit<WebServerArgs, 'cluster' | 'vpcId' | 'vpcCidrBlock' | 'publicSubnetIds' | 'environment' | 'secrets'>;
34
+ } & ServiceArgs & Omit<WebServerArgs, 'clusterId' | 'clusterName' | 'vpcId' | 'vpcCidrBlock' | 'publicSubnetIds' | 'environment' | 'secrets'>;
35
35
  export type NuxtSSRServiceOptions = {
36
36
  type: 'NUXT_SSR';
37
37
  environment?: aws.ecs.KeyValuePair[] | ((services: Services) => aws.ecs.KeyValuePair[]);
38
38
  secrets?: aws.ecs.Secret[] | ((services: Services) => aws.ecs.Secret[]);
39
- } & ServiceArgs & Omit<NuxtSSRArgs, 'cluster' | 'vpcId' | 'vpcCidrBlock' | 'publicSubnetIds' | 'environment' | 'secrets'>;
39
+ } & ServiceArgs & Omit<NuxtSSRArgs, 'clusterId' | 'clusterName' | 'vpcId' | 'vpcCidrBlock' | 'publicSubnetIds' | 'environment' | 'secrets'>;
40
40
  export type MongoServiceOptions = {
41
41
  type: 'MONGO';
42
- } & ServiceArgs & Omit<MongoArgs, 'cluster' | 'vpcId' | 'vpcCidrBlock' | 'privateSubnetIds' | 'environment' | 'secrets'>;
42
+ } & ServiceArgs & Omit<MongoArgs, 'clusterId' | 'clusterName' | 'vpcId' | 'vpcCidrBlock' | 'privateSubnetIds' | 'environment' | 'secrets'>;
43
43
  export type EcsServiceOptions = {
44
44
  type: 'ECS_SERVICE';
45
45
  environment?: aws.ecs.KeyValuePair[] | ((services: Services) => aws.ecs.KeyValuePair[]);
46
46
  secrets?: aws.ecs.Secret[] | ((services: Services) => aws.ecs.Secret[]);
47
- } & ServiceArgs & Omit<EcsServiceArgs, 'cluster' | 'vpcId' | 'vpcCidrBlock' | 'subnetIds' | 'environment' | 'secrets'>;
47
+ } & ServiceArgs & Omit<EcsServiceArgs, 'clusterId' | 'clusterName' | 'vpcId' | 'vpcCidrBlock' | 'subnetIds' | 'environment' | 'secrets'>;
48
48
  export type ProjectArgs = {
49
49
  services: (DatabaseServiceOptions | RedisServiceOptions | StaticSiteServiceOptions | WebServerServiceOptions | NuxtSSRServiceOptions | MongoServiceOptions | EcsServiceOptions)[];
50
50
  enableSSMConnect?: pulumi.Input<boolean>;
@@ -133,7 +133,7 @@ class Project extends pulumi.ComponentResource {
133
133
  ? environment(this.services)
134
134
  : environment;
135
135
  const parsedSecrets = typeof secrets === 'function' ? secrets(this.services) : secrets;
136
- const service = new web_server_1.WebServer(serviceName, Object.assign(Object.assign({}, ecsOptions), { cluster: this.cluster, vpcId: this.vpc.vpcId, vpcCidrBlock: this.vpc.vpc.cidrBlock, publicSubnetIds: this.vpc.publicSubnetIds, environment: parsedEnv, secrets: parsedSecrets }), { parent: this });
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
137
  this.services[options.serviceName] = service;
138
138
  }
139
139
  createNuxtSSRService(options) {
@@ -144,14 +144,14 @@ class Project extends pulumi.ComponentResource {
144
144
  ? environment(this.services)
145
145
  : environment;
146
146
  const parsedSecrets = typeof secrets === 'function' ? secrets(this.services) : secrets;
147
- const service = new nuxt_ssr_1.NuxtSSR(serviceName, Object.assign(Object.assign({}, ecsOptions), { cluster: this.cluster, vpcId: this.vpc.vpcId, vpcCidrBlock: this.vpc.vpc.cidrBlock, publicSubnetIds: this.vpc.publicSubnetIds, environment: parsedEnv, secrets: parsedSecrets }), { parent: this });
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
148
  this.services[options.serviceName] = service;
149
149
  }
150
150
  createMongoService(options) {
151
151
  if (!this.cluster)
152
152
  throw new MissingEcsCluster();
153
153
  const { serviceName } = options, mongoOptions = __rest(options, ["serviceName"]);
154
- const service = new mongo_1.Mongo(serviceName, Object.assign(Object.assign({}, mongoOptions), { cluster: this.cluster, vpcId: this.vpc.vpcId, vpcCidrBlock: this.vpc.vpc.cidrBlock, privateSubnetIds: this.vpc.privateSubnetIds }), { parent: this });
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
155
  this.services[options.serviceName] = service;
156
156
  }
157
157
  createEcsService(options) {
@@ -162,7 +162,7 @@ class Project extends pulumi.ComponentResource {
162
162
  ? environment(this.services)
163
163
  : environment;
164
164
  const parsedSecrets = typeof secrets === 'function' ? secrets(this.services) : secrets;
165
- const service = new ecs_service_1.EcsService(serviceName, Object.assign(Object.assign({}, ecsOptions), { cluster: this.cluster, vpcId: this.vpc.vpcId, vpcCidrBlock: this.vpc.vpc.cidrBlock, subnetIds: ecsOptions.assignPublicIp
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
166
  ? this.vpc.publicSubnetIds
167
167
  : this.vpc.privateSubnetIds, environment: parsedEnv, secrets: parsedSecrets }), { parent: this });
168
168
  this.services[options.serviceName] = service;
@@ -2,7 +2,7 @@ import * as pulumi from '@pulumi/pulumi';
2
2
  import * as aws from '@pulumi/aws';
3
3
  import { AcmCertificate } from './acm-certificate';
4
4
  import { EcsService, EcsServiceArgs } from './ecs-service';
5
- export type WebServerArgs = Pick<EcsServiceArgs, 'image' | 'port' | 'cluster' | 'vpcId' | 'vpcCidrBlock' | 'desiredCount' | 'autoscaling' | 'size' | 'environment' | 'secrets' | 'taskExecutionRoleInlinePolicies' | 'taskRoleInlinePolicies' | 'tags'> & {
5
+ export type WebServerArgs = Pick<EcsServiceArgs, 'image' | 'port' | 'clusterId' | 'clusterName' | 'vpcId' | 'vpcCidrBlock' | 'desiredCount' | 'autoscaling' | 'size' | 'environment' | 'secrets' | 'taskExecutionRoleInlinePolicies' | 'taskRoleInlinePolicies' | 'tags'> & {
6
6
  publicSubnetIds: pulumi.Input<pulumi.Input<string>[]>;
7
7
  /**
8
8
  * The domain which will be used to access the service.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studion/infra-code-blocks",
3
- "version": "0.2.3",
3
+ "version": "0.4.0",
4
4
  "description": "Studion common infra components",
5
5
  "keywords": [
6
6
  "infrastructure",