dcl-ops-lib 6.8.1 → 6.8.3

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.
@@ -58,7 +58,7 @@ export type FargateTaskOptions = {
58
58
  maxCapacity: number;
59
59
  metricName: string;
60
60
  targetValue: number;
61
- metricDimensionName: pulumi.Output<string>;
61
+ metricDimensionValue: pulumi.Output<string>;
62
62
  statistic?: "Average" | "Minimum" | "Maximum";
63
63
  scaleOutCooldown?: number;
64
64
  scaleInCooldown?: number;
@@ -117,7 +117,7 @@ export type InternalServiceOptions = {
117
117
  maxCapacity: number;
118
118
  metricName: string;
119
119
  targetValue: number;
120
- metricDimensionName: pulumi.Output<string>;
120
+ metricDimensionValue: pulumi.Output<string>;
121
121
  statistic?: "Average" | "Minimum" | "Maximum";
122
122
  scaleOutCooldown?: number;
123
123
  scaleInCooldown?: number;
@@ -372,40 +372,43 @@ function createInternalService(config) {
372
372
  }
373
373
  function setAutoscaling(service, config) {
374
374
  const taskUniqueIdentifier = `${service.name}-${domain_1.env}`;
375
- const ecsTarget = new aws.appautoscaling.Target(`ecs-target-${taskUniqueIdentifier}`, {
376
- maxCapacity: config.maxCapacity,
377
- minCapacity: config.desiredCount,
378
- resourceId: `service/${service.cluster}/${service.name}`,
379
- scalableDimension: "ecs:service:DesiredCount",
380
- serviceNamespace: "ecs",
381
- });
382
- const CSM_ApproximateNumberOfMessagesVisible = {
383
- metricName: config.metricName,
384
- namespace: "AWS/SQS",
385
- dimensions: [
386
- {
387
- name: "QueueName",
388
- value: config.metricDimensionName
375
+ // resolve the Output<string> before using it
376
+ config.metricDimensionValue.apply(metricValue => {
377
+ const ecsTarget = new aws.appautoscaling.Target(`ecs-target-${taskUniqueIdentifier}`, {
378
+ maxCapacity: config.maxCapacity,
379
+ minCapacity: config.desiredCount,
380
+ resourceId: pulumi.interpolate `service/${service.cluster}/${service.name}`,
381
+ scalableDimension: "ecs:service:DesiredCount",
382
+ serviceNamespace: "ecs",
383
+ });
384
+ const CSM_ApproximateNumberOfMessagesVisible = {
385
+ metricName: config.metricName,
386
+ namespace: "AWS/SQS",
387
+ dimensions: [
388
+ {
389
+ name: "QueueName",
390
+ value: metricValue,
391
+ },
392
+ ],
393
+ statistic: config.statistic,
394
+ unit: "Count",
395
+ };
396
+ let TTS_CustomizedMetricSpecification = undefined;
397
+ if (config.metricName === "ApproximateNumberOfMessagesVisible") {
398
+ TTS_CustomizedMetricSpecification = CSM_ApproximateNumberOfMessagesVisible;
399
+ }
400
+ return new aws.appautoscaling.Policy(`ecs-autoscaling-policy-${taskUniqueIdentifier}`, {
401
+ policyType: "TargetTrackingScaling",
402
+ resourceId: ecsTarget.resourceId,
403
+ scalableDimension: ecsTarget.scalableDimension,
404
+ serviceNamespace: ecsTarget.serviceNamespace,
405
+ targetTrackingScalingPolicyConfiguration: {
406
+ targetValue: config.targetValue,
407
+ customizedMetricSpecification: TTS_CustomizedMetricSpecification,
408
+ scaleOutCooldown: config.scaleOutCooldown,
409
+ scaleInCooldown: config.scaleInCooldown,
389
410
  },
390
- ],
391
- statistic: config.statistic,
392
- unit: "Count",
393
- };
394
- let TTS_CustomizedMetricSpecification = undefined;
395
- if (config.metricName === "ApproximateNumberOfMessagesVisible") {
396
- TTS_CustomizedMetricSpecification = CSM_ApproximateNumberOfMessagesVisible;
397
- }
398
- return new aws.appautoscaling.Policy(`ecs-autoscaling-policy-${taskUniqueIdentifier}`, {
399
- policyType: "TargetTrackingScaling",
400
- resourceId: ecsTarget.resourceId,
401
- scalableDimension: ecsTarget.scalableDimension,
402
- serviceNamespace: ecsTarget.serviceNamespace,
403
- targetTrackingScalingPolicyConfiguration: {
404
- targetValue: config.targetValue,
405
- customizedMetricSpecification: TTS_CustomizedMetricSpecification,
406
- scaleOutCooldown: config.scaleOutCooldown,
407
- scaleInCooldown: config.scaleInCooldown,
408
- },
409
- }, { dependsOn: [ecsTarget] });
411
+ }, { dependsOn: [ecsTarget] });
412
+ });
410
413
  }
411
414
  //# sourceMappingURL=createFargateTask.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dcl-ops-lib",
3
- "version": "6.8.1",
3
+ "version": "6.8.3",
4
4
  "scripts": {
5
5
  "build": "tsc && cp bin/* . && node test.js",
6
6
  "clean": "rm *.d.ts *.js *.js.map"