Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(deadline): add security group property to ubl #396

Merged
merged 1 commit into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions packages/aws-rfdk/lib/deadline/lib/render-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ export class RenderQueue extends RenderQueueBase implements IGrantable {
}],
updateType: undefined, // Workaround -- See: https://github.com/aws/aws-cdk/issues/11581
updatePolicy: UpdatePolicy.rollingUpdate(),
// addCapacity doesn't specifically take a securityGroup, but it passes on its properties to the ASG it creates,
// so this security group will get applied there
// @ts-ignore
securityGroup: props.securityGroups?.backend,
});
Expand Down
11 changes: 11 additions & 0 deletions packages/aws-rfdk/lib/deadline/lib/usage-based-licensing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
InstanceClass,
InstanceSize,
InstanceType,
ISecurityGroup,
IVpc,
Port,
SubnetSelection,
Expand Down Expand Up @@ -418,6 +419,12 @@ export interface UsageBasedLicensingProps {
* @default - LogGroup will be created with all properties' default values to the LogGroup: /renderfarm/<construct id>
*/
readonly logGroupProps?: LogGroupFactoryProps;

/**
* The security group to use for the License Forwarder
* @default - A new security group will be created
*/
readonly securityGroup?: ISecurityGroup;
}

/**
Expand Down Expand Up @@ -511,6 +518,10 @@ export class UsageBasedLicensing extends Construct implements IGrantable {
deviceName: '/dev/xvda',
volume: BlockDeviceVolume.ebs( 30, {encrypted: true}),
}],
// addCapacity doesn't specifically take a securityGroup, but it passes on its properties to the ASG it creates,
// so this security group will get applied there
// @ts-ignore
securityGroup: props.securityGroup,
});

const taskDefinition = new TaskDefinition(this, 'TaskDefinition', {
Expand Down
19 changes: 19 additions & 0 deletions packages/aws-rfdk/lib/deadline/test/usage-based-licensing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,25 @@ describe('UsageBasedLicensing', () => {
),
}));
});

test('uses the supplied security group', () => {
const securityGroup = new SecurityGroup(stack, 'UblSecurityGroup', {
vpc,
});
// WHEN
new UsageBasedLicensing(stack, 'UBL', {
certificateSecret,
images,
licenses,
renderQueue,
vpc,
securityGroup,
});
// THEN
expectCDK(stack).to(haveResourceLike('AWS::AutoScaling::LaunchConfiguration', {
SecurityGroups: arrayWith(stack.resolve(securityGroup.securityGroupId)),
}));
});
});

describe('creates an ECS service', () => {
Expand Down