Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type {
import {
AwsLogDriver, Cluster,
} from '../../../aws-ecs';
import type { IRole } from '../../../aws-iam';
import type { IQueue } from '../../../aws-sqs';
import { Queue } from '../../../aws-sqs';
import { CfnOutput, Duration, FeatureFlags, Stack, ValidationError } from '../../../core';
Expand Down Expand Up @@ -195,6 +196,15 @@ export interface QueueProcessingServiceBaseProps {
*/
readonly family?: string;

/**
* The role that will be used by the task.
*
* Only used when `image` is specified (not when `taskDefinition` is provided).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When taskDefinition is provided, the new taskRole prop is silently ignored. The existing code already validates the image + taskDefinition conflict with a clear error, we should also add a similar validation (or expand the existing one) for this new prop

*
* @default - A new role is created
*/
readonly taskRole?: IRole;

/**
* The maximum number of tasks, specified as a percentage of the Amazon ECS
* service's DesiredCount value, that can run in a service during a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export class QueueProcessingEc2Service extends QueueProcessingServiceBase {
// Create a Task Definition for the container to start
this.taskDefinition = new Ec2TaskDefinition(this, 'QueueProcessingTaskDef', {
family: props.family,
taskRole: props.taskRole,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will also require proper unit + integration testing

});
this.taskDefinition.addContainer(containerName, {
image: props.image,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export class QueueProcessingFargateService extends QueueProcessingServiceBase {
ephemeralStorageGiB: props.ephemeralStorageGiB,
family: props.family,
runtimePlatform: props.runtimePlatform,
taskRole: props.taskRole,
});

const containerName = props.containerName ?? 'QueueProcessingContainer';
Expand Down
Loading