Fork me on GitHub

Package @pulumi/pulumi

Node.js:

var pulumi = require("@pulumi/pulumi");

ES6 modules:

import * as pulumi from "@pulumi/pulumi";

Index

config.ts errors.ts index.ts metadata.ts resource.ts version.ts

Modules

class ComponentResource

ComponentResource is a resource that aggregates one or more other child resources into a higher level abstraction. The component resource itself is a resource, but does not require custom CRUD operations for provisioning.

constructor

new ComponentResource(t: string, name: string, props?: Inputs, opts: ComponentResourceOptions)

Creates and registers a new component resource. t is the fully qualified type token and name is the “name” part to use in creating a stable and globally unique URN for the object. parent is the optional parent for this component, and dependsOn is an optional list of other resources that this resource depends on, controlling the order in which we perform resource operations.

  • t The type of the resource.
  • name The unique name of the resource.
  • props The arguments to use to populate the new resource.
  • opts A bag of options that control this resource's behavior.

method getProvider

public getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

public static isInstance(obj: any): boolean

method registerOutputs

protected registerOutputs(outputs: Inputs | Promise<Inputs> | Output<Inputs> | undefined): void

property urn

public urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

class Config

Config is a bag of related configuration state. Each bag contains any number of configuration variables, indexed by simple keys, and each has a name that uniquely identifies it; two bags with different names do not share values for variables that otherwise share the same key. For example, a bag whose name is pulumi:foo, with keys a, b, and c, is entirely separate from a bag whose name is pulumi:bar with the same simple key names. Each key has a fully qualified names, such as pulumi:foo:a, …, and pulumi:bar:a, respectively.

constructor

new Config(name?: undefined | string)

method get

public get(key: string, opts?: StringConfigOptions): string | undefined

get loads an optional configuration value by its key, or undefined if it doesn’t exist.

method getBoolean

public getBoolean(key: string): boolean | undefined

getBoolean loads an optional configuration value, as a boolean, by its key, or undefined if it doesn’t exist. If the configuration value isn’t a legal boolean, this function will throw an error.

method getNumber

public getNumber(key: string, opts?: NumberConfigOptions): number | undefined

getNumber loads an optional configuration value, as a number, by its key, or undefined if it doesn’t exist. If the configuration value isn’t a legal number, this function will throw an error.

method getObject

public getObject<T>(key: string): T | undefined

getObject loads an optional configuration value, as an object, by its key, or undefined if it doesn’t exist. This routine simply JSON parses and doesn’t validate the shape of the contents.

method require

public require(key: string, opts?: StringConfigOptions): string

require loads a configuration value by its given key. If it doesn’t exist, an error is thrown.

method requireBoolean

public requireBoolean(key: string): boolean

requireBoolean loads a configuration value, as a boolean, by its given key. If it doesn’t exist, or the configuration value is not a legal boolean, an error is thrown.

method requireNumber

public requireNumber(key: string, opts?: NumberConfigOptions): number

requireNumber loads a configuration value, as a number, by its given key. If it doesn’t exist, or the configuration value is not a legal number, an error is thrown.

method requireObject

public requireObject<T>(key: string): T

requireObject loads a configuration value as a JSON string and deserializes the JSON into a JavaScript object. If it doesn’t exist, or the configuration value is not a legal JSON string, an error is thrown.

property name

public name: string;

name is the configuration bag’s logical name and uniquely identifies it. The default is the name of the current project.

class CustomResource

CustomResource is a resource whose create, read, update, and delete (CRUD) operations are managed by performing external operations on some physical entity. The engine understands how to diff and perform partial updates of them, and these CRUD operations are implemented in a dynamically loaded plugin for the defining package.

constructor

new CustomResource(t: string, name: string, props?: Inputs, opts?: CustomResourceOptions)

Creates and registers a new managed resource. t is the fully qualified type token and name is the “name” part to use in creating a stable and globally unique URN for the object. dependsOn is an optional list of other resources that this resource depends on, controlling the order in which we perform resource operations. Creating an instance does not necessarily perform a create on the physical entity which it represents, and instead, this is dependent upon the diffing of the new goal state compared to the current known resource state.

  • t The type of the resource.
  • name The unique name of the resource.
  • props The arguments to use to populate the new resource.
  • opts A bag of options that control this resource's behavior.

method getProvider

public getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

public static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

property id

public id: Output<ID>;

id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.

property urn

public urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

class Output

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.

constructor

public new Output(resources: Set<Resource>, promise: Promise<T>, isKnown: Promise<boolean>)

method create

public static create<T>(resource: Resource, promise: Promise<T>, isKnown: Promise<boolean>): Output<T>

method isInstance

public static isInstance<T>(obj: any): boolean

Returns true if the given object is an instance of Output. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

property __pulumiOutput

public __pulumiOutput?: undefined | false | true = true;

A private field to help with RTTI that works in SxS scenarios.

This is internal instead of being truly private, to support mixins and our serialization model.

property apply

public apply: { ... };

Transforms the data of the output with the provided func. The result remains a Output so that dependent resources can be properly tracked.

‘func’ is not allowed to make resources.

‘func’ can return other Outputs. This can be handy if you have a Output and you want to get a transitive dependency of it. i.e.

var d1: Output<SomeVal>;
var d2 = d1.apply(v => v.x.y.OtherOutput); // getting an output off of 'v'.

In this example, taking a dependency on d2 means a resource will depend on all the resources of d1. It will not depend on the resources of v.x.y.OtherDep.

Importantly, the Resources that d2 feels like it will depend on are the same resources as d1. If you need have multiple Outputs and a single Output is needed that combines both set of resources, then ‘pulumi.all’ should be used instead.

This function will only be called execution of a ‘pulumi update’ request. It will not run during ‘pulumi preview’ (as the values of resources are of course not known then). It is not available for functions that end up executing in the cloud during runtime. To get the value of the Output during cloud runtime execution, use get().

property get

public get: { ... };

Retrieves the underlying value of this dependency.

This function is only callable in code that runs in the cloud post-deployment. At this point all Output values will be known and can be safely retrieved. During pulumi deployment or preview execution this must not be called (and will throw). This is because doing so would allow Output values to flow into Resources while losing the data that would allow the dependency graph to be changed.

property isKnown

public isKnown: Promise<boolean>;

Whether or not this ‘Output’ should actually perform .apply calls. During a preview, an Output value may not be known (because it would have to actually be computed by doing an ‘update’). In that case, we don’t want to perform any .apply calls as the callbacks may not expect an undefined value. So, instead, we just transition to another Output value that itself knows it should not perform .apply calls.

property promise

public promise: { ... };

Method that actually produces the concrete value of this output, as well as the total deployment-time set of resources this output depends on.

Only callable on the outside.

property resources

public resources: { ... };

The list of resource that this output value depends on.

Only callable on the outside.

class ProviderResource

ProviderResource is a resource that implements CRUD operations for other custom resources. These resources are managed similarly to other resources, including the usual diffing and update semantics.

constructor

new ProviderResource(pkg: string, name: string, props?: Inputs, opts: ResourceOptions)

Creates and registers a new provider resource for a particular package.

  • pkg The package associated with this provider.
  • name The unique name of the provider.
  • props The configuration to use for this provider.
  • opts A bag of options that control this provider's behavior.

method getProvider

public getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

public static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

property id

public id: Output<ID>;

id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.

property urn

public urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

class Resource

Resource represents a class whose CRUD operations are implemented by a provider plugin.

constructor

new Resource(t: string, name: string, custom: boolean, props: Inputs, opts: ResourceOptions)

Creates and registers a new resource object. t is the fully qualified type token and name is the “name” part to use in creating a stable and globally unique URN for the object. dependsOn is an optional list of other resources that this resource depends on, controlling the order in which we perform resource operations.

  • t The type of the resource.
  • name The unique name of the resource.
  • custom True to indicate that this is a custom resource, managed by a plugin.
  • props The arguments to use to populate the new resource.
  • opts A bag of options that control this resource's behavior.

method getProvider

public getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

public static isInstance(obj: any): boolean

property urn

public urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

class ResourceError

ResourceError can be used for terminating a program abruptly, specifically associating the problem with a Resource. Depending on the nature of the problem, clients can choose whether or not a call stack should be returned as well. This should be very rare, and would only indicate no usefulness of presenting that stack to the user.

constructor

new ResourceError(message: string, resource: Resource | undefined, hideStack?: undefined | false | true)

method isInstance

public static isInstance(obj: any): boolean

Returns true if the given object is an instance of a ResourceError. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

property Error

static Error: ErrorConstructor;

property hideStack

public hideStack?: undefined | false | true;

property message

message: string;

property name

name: string;

property resource

public resource: Resource | undefined;

property stack

stack?: undefined | string;

class RunError

RunError can be used for terminating a program abruptly, but resulting in a clean exit rather than the usual verbose unhandled error logic which emits the source program text and complete stack trace. This type should be rarely used. Ideally ResourceError should always be used so that as many errors as possible can be associated with a Resource.

constructor

new RunError(message: string)

method isInstance

public static isInstance(obj: any): boolean

Returns true if the given object is an instance of a RunError. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

property Error

static Error: ErrorConstructor;

property message

message: string;

property name

name: string;

property stack

stack?: undefined | string;

const deploymentOnlyModule

const deploymentOnlyModule: true = true;

const testingOptions

let isDryRun

let isDryRun: boolean = false;

const version

const version: ${VERSION} = "${VERSION}";

function all

all<T>(val: Record<string, Input<T>>): Output<Record<string, Unwrap<T>>>

Allows for multiple Output objects to be combined into a single Output object. The single Output will depend on the union of Resources that the individual dependencies depend on.

This can be used in the following manner:

var d1: Output<string>;
var d2: Output<number>;

var d3: Output<ResultType> = Output.all([d1, d2]).apply(([s, n]) => ...);

In this example, taking a dependency on d3 means a resource will depend on all the resources of d1 and d2.

all<T1,T2,T3,T4,T5,T6,T7,T8>(values: [, Input<T1> | undefined, Input<T2> | undefined, Input<T3> | undefined, Input<T4> | undefined, Input<T5> | undefined, Input<T6> | undefined, Input<T7> | undefined, Input<T8> | undefined]): Output<[, Unwrap<T1>, Unwrap<T2>, Unwrap<T3>, Unwrap<T4>, Unwrap<T5>, Unwrap<T6>, Unwrap<T7>, Unwrap<T8>]>
all<T1,T2,T3,T4,T5,T6,T7>(values: [, Input<T1> | undefined, Input<T2> | undefined, Input<T3> | undefined, Input<T4> | undefined, Input<T5> | undefined, Input<T6> | undefined, Input<T7> | undefined]): Output<[, Unwrap<T1>, Unwrap<T2>, Unwrap<T3>, Unwrap<T4>, Unwrap<T5>, Unwrap<T6>, Unwrap<T7>]>
all<T1,T2,T3,T4,T5,T6>(values: [, Input<T1> | undefined, Input<T2> | undefined, Input<T3> | undefined, Input<T4> | undefined, Input<T5> | undefined, Input<T6> | undefined]): Output<[, Unwrap<T1>, Unwrap<T2>, Unwrap<T3>, Unwrap<T4>, Unwrap<T5>, Unwrap<T6>]>
all<T1,T2,T3,T4,T5>(values: [, Input<T1> | undefined, Input<T2> | undefined, Input<T3> | undefined, Input<T4> | undefined, Input<T5> | undefined]): Output<[, Unwrap<T1>, Unwrap<T2>, Unwrap<T3>, Unwrap<T4>, Unwrap<T5>]>
all<T1,T2,T3,T4>(values: [, Input<T1> | undefined, Input<T2> | undefined, Input<T3> | undefined, Input<T4> | undefined]): Output<[, Unwrap<T1>, Unwrap<T2>, Unwrap<T3>, Unwrap<T4>]>
all<T1,T2,T3>(values: [, Input<T1> | undefined, Input<T2> | undefined, Input<T3> | undefined]): Output<[, Unwrap<T1>, Unwrap<T2>, Unwrap<T3>]>
all<T1,T2>(values: [, Input<T1> | undefined, Input<T2> | undefined]): Output<[, Unwrap<T1>, Unwrap<T2>]>
all<T>(ds: undefined | T | Promise<T> | Output<T>[]): Output<Unwrap<T>[]>

function getProject

getProject(): string

getProject returns the current project name. It throws an exception if none is registered.

function getStack

getStack(): string

getStack returns the current stack name. It throws an exception if none is registered.

function output

output<T>(val: Input<T>): Output<Unwrap<T>>

[output] takes any Input value and converts it into an Output, deeply unwrapping nested Input values as necessary”.

The expected way to use this function is like so:

     var transformed = pulumi.output(someVal).apply(unwrapped => {
         // Do whatever you want now.  'unwrapped' will contain no outputs/promises inside
         // here, so you can easily do whatever sort of transformation is most convenient.
     });

     // the result can be passed to another Resource.  The dependency information will be
     // properly maintained.
     var someResource = new SomeResource(name, { data: transformed ... });
output<T>(val: Input<T> | undefined): Output<Unwrap<T | undefined>>

interface ComponentResourceOptions

ComponentResourceOptions is a bag of optional settings that control a component resource’s behavior.

property dependsOn

dependsOn?: Resource[] | Resource;

An optional additional explicit dependencies on other resources.

property id

id?: Input<ID>;

An optional existing ID to load, rather than create.

property parent

parent?: Resource;

An optional parent resource to which this resource belongs.

property protect

protect?: undefined | false | true;

When set to true, protect ensures this resource cannot be deleted.

property providers

providers?: Record<string, ProviderResource>;

An optional set of providers to use for child resources. Keyed by package name (e.g. “aws”)

interface CustomResourceOptions

CustomResourceOptions is a bag of optional settings that control a custom resource’s behavior.

property dependsOn

dependsOn?: Resource[] | Resource;

An optional additional explicit dependencies on other resources.

property id

id?: Input<ID>;

An optional existing ID to load, rather than create.

property parent

parent?: Resource;

An optional parent resource to which this resource belongs.

property protect

protect?: undefined | false | true;

When set to true, protect ensures this resource cannot be deleted.

property provider

provider?: ProviderResource;

An optional provider to use for this resource’s CRUD operations. If no provider is supplied, the default provider for the resource’s package will be used. The default provider is pulled from the parent’s provider bag (see also ComponentResourceOptions.providers).

interface ResourceOptions

ResourceOptions is a bag of optional settings that control a resource’s behavior.

property dependsOn

dependsOn?: Resource[] | Resource;

An optional additional explicit dependencies on other resources.

property id

id?: Input<ID>;

An optional existing ID to load, rather than create.

property parent

parent?: Resource;

An optional parent resource to which this resource belongs.

property protect

protect?: undefined | false | true;

When set to true, protect ensures this resource cannot be deleted.

type ID

type ID = string;

type Input

type Input = T | Promise<T> | Output<T>;

Input is a property input for a resource. It may be a promptly available T, a promise for one, or the output from a existing Resource.

type Inputs

type Inputs = Record<string, Input<any>>;

Inputs is a map of property name to property input, one for each resource property value.

type URN

type URN = string;