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. This allows the value to be accessed and manipulated, while still resulting in an output that is keeping track of Resources 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 outputs 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