in packages/aws-rfdk/lib/deadline/lib/thinkbox-docker-images.ts [185:243]
constructor(scope: Construct, id: string, props: ThinkboxDockerImagesProps) {
super(scope, id);
this.userAwsCustomerAgreementAndIpLicenseAcceptance = props.userAwsCustomerAgreementAndIpLicenseAcceptance;
this.version = props?.version;
const lambdaCode = Code.fromAsset(path.join(__dirname, '..', '..', 'lambdas', 'nodejs'));
const lambdaFunc = new SingletonFunction(this, 'VersionProviderFunction', {
uuid: '08553416-1fc9-4be9-a818-609a31ae1b5b',
description: 'Used by the ThinkboxDockerImages construct to look up the ECR repositories where AWS Thinkbox publishes Deadline container images.',
code: lambdaCode,
runtime: Runtime.NODEJS_18_X,
handler: 'ecr-provider.handler',
timeout: Duration.seconds(30),
logRetention: RetentionDays.ONE_WEEK,
});
const ecrProvider = new CustomResource(this, 'ThinkboxEcrProvider', {
serviceToken: lambdaFunc.functionArn,
properties: {
// create a random string that will force the Lambda to "update" on each deployment. Changes to its output will
// be propagated to any CloudFormation resource providers that reference the output ARN
ForceRun: this.forceRun(),
},
resourceType: 'Custom::RFDK_EcrProvider',
});
this.node.defaultChild = ecrProvider;
this.ecrBaseURI = ecrProvider.getAtt('EcrURIPrefix').toString();
this.remoteConnectionServer = this.ecrImageForRecipe(ThinkboxManagedDeadlineDockerRecipes.REMOTE_CONNECTION_SERVER);
this.licenseForwarder = this.ecrImageForRecipe(ThinkboxManagedDeadlineDockerRecipes.LICENSE_FORWARDER);
const thisConstruct = this;
this.node.addValidation({
validate(): string[] {
const errors: string[] = [];
// Users must accept the AWS Customer Agreement and AWS Intellectual Property License to use the container images
if (thisConstruct.userAwsCustomerAgreementAndIpLicenseAcceptance !==
AwsCustomerAgreementAndIpLicenseAcceptance.USER_ACCEPTS_AWS_CUSTOMER_AGREEMENT_AND_IP_LICENSE) {
errors.push(ThinkboxDockerImages.AWS_CONTENT_NOTICE);
}
// Using the output of VersionQuery across stacks can cause issues. CloudFormation stack outputs cannot change if
// a resource in another stack is referencing it.
if (thisConstruct.version instanceof VersionQuery) {
const versionStack = Stack.of(thisConstruct.version);
const thisStack = Stack.of(thisConstruct);
if (versionStack != thisStack) {
errors.push('A VersionQuery can not be supplied from a different stack');
}
}
return errors;
},
});
}