command.local.Command

Explore with Pulumi AI

A local command to be executed. This command can be inserted into the life cycles of other resources using the dependsOn or parent resource options. A command is considered to have failed when it finished with a non-zero exit code. This will fail the CRUD step of the Command resource.

Create Command Resource

new Command(name: string, args?: CommandArgs, opts?: CustomResourceOptions);
@overload
def Command(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            archive_paths: Optional[Sequence[str]] = None,
            asset_paths: Optional[Sequence[str]] = None,
            create: Optional[str] = None,
            delete: Optional[str] = None,
            dir: Optional[str] = None,
            environment: Optional[Mapping[str, str]] = None,
            interpreter: Optional[Sequence[str]] = None,
            stdin: Optional[str] = None,
            triggers: Optional[Sequence[Any]] = None,
            update: Optional[str] = None)
@overload
def Command(resource_name: str,
            args: Optional[CommandArgs] = None,
            opts: Optional[ResourceOptions] = None)
func NewCommand(ctx *Context, name string, args *CommandArgs, opts ...ResourceOption) (*Command, error)
public Command(string name, CommandArgs? args = null, CustomResourceOptions? opts = null)
public Command(String name, CommandArgs args)
public Command(String name, CommandArgs args, CustomResourceOptions options)
type: command:local:Command
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args CommandArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args CommandArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args CommandArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args CommandArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args CommandArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Command Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Command resource accepts the following input properties:

ArchivePaths List<string>

A list of path globs to return as a single archive asset after the command completes.

When specifying glob patterns the following rules apply:

  • We only include files not directories for assets and archives.
  • Path separators are / on all platforms - including Windows.
  • Patterns starting with ! are 'exclude' rules.
  • Rules are evaluated in order, so exclude rules should be after inclusion rules.
  • * matches anything except /
  • ** matches anything, including /
  • All returned paths are relative to the working directory (without leading ./) e.g. file.text or subfolder/file.txt.
  • For full details of the globbing syntax, see github.com/gobwas/glob

Example

Given the rules:

- "assets/**"
- "src/**.js"
- "!**secret.*"

When evaluating against this folder:

- assets/
  - logos/
    - logo.svg
- src/
  - index.js
  - secret.js

The following paths will be returned:

- assets/logos/logo.svg
- src/index.js
AssetPaths List<string>

A list of path globs to read after the command completes.

When specifying glob patterns the following rules apply:

  • We only include files not directories for assets and archives.
  • Path separators are / on all platforms - including Windows.
  • Patterns starting with ! are 'exclude' rules.
  • Rules are evaluated in order, so exclude rules should be after inclusion rules.
  • * matches anything except /
  • ** matches anything, including /
  • All returned paths are relative to the working directory (without leading ./) e.g. file.text or subfolder/file.txt.
  • For full details of the globbing syntax, see github.com/gobwas/glob

Example

Given the rules:

- "assets/**"
- "src/**.js"
- "!**secret.*"

When evaluating against this folder:

- assets/
  - logos/
    - logo.svg
- src/
  - index.js
  - secret.js

The following paths will be returned:

- assets/logos/logo.svg
- src/index.js
Create string

The command to run on create.

Delete string

The command to run on delete. The environment variables PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR are set to the stdout and stderr properties of the Command resource from previous create or update steps.

Dir string

The directory from which to run the command from. If dir does not exist, then Command will fail.

Environment Dictionary<string, string>

Additional environment variables available to the command's process.

Interpreter List<string>

The program and arguments to run the command. On Linux and macOS, defaults to: ["/bin/sh", "-c"]. On Windows, defaults to: ["cmd", "/C"]

Stdin string

Pass a string to the command's process as standard in

Triggers List<object>

Trigger replacements on changes to this input.

Update string

The command to run on update, if empty, create will run again. The environment variables PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR are set to the stdout and stderr properties of the Command resource from previous create or update steps.

ArchivePaths []string

A list of path globs to return as a single archive asset after the command completes.

When specifying glob patterns the following rules apply:

  • We only include files not directories for assets and archives.
  • Path separators are / on all platforms - including Windows.
  • Patterns starting with ! are 'exclude' rules.
  • Rules are evaluated in order, so exclude rules should be after inclusion rules.
  • * matches anything except /
  • ** matches anything, including /
  • All returned paths are relative to the working directory (without leading ./) e.g. file.text or subfolder/file.txt.
  • For full details of the globbing syntax, see github.com/gobwas/glob

Example

Given the rules:

- "assets/**"
- "src/**.js"
- "!**secret.*"

When evaluating against this folder:

- assets/
  - logos/
    - logo.svg
- src/
  - index.js
  - secret.js

The following paths will be returned:

- assets/logos/logo.svg
- src/index.js
AssetPaths []string

A list of path globs to read after the command completes.

When specifying glob patterns the following rules apply:

  • We only include files not directories for assets and archives.
  • Path separators are / on all platforms - including Windows.
  • Patterns starting with ! are 'exclude' rules.
  • Rules are evaluated in order, so exclude rules should be after inclusion rules.
  • * matches anything except /
  • ** matches anything, including /
  • All returned paths are relative to the working directory (without leading ./) e.g. file.text or subfolder/file.txt.
  • For full details of the globbing syntax, see github.com/gobwas/glob

Example

Given the rules:

- "assets/**"
- "src/**.js"
- "!**secret.*"

When evaluating against this folder:

- assets/
  - logos/
    - logo.svg
- src/
  - index.js
  - secret.js

The following paths will be returned:

- assets/logos/logo.svg
- src/index.js
Create string

The command to run on create.

Delete string

The command to run on delete. The environment variables PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR are set to the stdout and stderr properties of the Command resource from previous create or update steps.

Dir string

The directory from which to run the command from. If dir does not exist, then Command will fail.

Environment map[string]string

Additional environment variables available to the command's process.

Interpreter []string

The program and arguments to run the command. On Linux and macOS, defaults to: ["/bin/sh", "-c"]. On Windows, defaults to: ["cmd", "/C"]

Stdin string

Pass a string to the command's process as standard in

Triggers []interface{}

Trigger replacements on changes to this input.

Update string

The command to run on update, if empty, create will run again. The environment variables PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR are set to the stdout and stderr properties of the Command resource from previous create or update steps.

archivePaths List<String>

A list of path globs to return as a single archive asset after the command completes.

When specifying glob patterns the following rules apply:

  • We only include files not directories for assets and archives.
  • Path separators are / on all platforms - including Windows.
  • Patterns starting with ! are 'exclude' rules.
  • Rules are evaluated in order, so exclude rules should be after inclusion rules.
  • * matches anything except /
  • ** matches anything, including /
  • All returned paths are relative to the working directory (without leading ./) e.g. file.text or subfolder/file.txt.
  • For full details of the globbing syntax, see github.com/gobwas/glob

Example

Given the rules:

- "assets/**"
- "src/**.js"
- "!**secret.*"

When evaluating against this folder:

- assets/
  - logos/
    - logo.svg
- src/
  - index.js
  - secret.js

The following paths will be returned:

- assets/logos/logo.svg
- src/index.js
assetPaths List<String>

A list of path globs to read after the command completes.

When specifying glob patterns the following rules apply:

  • We only include files not directories for assets and archives.
  • Path separators are / on all platforms - including Windows.
  • Patterns starting with ! are 'exclude' rules.
  • Rules are evaluated in order, so exclude rules should be after inclusion rules.
  • * matches anything except /
  • ** matches anything, including /
  • All returned paths are relative to the working directory (without leading ./) e.g. file.text or subfolder/file.txt.
  • For full details of the globbing syntax, see github.com/gobwas/glob

Example

Given the rules:

- "assets/**"
- "src/**.js"
- "!**secret.*"

When evaluating against this folder:

- assets/
  - logos/
    - logo.svg
- src/
  - index.js
  - secret.js

The following paths will be returned:

- assets/logos/logo.svg
- src/index.js
create String

The command to run on create.

delete String

The command to run on delete. The environment variables PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR are set to the stdout and stderr properties of the Command resource from previous create or update steps.

dir String

The directory from which to run the command from. If dir does not exist, then Command will fail.

environment Map<String,String>

Additional environment variables available to the command's process.

interpreter List<String>

The program and arguments to run the command. On Linux and macOS, defaults to: ["/bin/sh", "-c"]. On Windows, defaults to: ["cmd", "/C"]

stdin String

Pass a string to the command's process as standard in

triggers List<Object>

Trigger replacements on changes to this input.

update String

The command to run on update, if empty, create will run again. The environment variables PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR are set to the stdout and stderr properties of the Command resource from previous create or update steps.

archivePaths string[]

A list of path globs to return as a single archive asset after the command completes.

When specifying glob patterns the following rules apply:

  • We only include files not directories for assets and archives.
  • Path separators are / on all platforms - including Windows.
  • Patterns starting with ! are 'exclude' rules.
  • Rules are evaluated in order, so exclude rules should be after inclusion rules.
  • * matches anything except /
  • ** matches anything, including /
  • All returned paths are relative to the working directory (without leading ./) e.g. file.text or subfolder/file.txt.
  • For full details of the globbing syntax, see github.com/gobwas/glob

Example

Given the rules:

- "assets/**"
- "src/**.js"
- "!**secret.*"

When evaluating against this folder:

- assets/
  - logos/
    - logo.svg
- src/
  - index.js
  - secret.js

The following paths will be returned:

- assets/logos/logo.svg
- src/index.js
assetPaths string[]

A list of path globs to read after the command completes.

When specifying glob patterns the following rules apply:

  • We only include files not directories for assets and archives.
  • Path separators are / on all platforms - including Windows.
  • Patterns starting with ! are 'exclude' rules.
  • Rules are evaluated in order, so exclude rules should be after inclusion rules.
  • * matches anything except /
  • ** matches anything, including /
  • All returned paths are relative to the working directory (without leading ./) e.g. file.text or subfolder/file.txt.
  • For full details of the globbing syntax, see github.com/gobwas/glob

Example

Given the rules:

- "assets/**"
- "src/**.js"
- "!**secret.*"

When evaluating against this folder:

- assets/
  - logos/
    - logo.svg
- src/
  - index.js
  - secret.js

The following paths will be returned:

- assets/logos/logo.svg
- src/index.js
create string

The command to run on create.

delete string

The command to run on delete. The environment variables PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR are set to the stdout and stderr properties of the Command resource from previous create or update steps.

dir string

The directory from which to run the command from. If dir does not exist, then Command will fail.

environment {[key: string]: string}

Additional environment variables available to the command's process.

interpreter string[]

The program and arguments to run the command. On Linux and macOS, defaults to: ["/bin/sh", "-c"]. On Windows, defaults to: ["cmd", "/C"]

stdin string

Pass a string to the command's process as standard in

triggers any[]

Trigger replacements on changes to this input.

update string

The command to run on update, if empty, create will run again. The environment variables PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR are set to the stdout and stderr properties of the Command resource from previous create or update steps.

archive_paths Sequence[str]

A list of path globs to return as a single archive asset after the command completes.

When specifying glob patterns the following rules apply:

  • We only include files not directories for assets and archives.
  • Path separators are / on all platforms - including Windows.
  • Patterns starting with ! are 'exclude' rules.
  • Rules are evaluated in order, so exclude rules should be after inclusion rules.
  • * matches anything except /
  • ** matches anything, including /
  • All returned paths are relative to the working directory (without leading ./) e.g. file.text or subfolder/file.txt.
  • For full details of the globbing syntax, see github.com/gobwas/glob

Example

Given the rules:

- "assets/**"
- "src/**.js"
- "!**secret.*"

When evaluating against this folder:

- assets/
  - logos/
    - logo.svg
- src/
  - index.js
  - secret.js

The following paths will be returned:

- assets/logos/logo.svg
- src/index.js
asset_paths Sequence[str]

A list of path globs to read after the command completes.

When specifying glob patterns the following rules apply:

  • We only include files not directories for assets and archives.
  • Path separators are / on all platforms - including Windows.
  • Patterns starting with ! are 'exclude' rules.
  • Rules are evaluated in order, so exclude rules should be after inclusion rules.
  • * matches anything except /
  • ** matches anything, including /
  • All returned paths are relative to the working directory (without leading ./) e.g. file.text or subfolder/file.txt.
  • For full details of the globbing syntax, see github.com/gobwas/glob

Example

Given the rules:

- "assets/**"
- "src/**.js"
- "!**secret.*"

When evaluating against this folder:

- assets/
  - logos/
    - logo.svg
- src/
  - index.js
  - secret.js

The following paths will be returned:

- assets/logos/logo.svg
- src/index.js
create str

The command to run on create.

delete str

The command to run on delete. The environment variables PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR are set to the stdout and stderr properties of the Command resource from previous create or update steps.

dir str

The directory from which to run the command from. If dir does not exist, then Command will fail.

environment Mapping[str, str]

Additional environment variables available to the command's process.

interpreter Sequence[str]

The program and arguments to run the command. On Linux and macOS, defaults to: ["/bin/sh", "-c"]. On Windows, defaults to: ["cmd", "/C"]

stdin str

Pass a string to the command's process as standard in

triggers Sequence[Any]

Trigger replacements on changes to this input.

update str

The command to run on update, if empty, create will run again. The environment variables PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR are set to the stdout and stderr properties of the Command resource from previous create or update steps.

archivePaths List<String>

A list of path globs to return as a single archive asset after the command completes.

When specifying glob patterns the following rules apply:

  • We only include files not directories for assets and archives.
  • Path separators are / on all platforms - including Windows.
  • Patterns starting with ! are 'exclude' rules.
  • Rules are evaluated in order, so exclude rules should be after inclusion rules.
  • * matches anything except /
  • ** matches anything, including /
  • All returned paths are relative to the working directory (without leading ./) e.g. file.text or subfolder/file.txt.
  • For full details of the globbing syntax, see github.com/gobwas/glob

Example

Given the rules:

- "assets/**"
- "src/**.js"
- "!**secret.*"

When evaluating against this folder:

- assets/
  - logos/
    - logo.svg
- src/
  - index.js
  - secret.js

The following paths will be returned:

- assets/logos/logo.svg
- src/index.js
assetPaths List<String>

A list of path globs to read after the command completes.

When specifying glob patterns the following rules apply:

  • We only include files not directories for assets and archives.
  • Path separators are / on all platforms - including Windows.
  • Patterns starting with ! are 'exclude' rules.
  • Rules are evaluated in order, so exclude rules should be after inclusion rules.
  • * matches anything except /
  • ** matches anything, including /
  • All returned paths are relative to the working directory (without leading ./) e.g. file.text or subfolder/file.txt.
  • For full details of the globbing syntax, see github.com/gobwas/glob

Example

Given the rules:

- "assets/**"
- "src/**.js"
- "!**secret.*"

When evaluating against this folder:

- assets/
  - logos/
    - logo.svg
- src/
  - index.js
  - secret.js

The following paths will be returned:

- assets/logos/logo.svg
- src/index.js
create String

The command to run on create.

delete String

The command to run on delete. The environment variables PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR are set to the stdout and stderr properties of the Command resource from previous create or update steps.

dir String

The directory from which to run the command from. If dir does not exist, then Command will fail.

environment Map<String>

Additional environment variables available to the command's process.

interpreter List<String>

The program and arguments to run the command. On Linux and macOS, defaults to: ["/bin/sh", "-c"]. On Windows, defaults to: ["cmd", "/C"]

stdin String

Pass a string to the command's process as standard in

triggers List<Any>

Trigger replacements on changes to this input.

update String

The command to run on update, if empty, create will run again. The environment variables PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR are set to the stdout and stderr properties of the Command resource from previous create or update steps.

Outputs

All input properties are implicitly available as output properties. Additionally, the Command resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Stderr string

The standard error of the command's process

Stdout string

The standard output of the command's process

Archive Archive

An archive asset containing files found after running the command.

Assets Dictionary<string, AssetOrArchive>

A map of assets found after running the command. The key is the relative path from the command dir

Id string

The provider-assigned unique ID for this managed resource.

Stderr string

The standard error of the command's process

Stdout string

The standard output of the command's process

Archive pulumi.Archive

An archive asset containing files found after running the command.

Assets AssetOrArchive

A map of assets found after running the command. The key is the relative path from the command dir

id String

The provider-assigned unique ID for this managed resource.

stderr String

The standard error of the command's process

stdout String

The standard output of the command's process

archive Archive

An archive asset containing files found after running the command.

assets Map<String,AssetOrArchive>

A map of assets found after running the command. The key is the relative path from the command dir

id string

The provider-assigned unique ID for this managed resource.

stderr string

The standard error of the command's process

stdout string

The standard output of the command's process

archive pulumi.asset.Archive

An archive asset containing files found after running the command.

assets {[key: string]: pulumi.asset.Asset | pulumi.asset.Archive}

A map of assets found after running the command. The key is the relative path from the command dir

id str

The provider-assigned unique ID for this managed resource.

stderr str

The standard error of the command's process

stdout str

The standard output of the command's process

archive pulumi.Archive

An archive asset containing files found after running the command.

assets Archive]]

A map of assets found after running the command. The key is the relative path from the command dir

id String

The provider-assigned unique ID for this managed resource.

stderr String

The standard error of the command's process

stdout String

The standard output of the command's process

archive Archive

An archive asset containing files found after running the command.

assets Map<Asset>

A map of assets found after running the command. The key is the relative path from the command dir

Package Details

Repository
command pulumi/pulumi-command
License
Apache-2.0