@pulumi/pulumi - v3.253.0
    Preparing search index...

    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: string,
            ...environments: string[],
        ): Promise<void>;
        createStack(stackName: string): Promise<void>;
        exportStack(stackName: string): Promise<Deployment>;
        getAllConfig(stackName: string): Promise<ConfigMap>;
        getConfig(
            stackName: string,
            key: string,
            path?: boolean,
        ): Promise<ConfigValue>;
        getTag(stackName: string, key: string): Promise<string>;
        importStack(stackName: string, state: Deployment): Promise<void>;
        installPlugin(name: string, version: string, kind?: string): Promise<void>;
        installPluginFromServer(
            name: string,
            version: string,
            server: string,
        ): Promise<void>;
        listEnvironments(stackName: string): Promise<string[]>;
        listPlugins(): Promise<PluginInfo[]>;
        listStacks(opts?: ListOptions): Promise<StackSummary[]>;
        listTags(stackName: string): Promise<TagMap>;
        postCommandCallback(stackName: string): Promise<void>;
        projectSettings(): Promise<ProjectSettings>;
        refreshConfig(stackName: string): Promise<ConfigMap>;
        removeAllConfig(
            stackName: string,
            keys: string[],
            path?: boolean,
        ): Promise<void>;
        removeConfig(stackName: string, key: string, path?: boolean): Promise<void>;
        removeEnvironment(stackName: string, environment: string): Promise<void>;
        removePlugin(
            name?: string,
            versionRange?: string,
            kind?: string,
        ): Promise<void>;
        removeStack(stackName: string, opts?: RemoveOptions): Promise<void>;
        removeTag(stackName: string, key: string): Promise<void>;
        saveProjectSettings(settings: ProjectSettings): Promise<void>;
        saveStackSettings(
            stackName: string,
            settings: StackSettings,
        ): Promise<void>;
        selectStack(stackName: string): Promise<void>;
        serializeArgsForOp(stackName: string): Promise<string[]>;
        setAllConfig(
            stackName: string,
            config: ConfigMap,
            path?: boolean,
        ): Promise<void>;
        setAllConfigJson(stackName: string, configJson: string): Promise<void>;
        setConfig(
            stackName: string,
            key: string,
            value: ConfigValue,
            path?: boolean,
        ): Promise<void>;
        setTag(stackName: string, key: string, value: string): Promise<void>;
        stack(): Promise<StackSummary | undefined>;
        stackOutputs(stackName: string): Promise<OutputMap>;
        stackSettings(stackName: string): Promise<StackSettings>;
        whoAmI(): Promise<WhoAmIResult>;
    }

    Implemented by

    Index

    Properties

    envVars: { [key: string]: string }

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

    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.

    workDir: string

    The working directory to run Pulumi CLI commands.

    Methods

    • Alpha

      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

      • ...environments: string[]

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

      Returns Promise<void>

    • Alpha

      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>

    • Alpha

      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

      • Optionalpath: boolean

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

      Returns Promise<ConfigValue>

    • Alpha

      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>

    • Alpha

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

      • Optionalkind: string

        The kind of plugin e.g. "resource"

      Returns Promise<void>

    • Alpha

      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>

    • Alpha

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

      Parameters

      • stackName: string

        The stack to operate on

      Returns Promise<string[]>

    • Alpha

      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)

      Parameters

      • stackName: string

      Returns Promise<void>

    • Alpha

      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

      • Optionalpath: boolean

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

      Returns Promise<void>

    • Alpha

      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

      • Optionalpath: boolean

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

      Returns Promise<void>

    • Alpha

      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>

    • Alpha

      Removes a plugin from the workspace matching the specified name and version.

      Parameters

      • Optionalname: string

        The optional name of the plugin.

      • OptionalversionRange: string

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

      • Optionalkind: string

        The kind of plugin e.g. "resource"

      Returns Promise<void>

    • Alpha

      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>

    • Alpha

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

      Parameters

      • stackName: string

        The stack to select.

      Returns Promise<void>

    • Alpha

      A hook to provide additional arguments to every CLI command before they are executed. Provided with the stack name, this should return a list of arguments to append to an invoked command (e.g. ["--config=...", ...]).

      Parameters

      • stackName: string

      Returns Promise<string[]>

    • Alpha

      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

      • Optionalpath: boolean

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

      Returns Promise<void>

    • Alpha

      Sets all config values from a JSON string for the specified stack name. The JSON string should be in the format produced by "pulumi config --json".

      Parameters

      • stackName: string

        The stack to operate on

      • configJson: string

        A JSON string containing the configuration values to set

      Returns Promise<void>

    • Alpha

      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

      • Optionalpath: boolean

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

      Returns Promise<void>

    • Alpha

      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>