Class LocalWorkspaceAlpha

LocalWorkspace is a default implementation of the Workspace interface. A 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. LocalWorkspace relies on Pulumi.yaml and Pulumi..yaml as the intermediate format for Project and Stack settings. Modifying ProjectSettings will alter the Workspace Pulumi.yaml file, and setting config on a Stack will modify the Pulumi..yaml file. This is identical to the behavior of Pulumi CLI driven workspaces.

Implements

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.

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.

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

Accessors

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>

  • Returns the value associated with the specified stack name and key, scoped to the current workspace. LocalWorkspace reads this config from the matching Pulumi.stack.yaml file.

    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 LocalWorkspace.

    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, 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".

    • kind: string = "resource"

      the kind of plugin, defaults to "resource"

    Returns Promise<void>

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

    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 from

    Returns Promise<void>

  • 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

    • _: string

    Returns Promise<void>

  • Removes all values in the provided key list for the specified stack name It will remove any matching values in the Pulumi..yaml file in Workspace.WorkDir().

    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. It will remove any matching values in the Pulumi..yaml file in Workspace.WorkDir().

    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 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".

    • kind: string = "resource"

      he kind of plugin, defaults to "resource".

    Returns Promise<void>

  • Overwrites the settings object in the current project. There can only be a single project per workspace. Fails if new project name does not match old. LocalWorkspace writes this value to a Pulumi.yaml file in Workspace.WorkDir().

    Parameters

    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

    • _: string

    Returns Promise<string[]>

  • Sets all values in the provided config map for the specified stack name. LocalWorkspace writes the config to the matching Pulumi..yaml file in Workspace.WorkDir().

    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. LocalWorkspace writes this value to the matching Pulumi..yaml file in Workspace.WorkDir().

    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>

  • Creates or selects an existing Stack with a LocalWorkspace utilizing the specified inline (in process) Pulumi CLI program. This program is fully debuggable and runs in process. If no Project option is specified, default project settings will be created on behalf of the user. Similarly, unless a workDir option is specified, the working directory will default to a new temporary directory provided by the OS.

    Parameters

    • args: LocalProgramArgs

      A set of arguments to initialize a Stack with a pre-configured Pulumi CLI program that already exists on disk.

    • Optional opts: LocalWorkspaceOptions

      Additional customizations to be applied to the Workspace.

    Returns Promise<automation.Stack>

  • Creates or selects an existing Stack with a LocalWorkspace utilizing the specified inline Pulumi CLI program. This program is fully debuggable and runs in process. If no Project option is specified, default project settings will be created on behalf of the user. Similarly, unless a workDir option is specified, the working directory will default to a new temporary directory provided by the OS.

    Parameters

    • args: InlineProgramArgs

      A set of arguments to initialize a Stack with and inline PulumiFn program that runs in process.

    • Optional opts: LocalWorkspaceOptions

      Additional customizations to be applied to the Workspace.

    Returns Promise<automation.Stack>

  • Creates a Stack with a LocalWorkspace utilizing the local Pulumi CLI program from the specified workDir. This is a way to create drivers on top of pre-existing Pulumi programs. This Workspace will pick up any available Settings files (Pulumi.yaml, Pulumi..yaml).

    Parameters

    • args: LocalProgramArgs

      A set of arguments to initialize a Stack with a pre-configured Pulumi CLI program that already exists on disk.

    • Optional opts: LocalWorkspaceOptions

      Additional customizations to be applied to the Workspace.

    Returns Promise<automation.Stack>

  • Creates a Stack with a LocalWorkspace utilizing the specified inline (in process) Pulumi program. This program is fully debuggable and runs in process. If no Project option is specified, default project settings will be created on behalf of the user. Similarly, unless a workDir option is specified, the working directory will default to a new temporary directory provided by the OS.

    Parameters

    • args: InlineProgramArgs

      A set of arguments to initialize a Stack with and inline PulumiFn program that runs in process.

    • Optional opts: LocalWorkspaceOptions

      Additional customizations to be applied to the Workspace.

    Returns Promise<automation.Stack>

  • Selects a Stack with a LocalWorkspace utilizing the local Pulumi CLI program from the specified workDir. This is a way to create drivers on top of pre-existing Pulumi programs. This Workspace will pick up any available Settings files (Pulumi.yaml, Pulumi..yaml).

    Parameters

    • args: LocalProgramArgs

      A set of arguments to initialize a Stack with a pre-configured Pulumi CLI program that already exists on disk.

    • Optional opts: LocalWorkspaceOptions

      Additional customizations to be applied to the Workspace.

    Returns Promise<automation.Stack>

  • Selects an existing Stack with a LocalWorkspace utilizing the specified inline (in process) Pulumi program. This program is fully debuggable and runs in process. If no Project option is specified, default project settings will be created on behalf of the user. Similarly, unless a workDir option is specified, the working directory will default to a new temporary directory provided by the OS.

    Parameters

    • args: InlineProgramArgs

      A set of arguments to initialize a Stack with and inline PulumiFn program that runs in process.

    • Optional opts: LocalWorkspaceOptions

      Additional customizations to be applied to the Workspace.

    Returns Promise<automation.Stack>

Generated using TypeDoc