Type alias Output<T>

Output<T>: OutputInstance<T> & Lifted<T>

[Output] helps encode the relationship between Resources in a Pulumi application. Specifically an [Output] holds onto a piece of Data and the Resource it was generated from. An [Output] value can then be provided when constructing new Resources, allowing that new Resource to know both the value as well as the Resource the value came from. This allows for a precise 'Resource dependency graph' to be created, which properly tracks the relationship between resources.

An [Output] is used in a Pulumi program differently depending on if the application is executing at 'deployment time' (i.e. when actually running the 'pulumi' executable), or at 'run time' (i.e. a piece of code running in some Cloud).

At 'deployment time', the correct way to work with the underlying value is to call [Output.apply(func)]. This allows the value to be accessed and manipulated, while still resulting in an [Output] that is keeping track of [Resource]s appropriately. At deployment time the underlying value may or may not exist (for example, if a preview is being performed). In this case, the 'func' callback will not be executed, and calling [.apply] will immediately return an [Output] that points to the [undefined] value. During a normal [update] though, the 'func' callbacks should always be executed.

At 'run time', the correct way to work with the underlying value is to simply call [Output.get] which will be promptly return the entire value. This will be a simple JavaScript object that can be manipulated as necessary.

To ease with using [Output]s at 'deployment time', pulumi will 'lift' simple data properties of an underlying value to the [Output] itself. For example:

     const o: Output<{ name: string, age: number, orders: Order[] }> = ...;
const name : Output<string> = o.name;
const age : Output<number> = o.age;
const first: Output<Order> = o.orders[0];

Instead of having to write:

     const o: Output<{ name: string, age: number, orders: Order[] }> = ...;
const name : Output<string> = o.apply(v => v.name);
const age : Output<number> = o.apply(v => v.age);
const first: Output<Order> = o.apply(v => v.orders[0]);

Type Parameters

  • T

Generated using TypeDoc