aws-cdk-lib#Tokenization TypeScript Examples
The following examples show how to use
aws-cdk-lib#Tokenization.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: plugin.ts From lift with MIT License | 6 votes |
private resolveLazyVariables() {
// Use the CDK token resolver to resolve all lazy variables in the template
const tokenResolver = new DefaultTokenResolver(new StringConcat());
const resolveTokens = <T>(input: T): T => {
if (input === undefined) {
return input;
}
return Tokenization.resolve(input, {
resolver: tokenResolver,
scope: (this.providers[DEFAULT_PROVIDER] as AwsProvider).stack,
}) as T;
};
this.serverless.service.provider = resolveTokens(this.serverless.service.provider);
this.serverless.service.package = resolveTokens(this.serverless.service.package);
this.serverless.service.custom = resolveTokens(this.serverless.service.custom);
this.serverless.service.resources = resolveTokens(this.serverless.service.resources);
this.serverless.service.functions = resolveTokens(this.serverless.service.functions);
this.serverless.service.layers = resolveTokens(this.serverless.service.layers);
this.serverless.service.outputs = resolveTokens(this.serverless.service.outputs);
// Also resolve tokens in `configurationInput` because they also appear in there
this.serverless.configurationInput = resolveTokens(this.serverless.configurationInput);
}