@studion/infra-code-blocks 0.2.3 → 0.3.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
@@ -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>[]>;
@@ -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>[]>;
@@ -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
2
  import * as aws from '@pulumi/aws';
3
3
  import { EcsService, EcsServiceArgs } from './ecs-service';
4
- export type MongoArgs = Pick<EcsServiceArgs, 'size' | 'cluster' | 'vpcId' | 'vpcCidrBlock' | 'tags'> & {
4
+ export type MongoArgs = Pick<EcsServiceArgs, 'size' | 'clusterId' | 'clusterName' | 'vpcId' | 'vpcCidrBlock' | 'tags'> & {
5
5
  /**
6
6
  * Username for the master DB user.
7
7
  */
@@ -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.
@@ -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.3.0",
4
4
  "description": "Studion common infra components",
5
5
  "keywords": [
6
6
  "infrastructure",