Interface WorkspaceAlpha

Workspace is the execution context containing a single Pulumi project, a program, and multiple stacks. Workspaces are used to manage the execution environment, providing various utilities such as plugin installation, environment configuration ($PULUMI_HOME), and creation, deletion, and listing of Stacks.

interface Workspace {
    envVars: {
        [key: string]: string;
    };
    program?: PulumiFn;
    pulumiCommand: PulumiCommand;
    pulumiHome?: string;
    pulumiVersion: string;
    secretsProvider?: string;
    workDir: string;
    addEnvironments(stackName, ...environments): Promise<void>;
    createStack(stackName): Promise<void>;
    exportStack(stackName): Promise<Deployment>;
    getAllConfig(stackName): Promise<ConfigMap>;
    getConfig(stackName, key, path?): Promise<ConfigValue>;
    getTag(stackName, key): Promise<string>;
    importStack(stackName, state): Promise<void>;
    installPlugin(name, version, kind?): Promise<void>;
    installPluginFromServer(name, version, server): Promise<void>;
    listEnvironments(stackName): Promise<string[]>;
    listPlugins(): Promise<PluginInfo[]>;
    listStacks(): Promise<StackSummary[]>;
    listTags(stackName): Promise<TagMap>;
    postCommandCallback(stackName): Promise<void>;
    projectSettings(): Promise<ProjectSettings>;
    refreshConfig(stackName): Promise<ConfigMap>;
    removeAllConfig(stackName, keys, path?): Promise<void>;
    removeConfig(stackName, key, path?): Promise<void>;
    removeEnvironment(stackName, environment): Promise<void>;
    removePlugin(name?, versionRange?, kind?): Promise<void>;
    removeStack(stackName): Promise<void>;
    removeTag(stackName, key): Promise<void>;
    saveProjectSettings(settings): Promise<void>;
    saveStackSettings(stackName, settings): Promise<void>;
    selectStack(stackName): Promise<void>;
    serializeArgsForOp(stackName): Promise<string[]>;
    setAllConfig(stackName, config, path?): Promise<void>;
    setConfig(stackName, key, value, path?): Promise<void>;
    setTag(stackName, key, value): Promise<void>;
    stack(): Promise<undefined | StackSummary>;
    stackOutputs(stackName): Promise<OutputMap>;
    stackSettings(stackName): Promise<StackSettings>;
    whoAmI(): Promise<WhoAmIResult>;
}

Implemented by

Properties

envVars: {
    [key: string]: string;
}

Environment values scoped to the current workspace. These will be supplied to every Pulumi command.

Type declaration

  • [key: string]: string
program?: PulumiFn

The inline program PulumiFn to be used for Preview/Update operations if any. If none is specified, the stack will refer to ProjectSettings for this information.

pulumiCommand: PulumiCommand

The underlying Pulumi CLI.

pulumiHome?: string

The directory override for CLI metadata if set. This customizes the location of $PULUMI_HOME where metadata is stored and plugins are installed.

pulumiVersion: string

The version of the underlying Pulumi CLI/Engine.

secretsProvider?: string

The secrets provider to use for encryption and decryption of stack secrets. See: https://www.pulumi.com/docs/intro/concepts/secrets/#available-encryption-providers

workDir: string

The working directory to run Pulumi CLI commands

Methods

  • Adds environments to the end of a stack's import list. Imported environments are merged in order per the ESC merge rules. The list of environments behaves as if it were the import list in an anonymous environment.

    Parameters

    • stackName: string

      The stack to operate on

    • Rest ...environments: string[]

      The names of the environments to add to the stack's configuration

    Returns Promise<void>

  • Creates and sets a new stack with the stack name, failing if one already exists.

    Parameters

    • stackName: string

      The stack to create.

    Returns Promise<void>

  • exportStack exports the deployment state of the stack. This can be combined with Workspace.importStack to edit a stack's state (such as recovery from failed deployments).

    Parameters

    • stackName: string

      the name of the stack.

    Returns Promise<Deployment>

  • Returns the value associated with the specified stack name and key, scoped to the Workspace.

    Parameters

    • stackName: string

      The stack to read config from

    • key: string

      The key to use for the config lookup

    • Optional path: boolean

      The key contains a path to a property in a map or list to get

    Returns Promise<ConfigValue>

  • Returns the value associated with the specified stack name and key, scoped to the Workspace.

    Parameters

    • stackName: string

      The stack to read tag metadata from.

    • key: string

      The key to use for the tag lookup.

    Returns Promise<string>

  • importStack imports the specified deployment state into a pre-existing stack. This can be combined with Workspace.exportStack to edit a stack's state (such as recovery from failed deployments).

    Parameters

    • stackName: string

      the name of the stack.

    • state: Deployment

      the stack state to import.

    Returns Promise<void>

  • Installs a plugin in the Workspace from a remote server, for example a third party plugin.

    Parameters

    • name: string

      the name of the plugin.

    • version: string

      the version of the plugin e.g. "v1.0.0".

    • Optional kind: string

      the kind of plugin e.g. "resource"

    Returns Promise<void>

  • Installs a plugin in the Workspace, for example to use cloud providers like AWS or GCP.

    Parameters

    • name: string

      the name of the plugin.

    • version: string

      the version of the plugin e.g. "v1.0.0".

    • server: string

      the server to install the plugin into

    Returns Promise<void>

  • Returns the list of environments associated with the specified stack name.

    Parameters

    • stackName: string

      The stack to operate on

    Returns Promise<string[]>

  • postCommandCallback is a hook executed after every command. Called with the stack name. An extensibility point to perform workspace cleanup (CLI operations may create/modify a Pulumi.stack.yaml) LocalWorkspace does not utilize this extensibility point.

    Parameters

    • stackName: string

    Returns Promise<void>

  • Removes all values in the provided key list for the specified stack name.

    Parameters

    • stackName: string

      The stack to operate on

    • keys: string[]

      The list of keys to remove from the underlying config

    • Optional path: boolean

      The keys contain a path to a property in a map or list to remove

    Returns Promise<void>

  • Removes the specified key-value pair on the provided stack name.

    Parameters

    • stackName: string

      The stack to operate on

    • key: string

      The config key to remove

    • Optional path: boolean

      The key contains a path to a property in a map or list to remove

    Returns Promise<void>

  • Removes an environment from a stack's import list.

    Parameters

    • stackName: string

      The stack to operate on

    • environment: string

      The name of the environment to remove from the stack's configuration

    Returns Promise<void>

  • Removes a plugin from the Workspace matching the specified name and version.

    Parameters

    • Optional name: string

      the optional name of the plugin.

    • Optional versionRange: string

      optional semver range to check when removing plugins matching the given name e.g. "1.0.0", ">1.0.0".

    • Optional kind: string

      he kind of plugin e.g. "resource"

    Returns Promise<void>

  • Deletes the stack and all associated configuration and history.

    Parameters

    • stackName: string

      The stack to remove

    Returns Promise<void>

  • Removes the specified key-value pair on the provided stack name.

    Parameters

    • stackName: string

      The stack to operate on.

    • key: string

      The tag key to remove.

    Returns Promise<void>

  • Overwrites the settings object in the current project. There can only be a single project per workspace. Fails is new project name does not match old.

    Parameters

    Returns Promise<void>

  • overwrites the settings object for the stack matching the specified stack name.

    Parameters

    • stackName: string

      The name of the stack to operate on.

    • settings: StackSettings

      The settings object to save.

    Returns Promise<void>

  • Selects and sets an existing stack matching the stack name, failing if none exists.

    Parameters

    • stackName: string

      The stack to select.

    Returns Promise<void>

  • serializeArgsForOp is hook to provide additional args to every CLI commands before they are executed. Provided with stack name, returns a list of args to append to an invoked command ["--config=...", ] LocalWorkspace does not utilize this extensibility point.

    Parameters

    • stackName: string

    Returns Promise<string[]>

  • Sets all values in the provided config map for the specified stack name.

    Parameters

    • stackName: string

      The stack to operate on

    • config: ConfigMap

      The ConfigMap to upsert against the existing config

    • Optional path: boolean

      The keys contain a path to a property in a map or list to set

    Returns Promise<void>

  • Sets the specified key-value pair on the provided stack name.

    Parameters

    • stackName: string

      The stack to operate on

    • key: string

      The config key to set

    • value: ConfigValue

      The value to set

    • Optional path: boolean

      The key contains a path to a property in a map or list to set

    Returns Promise<void>

  • Sets the specified key-value pair on the provided stack name.

    Parameters

    • stackName: string

      The stack to operate on.

    • key: string

      The tag key to set.

    • value: string

      The tag value to set.

    Returns Promise<void>

Generated using TypeDoc