# Lazy

Lazily produce a value.

Can be used to return a string, list or numeric value whose actual value
will only be calculated later, during synthesis.

- Source: [`core/lib/lazy.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/core/lib/lazy.ts#L142)

## Methods

- `any(producer: IStableAnyProducer, options?: LazyAnyValueOptions): IResolvable` (static) — Defer the one-time calculation of an arbitrarily typed value to synthesis time.

  Use this if you want to render an object to a template whose actual value depends on
  some state mutation that may happen after the construct has been created.

  The inner function will only be invoked one time and cannot depend on
  resolution context.

- `list(producer: IStableListProducer, options?: LazyListValueOptions): string[]` (static) — Defer the one-time calculation of a list value to synthesis time.

  Use this if you want to render a list to a template whose actual value depends on
  some state mutation that may happen after the construct has been created.

  If you are simply looking to force a value to a `string[]` type and don't need
  the calculation to be deferred, use `Token.asList()` instead.

  The inner function will only be invoked once, and the resolved value
  cannot depend on the Stack the Token is used in.

- `number(producer: IStableNumberProducer): number` (static) — Defer the one-time calculation of a number value to synthesis time.

  Use this if you want to render a number to a template whose actual value depends on
  some state mutation that may happen after the construct has been created.

  If you are simply looking to force a value to a `number` type and don't need
  the calculation to be deferred, use `Token.asNumber()` instead.

  The inner function will only be invoked once, and the resolved value
  cannot depend on the Stack the Token is used in.

- `string(producer: IStableStringProducer, options?: LazyStringValueOptions): string` (static) — Defer the one-time calculation of a string value to synthesis time.

  Use this if you want to render a string to a template whose actual value depends on
  some state mutation that may happen after the construct has been created.

  If you are simply looking to force a value to a `string` type and don't need
  the calculation to be deferred, use `Token.asString()` instead.

  The inner function will only be invoked once, and the resolved value
  cannot depend on the Stack the Token is used in.

- `uncachedAny(producer: IAnyProducer, options?: LazyAnyValueOptions): IResolvable` (static) — Defer the calculation of an untyped value to synthesis time.

  Use of this function is not recommended; unless you know you need it for sure, you
  probably don't. Use `Lazy.any()` instead.

  The inner function may be invoked multiple times during synthesis. You
  should only use this method if the returned value depends on variables
  that may change during the Aspect application phase of synthesis, or if
  the value depends on the Stack the value is being used in. Both of these
  cases are rare, and only ever occur for AWS Construct Library authors.

- `uncachedList(producer: IListProducer, options?: LazyListValueOptions): string[]` (static) — Defer the calculation of a list value to synthesis time.

  Use of this function is not recommended; unless you know you need it for sure, you
  probably don't. Use `Lazy.list()` instead.

  The inner function may be invoked multiple times during synthesis. You
  should only use this method if the returned value depends on variables
  that may change during the Aspect application phase of synthesis, or if
  the value depends on the Stack the value is being used in. Both of these
  cases are rare, and only ever occur for AWS Construct Library authors.

- `uncachedNumber(producer: INumberProducer): number` (static) — Defer the calculation of a number value to synthesis time.

  Use of this function is not recommended; unless you know you need it for sure, you
  probably don't. Use `Lazy.number()` instead.

  The inner function may be invoked multiple times during synthesis. You
  should only use this method if the returned value depends on variables
  that may change during the Aspect application phase of synthesis, or if
  the value depends on the Stack the value is being used in. Both of these
  cases are rare, and only ever occur for AWS Construct Library authors.

- `uncachedString(producer: IStringProducer, options?: LazyStringValueOptions): string` (static) — Defer the calculation of a string value to synthesis time.

  Use of this function is not recommended; unless you know you need it for sure, you
  probably don't. Use `Lazy.string()` instead.

  The inner function may be invoked multiple times during synthesis. You
  should only use this method if the returned value depends on variables
  that may change during the Aspect application phase of synthesis, or if
  the value depends on the Stack the value is being used in. Both of these
  cases are rare, and only ever occur for AWS Construct Library authors.
