Skip to content

Commit

Permalink
Simplify props
Browse files Browse the repository at this point in the history
  • Loading branch information
plumdog committed Jan 22, 2024
1 parent e040d30 commit d2a0644
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as pathlib from 'path';
import { Stack, Duration, Arn } from 'aws-cdk-lib';
import { Duration, Arn } from 'aws-cdk-lib';
import * as ecs from 'aws-cdk-lib/aws-ecs';
import * as events from 'aws-cdk-lib/aws-events';
import * as eventsTargets from 'aws-cdk-lib/aws-events-targets';
Expand All @@ -13,7 +13,6 @@ export interface MutableTagEcsUpdaterProps {
ecsService: ecs.IBaseService;
pullSecret: secretsmanager.ISecret;
autoUpdateRate?: string;
clusterStack?: Stack;
}

export class MutableTagEcsUpdater extends Construct {
Expand Down Expand Up @@ -52,19 +51,22 @@ export class MutableTagEcsUpdater extends Construct {
resources: ['*'],
}),
);

const clusterArnParts = Arn.parse(props.ecsCluster.clusterArn);

Check failure on line 55 in index.ts

View workflow job for this annotation

GitHub Actions / build-and-test

Property 'parse' does not exist on type 'typeof Arn'.
const clusterTasksArn = Arn.format(
{
...clusterArnParts,
resource: 'task',
resourceName: `${clusterArnParts.resourceName}/*`,
},
);

tagUpdateLambda.addToRolePolicy(
new iam.PolicyStatement({
actions: ['ecs:DescribeTasks'],
resources: [
`${props.ecsService.serviceArn}/*`,
Arn.format(
{
resource: 'task',
service: 'ecs',
resourceName: `${props.ecsCluster.clusterName}/*`,
},
props.clusterStack,
),
clusterTasksArn,
],
}),
);
Expand Down

0 comments on commit d2a0644

Please sign in to comment.