Skip to content

Commit 9c5000d

Browse files
authored
refactor(core): introduce cached lazies (#11253)
`Lazy.stringValue()` used to be strictly uncached; however, this has an extremely negative impact on synthesis performance when token resolution is performed many times and complex operations are being performed in Lazies, such as JSONification (see #11250 for context). 99% of the time, the value calculated by a Lazy does not actually need to be recalculated, and the value can simply be cached. Right now, we have no API to indicate whether or not caching on the return value is okay. Although it should *probably* be fine to switch the default behavior of `Lazy.stringValue()` to be cached, it's still a little risky. This PR introduces new methods to construct lazies: * `Lazy.string()`/`Lazy.uncachedString()`. * `Lazy.number()`/`Lazy.uncachedNumber()`. * `Lazy.list()`/`Lazy.uncachedList()`. * `Lazy.any()`/`Lazy.uncachedAny()`. Which replace the existing `Lazy.xxxValue()`. New method names were chosen instead of an additional option for readability: the syntactic structure of how `Lazy.stringValue()` is usually used makes adding a `{ cached: true }` options block to the end of every existing call site rather visually noisy. Plus, deprecating the existing method and replacing it with new ones forces current usage sites to think clearly about whether or not their current use is cacheable or not. The *very* computationally heavy implemention of `toJsonString()` should be changed to be cacheable, but has not been done yet in this PR. This PR simply introduces the concept of cacheable vs uncacheable tokens. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 47811ef commit 9c5000d

File tree

134 files changed

+573
-293
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+573
-293
lines changed

packages/@aws-cdk/aws-amplify/lib/app.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -219,17 +219,17 @@ export class App extends Resource implements IApp, iam.IGrantable {
219219
buildSpec: props.autoBranchCreation.buildSpec && props.autoBranchCreation.buildSpec.toBuildSpec(),
220220
enableAutoBranchCreation: true,
221221
enableAutoBuild: props.autoBranchCreation.autoBuild === undefined ? true : props.autoBranchCreation.autoBuild,
222-
environmentVariables: Lazy.anyValue({ produce: () => renderEnvironmentVariables(this.autoBranchEnvironmentVariables ) }, { omitEmptyArray: true }), // eslint-disable-line max-len
222+
environmentVariables: Lazy.any({ produce: () => renderEnvironmentVariables(this.autoBranchEnvironmentVariables ) }, { omitEmptyArray: true }), // eslint-disable-line max-len
223223
enablePullRequestPreview: props.autoBranchCreation.pullRequestPreview === undefined ? true : props.autoBranchCreation.pullRequestPreview,
224224
pullRequestEnvironmentName: props.autoBranchCreation.pullRequestEnvironmentName,
225225
stage: props.autoBranchCreation.stage,
226226
},
227227
enableBranchAutoDeletion: props.autoBranchDeletion,
228228
basicAuthConfig: props.basicAuth && props.basicAuth.bind(this, 'AppBasicAuth'),
229229
buildSpec: props.buildSpec && props.buildSpec.toBuildSpec(),
230-
customRules: Lazy.anyValue({ produce: () => this.customRules }, { omitEmptyArray: true }),
230+
customRules: Lazy.any({ produce: () => this.customRules }, { omitEmptyArray: true }),
231231
description: props.description,
232-
environmentVariables: Lazy.anyValue({ produce: () => renderEnvironmentVariables(this.environmentVariables) }, { omitEmptyArray: true }),
232+
environmentVariables: Lazy.any({ produce: () => renderEnvironmentVariables(this.environmentVariables) }, { omitEmptyArray: true }),
233233
iamServiceRole: role.roleArn,
234234
name: props.appName || this.node.id,
235235
oauthToken: sourceCodeProviderOptions?.oauthToken?.toString(),

packages/@aws-cdk/aws-amplify/lib/branch.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export class Branch extends Resource implements IBranch {
141141
description: props.description,
142142
enableAutoBuild: props.autoBuild === undefined ? true : props.autoBuild,
143143
enablePullRequestPreview: props.pullRequestPreview === undefined ? true : props.pullRequestPreview,
144-
environmentVariables: Lazy.anyValue({ produce: () => renderEnvironmentVariables(this.environmentVariables) }, { omitEmptyArray: true }),
144+
environmentVariables: Lazy.any({ produce: () => renderEnvironmentVariables(this.environmentVariables) }, { omitEmptyArray: true }),
145145
pullRequestEnvironmentName: props.pullRequestEnvironmentName,
146146
stage: props.stage,
147147
});

packages/@aws-cdk/aws-amplify/lib/domain.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class Domain extends Resource {
105105
const domain = new CfnDomain(this, 'Resource', {
106106
appId: props.app.appId,
107107
domainName,
108-
subDomainSettings: Lazy.anyValue({ produce: () => this.renderSubDomainSettings() }, { omitEmptyArray: true }),
108+
subDomainSettings: Lazy.any({ produce: () => this.renderSubDomainSettings() }, { omitEmptyArray: true }),
109109
});
110110

111111
this.arn = domain.attrArn;

packages/@aws-cdk/aws-apigateway/lib/authorizers/lambda.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ abstract class LambdaAuthorizer extends Authorizer implements IAuthorizer {
118118
* Throws an error, during token resolution, if no RestApi is attached to this authorizer.
119119
*/
120120
protected lazyRestApiId() {
121-
return Lazy.stringValue({
121+
return Lazy.string({
122122
produce: () => {
123123
if (!this.restApiId) {
124124
throw new Error(`Authorizer (${this.node.path}) must be attached to a RestApi`);

packages/@aws-cdk/aws-apigateway/lib/deployment.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class Deployment extends Resource {
7878
}
7979

8080
this.api = props.api;
81-
this.deploymentId = Lazy.stringValue({ produce: () => this.resource.ref });
81+
this.deploymentId = Lazy.string({ produce: () => this.resource.ref });
8282

8383
if (props.api instanceof RestApiBase) {
8484
props.api._attachDeployment(this);
@@ -141,7 +141,7 @@ class LatestDeploymentResource extends CfnDeployment {
141141

142142
this.api = props.restApi;
143143
this.originalLogicalId = this.stack.getLogicalId(this);
144-
this.overrideLogicalId(Lazy.stringValue({ produce: () => this.calculateLogicalId() }));
144+
this.overrideLogicalId(Lazy.uncachedString({ produce: () => this.calculateLogicalId() }));
145145
}
146146

147147
/**

packages/@aws-cdk/aws-apigateway/lib/integration.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export class Integration {
204204
const options = this.props.options;
205205

206206
if (options?.connectionType === ConnectionType.VPC_LINK && uri === undefined) {
207-
uri = Lazy.stringValue({
207+
uri = Lazy.string({
208208
// needs to be a lazy since the targets can be added to the VpcLink construct after initialization.
209209
produce: () => {
210210
const vpcLink = options.vpcLink;

packages/@aws-cdk/aws-apigateway/lib/integrations/aws.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class AwsIntegration extends Integration {
7878
super({
7979
type,
8080
integrationHttpMethod: props.integrationHttpMethod || 'POST',
81-
uri: cdk.Lazy.stringValue({
81+
uri: cdk.Lazy.string({
8282
produce: () => {
8383
if (!this.scope) { throw new Error('AwsIntegration must be used in API'); }
8484
return cdk.Stack.of(this.scope).formatArn({

packages/@aws-cdk/aws-apigateway/lib/integrations/lambda.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class LambdaIntegration extends AwsIntegration {
6363
this.handler.addPermission(`ApiPermission.${desc}`, {
6464
principal,
6565
scope: method,
66-
sourceArn: Lazy.stringValue({ produce: () => method.methodArn }),
66+
sourceArn: Lazy.string({ produce: () => method.methodArn }),
6767
});
6868

6969
// add permission to invoke from the console

packages/@aws-cdk/aws-apigateway/lib/usage-plan.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export class UsagePlan extends Resource {
156156
let resource: CfnUsagePlan;
157157

158158
resource = new CfnUsagePlan(this, 'Resource', {
159-
apiStages: Lazy.anyValue({ produce: () => this.renderApiStages(this.apiStages) }),
159+
apiStages: Lazy.any({ produce: () => this.renderApiStages(this.apiStages) }),
160160
description: props.description,
161161
quota: this.renderQuota(props),
162162
throttle: this.renderThrottle(props.throttle),

packages/@aws-cdk/aws-apigateway/lib/vpc-link.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ export class VpcLink extends Resource implements IVpcLink {
6666
constructor(scope: Construct, id: string, props: VpcLinkProps = {}) {
6767
super(scope, id, {
6868
physicalName: props.vpcLinkName ||
69-
Lazy.stringValue({ produce: () => Names.nodeUniqueId(this.node) }),
69+
Lazy.string({ produce: () => Names.nodeUniqueId(this.node) }),
7070
});
7171

7272
const cfnResource = new CfnVpcLink(this, 'Resource', {
7373
name: this.physicalName,
7474
description: props.description,
75-
targetArns: Lazy.listValue({ produce: () => this.renderTargets() }),
75+
targetArns: Lazy.list({ produce: () => this.renderTargets() }),
7676
});
7777

7878
this.vpcLinkId = cfnResource.ref;

packages/@aws-cdk/aws-apigateway/test/deployment.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ describe('deployment', () => {
147147

148148
// tokens supported, and are resolved upon synthesis
149149
const value = 'hello hello';
150-
deployment.addToLogicalId({ foo: Lazy.stringValue({ produce: () => value }) });
150+
deployment.addToLogicalId({ foo: Lazy.string({ produce: () => value }) });
151151

152152
const template2 = synthesize();
153153
expect(template2.Resources.deployment333819758d91bed959c6bd6268ba84f6d33e888e).toBeDefined();

packages/@aws-cdk/aws-apigateway/test/stage.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ describe('stage', () => {
319319

320320
// WHEN
321321
const testLogGroup = new logs.LogGroup(stack, 'LogGroup');
322-
const testFormat = apigateway.AccessLogFormat.custom(cdk.Lazy.stringValue({ produce: () => 'test' }));
322+
const testFormat = apigateway.AccessLogFormat.custom(cdk.Lazy.string({ produce: () => 'test' }));
323323

324324
// THEN
325325
expect(() => new apigateway.Stage(stack, 'my-stage', {

packages/@aws-cdk/aws-applicationautoscaling/lib/scalable-target.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export class ScalableTarget extends Resource implements IScalableTarget {
125125
resourceId: props.resourceId,
126126
roleArn: this.role.roleArn,
127127
scalableDimension: props.scalableDimension,
128-
scheduledActions: Lazy.anyValue({ produce: () => this.actions }, { omitEmptyArray: true }),
128+
scheduledActions: Lazy.any({ produce: () => this.actions }, { omitEmptyArray: true }),
129129
serviceNamespace: props.serviceNamespace,
130130
});
131131

packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-action.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export class StepScalingAction extends cdk.Construct {
9090
cooldown: props.cooldown && props.cooldown.toSeconds(),
9191
minAdjustmentMagnitude: props.minAdjustmentMagnitude,
9292
metricAggregationType: props.metricAggregationType,
93-
stepAdjustments: cdk.Lazy.anyValue({ produce: () => this.adjustments }),
93+
stepAdjustments: cdk.Lazy.any({ produce: () => this.adjustments }),
9494
} as CfnScalingPolicy.StepScalingPolicyConfigurationProperty,
9595
});
9696

packages/@aws-cdk/aws-applicationautoscaling/test/test.scalable-target.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ export = {
4040
serviceNamespace: appscaling.ServiceNamespace.DYNAMODB,
4141
scalableDimension: 'test:TestCount',
4242
resourceId: 'test:this/test',
43-
minCapacity: cdk.Lazy.numberValue({ produce: () => 10 }),
44-
maxCapacity: cdk.Lazy.numberValue({ produce: () => 1 }),
43+
minCapacity: cdk.Lazy.number({ produce: () => 10 }),
44+
maxCapacity: cdk.Lazy.number({ produce: () => 1 }),
4545
});
4646

4747
// THEN: no exception

packages/@aws-cdk/aws-appmesh/lib/mesh.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export class Mesh extends MeshBase {
186186

187187
constructor(scope: Construct, id: string, props: MeshProps = {}) {
188188
super(scope, id, {
189-
physicalName: props.meshName || cdk.Lazy.stringValue({ produce: () => cdk.Names.uniqueId(this) }),
189+
physicalName: props.meshName || cdk.Lazy.string({ produce: () => cdk.Names.uniqueId(this) }),
190190
});
191191

192192
const mesh = new CfnMesh(this, 'Resource', {

packages/@aws-cdk/aws-appmesh/lib/route.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class Route extends cdk.Resource implements IRoute {
110110

111111
constructor(scope: Construct, id: string, props: RouteProps) {
112112
super(scope, id, {
113-
physicalName: props.routeName || cdk.Lazy.stringValue({ produce: () => cdk.Names.uniqueId(this) }),
113+
physicalName: props.routeName || cdk.Lazy.string({ produce: () => cdk.Names.uniqueId(this) }),
114114
});
115115

116116
this.virtualRouter = props.virtualRouter;

packages/@aws-cdk/aws-appmesh/lib/virtual-node.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export class VirtualNode extends VirtualNodeBase {
180180

181181
constructor(scope: Construct, id: string, props: VirtualNodeProps) {
182182
super(scope, id, {
183-
physicalName: props.virtualNodeName || cdk.Lazy.stringValue({ produce: () => cdk.Names.uniqueId(this) }),
183+
physicalName: props.virtualNodeName || cdk.Lazy.string({ produce: () => cdk.Names.uniqueId(this) }),
184184
});
185185

186186
this.mesh = props.mesh;
@@ -193,8 +193,8 @@ export class VirtualNode extends VirtualNodeBase {
193193
virtualNodeName: this.physicalName,
194194
meshName: this.mesh.meshName,
195195
spec: {
196-
backends: cdk.Lazy.anyValue({ produce: () => this.backends }, { omitEmptyArray: true }),
197-
listeners: cdk.Lazy.anyValue({ produce: () => this.listeners.map(listener => listener.listener) }, { omitEmptyArray: true }),
196+
backends: cdk.Lazy.any({ produce: () => this.backends }, { omitEmptyArray: true }),
197+
listeners: cdk.Lazy.any({ produce: () => this.listeners.map(listener => listener.listener) }, { omitEmptyArray: true }),
198198
serviceDiscovery: {
199199
dns: props.dnsHostName !== undefined ? { hostname: props.dnsHostName } : undefined,
200200
awsCloudMap: props.cloudMapService !== undefined ? {

packages/@aws-cdk/aws-appmesh/lib/virtual-router.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export class VirtualRouter extends VirtualRouterBase {
141141

142142
constructor(scope: Construct, id: string, props: VirtualRouterProps) {
143143
super(scope, id, {
144-
physicalName: props.virtualRouterName || cdk.Lazy.stringValue({ produce: () => cdk.Names.uniqueId(this) }),
144+
physicalName: props.virtualRouterName || cdk.Lazy.string({ produce: () => cdk.Names.uniqueId(this) }),
145145
});
146146

147147
this.mesh = props.mesh;

packages/@aws-cdk/aws-appmesh/lib/virtual-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export class VirtualService extends cdk.Resource implements IVirtualService {
123123

124124
constructor(scope: Construct, id: string, props: VirtualServiceProps) {
125125
super(scope, id, {
126-
physicalName: props.virtualServiceName || cdk.Lazy.stringValue({ produce: () => cdk.Names.uniqueId(this) }),
126+
physicalName: props.virtualServiceName || cdk.Lazy.string({ produce: () => cdk.Names.uniqueId(this) }),
127127
});
128128

129129
if (props.virtualNode && props.virtualRouter) {

packages/@aws-cdk/aws-appsync/lib/schema.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class Schema {
8080
this.schema = new CfnGraphQLSchema(api, 'Schema', {
8181
apiId: api.apiId,
8282
definition: this.mode === SchemaMode.CODE ?
83-
Lazy.stringValue({
83+
Lazy.string({
8484
produce: () => this.types.reduce((acc, type) => { return `${acc}${type._bindToGraphqlApi(api).toString()}\n`; },
8585
`${this.declareSchema()}${this.definition}`),
8686
})

packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -936,8 +936,8 @@ export class AutoScalingGroup extends AutoScalingGroupBase implements
936936
// use delayed evaluation
937937
const imageConfig = props.machineImage.getImage(this);
938938
this.userData = props.userData ?? imageConfig.userData;
939-
const userDataToken = Lazy.stringValue({ produce: () => Fn.base64(this.userData.render()) });
940-
const securityGroupsToken = Lazy.listValue({ produce: () => this.securityGroups.map(sg => sg.securityGroupId) });
939+
const userDataToken = Lazy.string({ produce: () => Fn.base64(this.userData.render()) });
940+
const securityGroupsToken = Lazy.list({ produce: () => this.securityGroups.map(sg => sg.securityGroupId) });
941941

942942
const launchConfig = new CfnLaunchConfiguration(this, 'LaunchConfig', {
943943
imageId: imageConfig.imageId,
@@ -1014,10 +1014,10 @@ export class AutoScalingGroup extends AutoScalingGroupBase implements
10141014
maxSize: Tokenization.stringifyNumber(maxCapacity),
10151015
desiredCapacity: desiredCapacity !== undefined ? Tokenization.stringifyNumber(desiredCapacity) : undefined,
10161016
launchConfigurationName: launchConfig.ref,
1017-
loadBalancerNames: Lazy.listValue({ produce: () => this.loadBalancerNames }, { omitEmpty: true }),
1018-
targetGroupArns: Lazy.listValue({ produce: () => this.targetGroupArns }, { omitEmpty: true }),
1017+
loadBalancerNames: Lazy.list({ produce: () => this.loadBalancerNames }, { omitEmpty: true }),
1018+
targetGroupArns: Lazy.list({ produce: () => this.targetGroupArns }, { omitEmpty: true }),
10191019
notificationConfigurations: this.renderNotificationConfiguration(),
1020-
metricsCollection: Lazy.anyValue({ produce: () => this.renderMetricsCollection() }),
1020+
metricsCollection: Lazy.any({ produce: () => this.renderMetricsCollection() }),
10211021
vpcZoneIdentifier: subnetIds,
10221022
healthCheckType: props.healthCheck && props.healthCheck.type,
10231023
healthCheckGracePeriod: props.healthCheck && props.healthCheck.gracePeriod && props.healthCheck.gracePeriod.toSeconds(),

packages/@aws-cdk/aws-autoscaling/lib/step-scaling-action.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export class StepScalingAction extends CoreConstruct {
7979
adjustmentType: props.adjustmentType,
8080
minAdjustmentMagnitude: props.minAdjustmentMagnitude,
8181
metricAggregationType: props.metricAggregationType,
82-
stepAdjustments: Lazy.anyValue({ produce: () => this.adjustments }),
82+
stepAdjustments: Lazy.any({ produce: () => this.adjustments }),
8383
});
8484

8585
this.scalingPolicyArn = resource.ref;

packages/@aws-cdk/aws-autoscaling/test/auto-scaling-group.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ nodeunitShim({
170170
instanceType: ec2.InstanceType.of(ec2.InstanceClass.M4, ec2.InstanceSize.MICRO),
171171
machineImage: new ec2.AmazonLinuxImage(),
172172
vpc,
173-
minCapacity: cdk.Lazy.numberValue({ produce: () => 5 }),
174-
maxCapacity: cdk.Lazy.numberValue({ produce: () => 1 }),
175-
desiredCapacity: cdk.Lazy.numberValue({ produce: () => 20 }),
173+
minCapacity: cdk.Lazy.number({ produce: () => 5 }),
174+
maxCapacity: cdk.Lazy.number({ produce: () => 1 }),
175+
desiredCapacity: cdk.Lazy.number({ produce: () => 20 }),
176176
});
177177

178178
// THEN: no exception

packages/@aws-cdk/aws-backup/lib/plan.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export class BackupPlan extends Resource implements IBackupPlan {
125125
const plan = new CfnBackupPlan(this, 'Resource', {
126126
backupPlan: {
127127
backupPlanName: props.backupPlanName || id,
128-
backupPlanRule: Lazy.anyValue({ produce: () => this.rules }, { omitEmptyArray: true }),
128+
backupPlanRule: Lazy.any({ produce: () => this.rules }, { omitEmptyArray: true }),
129129
},
130130
});
131131

packages/@aws-cdk/aws-backup/lib/selection.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ export class BackupSelection extends Resource implements iam.IGrantable {
9696
backupSelection: {
9797
iamRoleArn: role.roleArn,
9898
selectionName: props.backupSelectionName || this.node.id,
99-
listOfTags: Lazy.anyValue({
99+
listOfTags: Lazy.any({
100100
produce: () => this.listOfTags,
101101
}, { omitEmptyArray: true }),
102-
resources: Lazy.listValue({
102+
resources: Lazy.list({
103103
produce: () => [...this.resources, ...this.backupableResourcesCollector.resources],
104104
}, { omitEmpty: true }),
105105
},
@@ -130,7 +130,7 @@ export class BackupSelection extends Resource implements iam.IGrantable {
130130
Aspects.of(resource.construct).add(this.backupableResourcesCollector);
131131
// Cannot push `this.backupableResourcesCollector.resources` to
132132
// `this.resources` here because it has not been evaluated yet.
133-
// Will be concatenated to `this.resources` in a `Lazy.listValue`
133+
// Will be concatenated to `this.resources` in a `Lazy.list`
134134
// in the constructor instead.
135135
}
136136
}

packages/@aws-cdk/aws-certificatemanager/lib/dns-validated-certificate.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export class DnsValidatedCertificate extends cdk.Resource implements ICertificat
9898
serviceToken: requestorFunction.functionArn,
9999
properties: {
100100
DomainName: props.domainName,
101-
SubjectAlternativeNames: cdk.Lazy.listValue({ produce: () => props.subjectAlternativeNames }, { omitEmpty: true }),
101+
SubjectAlternativeNames: cdk.Lazy.list({ produce: () => props.subjectAlternativeNames }, { omitEmpty: true }),
102102
HostedZoneId: this.hostedZoneId,
103103
Region: props.region,
104104
Route53Endpoint: props.route53Endpoint,

packages/@aws-cdk/aws-certificatemanager/test/certificate.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ test('needs validation domain supplied if domain contains a token', () => {
6666
const stack = new Stack();
6767

6868
expect(() => {
69-
const domainName = Lazy.stringValue({ produce: () => 'example.com' });
69+
const domainName = Lazy.string({ produce: () => 'example.com' });
7070
new Certificate(stack, 'Certificate', {
7171
domainName,
7272
});
@@ -76,7 +76,7 @@ test('needs validation domain supplied if domain contains a token', () => {
7676
test('validationdomains can be given for a Token', () => {
7777
const stack = new Stack();
7878

79-
const domainName = Lazy.stringValue({ produce: () => 'my.example.com' });
79+
const domainName = Lazy.string({ produce: () => 'my.example.com' });
8080
new Certificate(stack, 'Certificate', {
8181
domainName,
8282
validationDomains: {

packages/@aws-cdk/aws-cloudformation/lib/custom-resource.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export class CustomResource extends core.CustomResource {
157157
properties: props.properties,
158158
removalPolicy: props.removalPolicy,
159159
resourceType: props.resourceType,
160-
serviceToken: core.Lazy.stringValue({ produce: () => props.provider.bind(this).serviceToken }),
160+
serviceToken: core.Lazy.string({ produce: () => props.provider.bind(this).serviceToken }),
161161
});
162162
}
163163
}

packages/@aws-cdk/aws-cloudfront/lib/distribution.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,11 @@ export class Distribution extends Resource implements IDistribution {
277277
const distribution = new CfnDistribution(this, 'Resource', {
278278
distributionConfig: {
279279
enabled: props.enabled ?? true,
280-
origins: Lazy.anyValue({ produce: () => this.renderOrigins() }),
281-
originGroups: Lazy.anyValue({ produce: () => this.renderOriginGroups() }),
280+
origins: Lazy.any({ produce: () => this.renderOrigins() }),
281+
originGroups: Lazy.any({ produce: () => this.renderOriginGroups() }),
282282
defaultCacheBehavior: this.defaultBehavior._renderBehavior(),
283283
aliases: props.domainNames,
284-
cacheBehaviors: Lazy.anyValue({ produce: () => this.renderCacheBehaviors() }),
284+
cacheBehaviors: Lazy.any({ produce: () => this.renderCacheBehaviors() }),
285285
comment: props.comment,
286286
customErrorResponses: this.renderErrorResponses(),
287287
defaultRootObject: props.defaultRootObject,

packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,9 @@ export class Alarm extends AlarmBase {
179179

180180
// Actions
181181
actionsEnabled: props.actionsEnabled,
182-
alarmActions: Lazy.listValue({ produce: () => this.alarmActionArns }),
183-
insufficientDataActions: Lazy.listValue({ produce: (() => this.insufficientDataActionArns) }),
184-
okActions: Lazy.listValue({ produce: () => this.okActionArns }),
182+
alarmActions: Lazy.list({ produce: () => this.alarmActionArns }),
183+
insufficientDataActions: Lazy.list({ produce: (() => this.insufficientDataActionArns) }),
184+
okActions: Lazy.list({ produce: () => this.okActionArns }),
185185

186186
// Metric
187187
...metricProps,

0 commit comments

Comments
 (0)