Skip to content

Commit

Permalink
docs and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
go-to-k committed Jan 12, 2024
1 parent 1a93d1a commit e6155d2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/aws-cdk-lib/aws-ecs/lib/base/base-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,9 @@ export class EbsVolume extends Construct {
}
}

/**
* Render for CloudFormation property.
*/
public render(): CfnService.ServiceVolumeConfigurationProperty[] | undefined {
if (!this) {
return;
Expand Down
24 changes: 24 additions & 0 deletions packages/aws-cdk-lib/aws-ecs/test/task-definition.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,30 @@ describe('task definition', () => {
Template.fromStack(stack);
}).toThrow("ECS Container Container must have at least one of 'memoryLimitMiB' or 'memoryReservationMiB' specified");
});

test('A task definition with EC2 and configuredAtLaunch', () => {
// GIVEN
const stack = new cdk.Stack();

// WHEN
const def = new ecs.TaskDefinition(stack, 'TD', {
cpu: '512',
memoryMiB: '512',
compatibility: ecs.Compatibility.EC2_AND_FARGATE,
});
def.addVolume({
name: 'volume',
configuredAtLaunch: true,
});

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', {
Volumes: [{
Name: 'volume',
ConfiguredAtLaunch: true,
}],
});
});
});

describe('When importing from an existing Task definition', () => {
Expand Down

0 comments on commit e6155d2

Please sign in to comment.