{"id":2670,"library":"pulumi-command","title":"Pulumi Command Provider","description":"The Pulumi Command Provider allows users to execute commands and scripts, either locally or remotely, as part of their Pulumi infrastructure-as-code deployments. It integrates command execution directly into the Pulumi resource model, enabling complex provisioning tasks. The current version is 1.2.1, and the library generally follows a minor point release cadence for bug fixes and feature enhancements, with major versions indicating potential breaking changes.","status":"active","version":"1.2.1","language":"python","source_language":"en","source_url":"https://github.com/pulumi/pulumi-command","tags":["pulumi","iac","infrastructure-as-code","command execution","devops","automation","local command","remote command"],"install":[{"cmd":"pip install pulumi-command","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core Pulumi SDK is required for defining and deploying resources.","package":"pulumi"}],"imports":[{"note":"The `local` module is usually imported directly for its functionality, rather than importing `Command` specifically.","wrong":"from pulumi_command.local import Command","symbol":"local.Command","correct":"from pulumi_command import local"},{"note":"Similar to `local`, the `remote` module is typically imported for its resources.","wrong":"from pulumi_command.remote import Command","symbol":"remote.Command","correct":"from pulumi_command import remote"},{"symbol":"provider.Provider","correct":"from pulumi_command import provider"}],"quickstart":{"code":"import pulumi\nfrom pulumi_command import local\nimport os\n\n# Example of a local command that echoes a message\n# The `triggers` input ensures the command reruns if the message changes.\nlocal_command = local.Command(\"echo-command\",\n    create=\"echo 'Hello from Pulumi local command!'\",\n    triggers=[\"Hello from Pulumi local command!\"] # Ensures re-run on change\n)\n\n# Export the stdout of the command\npulumi.export(\"command_output\", local_command.stdout)\n\n# For remote commands, you'd typically configure SSH:\n# from pulumi_command import remote\n# remote_command = remote.Command(\"remote-script\",\n#     create=\"ls -la\",\n#     connection=remote.ConnectionArgs(\n#         host=\"your_remote_host_ip\",\n#         user=\"your_username\",\n#         private_key=os.environ.get('SSH_PRIVATE_KEY', '') # Use environment variable for sensitive data\n#     )\n# )","lang":"python","description":"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)."},"warnings":[{"fix":"Explicitly 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.","message":"Commands 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always 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.","message":"By 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use `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))`.","message":"Sensitive information output by commands (e.g., passwords, tokens) will appear in Pulumi logs unless explicitly marked as sensitive. This can pose a security risk.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Consult 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.","message":"Upgrading 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.","severity":"breaking","affected_versions":"Any major version upgrade (e.g., 1.x -> 2.x)"}],"env_vars":null,"search_vec":"'1.2.1':47 'allow':8 'autom':80 'break':69 'bug':59 'cadenc':57 'chang':70 'code':27,76 'command':2,6,12,31,77,82,84 'complex':40 'current':44 'deploy':28 'devop':79 'direct':33 'either':15 'enabl':39 'enhanc':63 'execut':11,32,78 'featur':62 'fix':60 'follow':52 'general':51 'iac':72 'indic':67 'infrastructur':25,74 'infrastructure-as-cod':24,73 'integr':30 'librari':50 'local':16,81 'major':65 'minor':54 'model':38 'part':20 'point':55 'potenti':68 'provid':3,7 'provis':41 'pulumi':1,5,23,36,71 'releas':56 'remot':18,83 'resourc':37 'script':14 'task':42 'user':9 'version':45,66","created_at":"2026-04-11T01:37:52.017265+00:00","updated_at":"2026-04-16T18:15:08.319202+00:00","problems":[{"fix":"Debug 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.","cause":"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.","error":"error: Process exited with status 127:"},{"fix":"Use 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`.","cause":"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.","error":"AttributeError: module 'pulumi_command' has no attribute 'Command'"},{"fix":"Verify 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.","cause":"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.","error":"Permission denied (publickey,password)"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.2.1","cli_name":"pulumi","cli_version":"sh: 1: pulumi: not found","type":"library","homepage":"https://pulumi.com","github":"https://github.com/pulumi/pulumi-command","docs":null,"changelog":null,"pypi":"https://pypi.org/project/pulumi-command/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","workflow"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-28","next_check":"2026-07-28","install_tag":null}}