Install & Compatibility
Where this runs
tested against v1.2.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 1.586s · 86.5MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 6.4s · import 0.850s · 72MB
78MB installed
● package 78MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
local.Command
✓ from pulumi_command import local
✗ from pulumi_command.local import Command
The `local` module is usually imported directly for its functionality, rather than importing `Command` specifically.
remote.Command
✓ from pulumi_command import remote
✗ from pulumi_command.remote import Command
Similar to `local`, the `remote` module is typically imported for its resources.
provider.Provider
✓ from pulumi_command import provider
This quickstart demonstrates how to define a local command that simply echoes a message. The `triggers` input is crucial for ensuring the command re-runs when its inputs change. It also shows a commented-out section for setting up a remote command, highlighting the need for connection details like host, user, and a private key (preferably from an environment variable for security).
import pulumi
from pulumi_command import local
import os
# Example of a local command that echoes a message
# The `triggers` input ensures the command reruns if the message changes.
local_command = local.Command("echo-command",
create="echo 'Hello from Pulumi local command!'",
triggers=["Hello from Pulumi local command!"] # Ensures re-run on change
)
# Export the stdout of the command
pulumi.export("command_output", local_command.stdout)
# For remote commands, you'd typically configure SSH:
# from pulumi_command import remote
# remote_command = remote.Command("remote-script",
# create="ls -la",
# connection=remote.ConnectionArgs(
# host="your_remote_host_ip",
# user="your_username",
# private_key=os.environ.get('SSH_PRIVATE_KEY', '') # Use environment variable for sensitive data
# )
# )
pulumi --version
Debug
Known issues
gotchaCommands are inherently not idempotent. Without explicit `triggers`, Pulumi won't rerun commands even if their inputs change, leading to potential resource drift. Always specify `triggers` if you want a command to rerun on input changes.fixExplicitly define the `triggers` input for your `local.Command` or `remote.Command` resources. The `triggers` list should contain any values whose changes should cause the command to rerun.
affects: All versions
gotchaBy default, `local.Command` and `remote.Command` resources do not perform any 'delete' actions. If a command creates external resources, those resources will persist even if the Pulumi stack is destroyed or the command resource is removed, leading to unmanaged resources or cloud waste.fixAlways define a `delete` input for your command resources if they create persistent external resources. The `delete` command should perform cleanup actions to ensure proper resource lifecycle management.
affects: All versions
gotchaSensitive information output by commands (e.g., passwords, tokens) will appear in Pulumi logs unless explicitly marked as sensitive. This can pose a security risk.fixUse `pulumi.Output.secret()` to wrap any command outputs that contain sensitive information before exporting them or passing them to other resources. For example, `pulumi.export("sensitive_output", pulumi.Output.secret(my_command.stdout))`. affects: All versions
breakingUpgrading to new major versions (e.g., from 1.x to 2.x) of the `pulumi-command` provider or the core Pulumi SDK can introduce breaking changes in resource properties, behavior, or required arguments. Always review release notes carefully.fixConsult the official Pulumi upgrade guides and the provider's specific release notes before performing major version upgrades. Test your Pulumi programs thoroughly in a non-production environment.
affects: Any major version upgrade (e.g., 1.x -> 2.x)
Errors
Common errors & fixes
error: Process exited with status 127:
The command or script executed by `local.Command` or `remote.Command` failed to run successfully on the target system. Status 127 typically indicates that the command itself was not found or is not in the system's PATH.
fixDebug the script or command to ensure it is executable, available in the system's PATH, and returns a zero exit code upon successful completion. Examine the `stderr` output of the `Command` resource for more specific error messages from the executed command.
AttributeError: module 'pulumi_command' has no attribute 'Command'
The `Command` resource is not directly accessible under the top-level `pulumi_command` module. It is located within sub-modules for either local or remote execution.
fixUse the correct import path to specify whether you intend to run a local or remote command. For local commands, use `from pulumi_command.local import Command`. For remote commands, use `from pulumi_command.remote import Command`.
Permission denied (publickey,password)
This error occurs when `pulumi_command.remote.Command` attempts to establish an SSH connection to a remote host, but the provided credentials (private key or password) are incorrect or unauthorized.
fixVerify the `connection` block's parameters in your `remote.Command` resource, ensuring the `user`, `password`, or `privateKey` are correct and have the necessary permissions on the target host. Also, ensure the SSH agent has the correct key loaded if using an agent.
Upgrade
Version history
1.2.1latest on PyPI · released Mar 4, 2026
Audit
Dependencies
pulumirequiredCore Pulumi SDK is required for defining and deploying resources.