command.remote.Command
Explore with Pulumi AI
A command to run on a remote host. The connection is established via ssh.
Example Usage
A Basic Example
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Command = Pulumi.Command;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var server = config.Require("server");
var userName = config.Require("userName");
var privateKey = config.Require("privateKey");
var hostnameCmd = new Command.Remote.Command("hostnameCmd", new()
{
Create = "hostname",
Connection = new Command.Remote.Inputs.ConnectionArgs
{
Host = server,
User = userName,
PrivateKey = privateKey,
},
});
return new Dictionary<string, object?>
{
["hostname"] = hostnameCmd.Stdout,
};
});
package main
import (
"github.com/pulumi/pulumi-command/sdk/go/command/remote"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
server := cfg.Require("server")
userName := cfg.Require("userName")
privateKey := cfg.Require("privateKey")
hostnameCmd, err := remote.NewCommand(ctx, "hostnameCmd", &remote.CommandArgs{
Create: pulumi.String("hostname"),
Connection: &remote.ConnectionArgs{
Host: pulumi.String(server),
User: pulumi.String(userName),
PrivateKey: pulumi.String(privateKey),
},
})
if err != nil {
return err
}
ctx.Export("hostname", hostnameCmd.Stdout)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.command.remote.Command;
import com.pulumi.command.remote.CommandArgs;
import com.pulumi.command.remote.inputs.ConnectionArgs;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var config = ctx.config();
final var server = config.require("server");
final var userName = config.require("userName");
final var privateKey = config.require("privateKey");
var hostnameCmd = new Command("hostnameCmd", CommandArgs.builder()
.create("hostname")
.connection(ConnectionArgs.builder()
.host(server)
.user(userName)
.privateKey(privateKey)
.build())
.build());
ctx.export("hostname", hostnameCmd.stdout());
}
}
import * as pulumi from "@pulumi/pulumi";
import * as command from "@pulumi/command";
const config = new pulumi.Config();
const server = config.require("server");
const userName = config.require("userName");
const privateKey = config.require("privateKey");
const hostnameCmd = new command.remote.Command("hostnameCmd", {
create: "hostname",
connection: {
host: server,
user: userName,
privateKey: privateKey,
},
});
export const hostname = hostnameCmd.stdout;
import pulumi
import pulumi_command as command
config = pulumi.Config()
server = config.require("server")
user_name = config.require("userName")
private_key = config.require("privateKey")
hostname_cmd = command.remote.Command("hostnameCmd",
create="hostname",
connection=command.remote.ConnectionArgs(
host=server,
user=user_name,
private_key=private_key,
))
pulumi.export("hostname", hostname_cmd.stdout)
outputs:
hostname: ${hostnameCmd.stdout}
config:
server:
type: string
userName:
type: string
privateKey:
type: string
resources:
hostnameCmd:
type: command:remote:Command
properties:
create: "hostname"
# The configuration of our SSH connection to the server.
connection:
host: ${server}
user: ${userName}
privateKey: ${privateKey}
Triggers
using Pulumi;
using Command = Pulumi.Command;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var str = "foo";
var fileAssetVar = new FileAsset("Pulumi.yaml");
var rand = new Random.RandomString("rand", new()
{
Length = 5,
});
var localFile = new Command.Local.Command("localFile", new()
{
Create = "touch foo.txt",
ArchivePaths = new[]
{
"*.txt",
},
});
var cmd = new Command.Remote.Command("cmd", new()
{
Connection = new Command.Remote.Inputs.ConnectionArgs
{
Host = "insert host here",
},
Create = "echo create > op.txt",
Delete = "echo delete >> op.txt",
Triggers = new object[]
{
str,
rand.Result,
fileAssetVar,
localFile.Archive,
},
});
});
package main
import (
"github.com/pulumi/pulumi-command/sdk/go/command/local"
"github.com/pulumi/pulumi-command/sdk/go/command/remote"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
str := pulumi.String("foo")
fileAsset := pulumi.NewFileAsset("Pulumi.yaml")
rand, err := random.NewRandomString(ctx, "rand", &random.RandomStringArgs{
Length: pulumi.Int(5),
})
if err != nil {
return err
}
localFile, err := local.NewCommand(ctx, "localFile", &local.CommandArgs{
Create: pulumi.String("touch foo.txt"),
ArchivePaths: pulumi.StringArray{
pulumi.String("*.txt"),
},
})
if err != nil {
return err
}
_, err = remote.NewCommand(ctx, "cmd", &remote.CommandArgs{
Connection: &remote.ConnectionArgs{
Host: pulumi.String("insert host here"),
},
Create: pulumi.String("echo create > op.txt"),
Delete: pulumi.String("echo delete >> op.txt"),
Triggers: pulumi.Array{
str,
rand.Result,
fileAsset,
localFile.Archive,
},
})
if err != nil {
return err
}
return nil
})
}
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var fileAssetVar = new FileAsset("Pulumi.yaml");
var rand = new RandomString("rand", RandomStringArgs.builder()
.length(5)
.build());
var localFile = new Command("localFile", CommandArgs.builder()
.create("touch foo.txt")
.archivePaths("*.txt")
.build());
var cmd = new Command("cmd", CommandArgs.builder()
.connection(ConnectionArgs.builder()
.host("insert host here")
.build())
.create("echo create > op.txt")
.delete("echo delete >> op.txt")
.triggers(
rand.result(),
fileAssetVar,
localFile.archive())
.build());
}
}
import * as pulumi from "@pulumi/pulumi";
import * as command from "@pulumi/command";
import * as random from "@pulumi/random";
const str = "foo";
const fileAsset = new pulumi.asset.FileAsset("Pulumi.yaml");
const rand = new random.RandomString("rand", {length: 5});
const localFile = new command.local.Command("localFile", {
create: "touch foo.txt",
archivePaths: ["*.txt"],
});
const cmd = new command.remote.Command("cmd", {
connection: {
host: "insert host here",
},
create: "echo create > op.txt",
delete: "echo delete >> op.txt",
triggers: [
str,
rand.result,
fileAsset,
localFile.archive,
],
});
import pulumi
import pulumi_command as command
import pulumi_random as random
foo = "foo"
file_asset_var = pulumi.FileAsset("Pulumi.yaml")
rand = random.RandomString("rand", length=5)
local_file = command.local.Command("localFile",
create="touch foo.txt",
archive_paths=["*.txt"])
cmd = command.remote.Command("cmd",
connection=command.remote.ConnectionArgs(
host="insert host here",
),
create="echo create > op.txt",
delete="echo delete >> op.txt",
triggers=[
foo,
rand.result,
file_asset_var,
local_file.archive,
])
config: {}
outputs: {}
resources:
rand:
type: random:index/randomString:RandomString
properties:
length: 5
localFile:
type: command:local:Command
properties:
create: touch foo.txt
archivePaths:
- "*.txt"
cmd:
type: command:remote:Command
properties:
connection:
host: "insert host here"
create: echo create > op.txt
delete: echo delete >> op.txt
triggers:
- ${rand.result}
- ${fileAsset}
- ${localFile.archive}
variables:
fileAsset:
fn::fileAsset: "Pulumi.yaml"
Create Command Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Command(name: string, args: CommandArgs, opts?: CustomResourceOptions);
@overload
def Command(resource_name: str,
args: CommandArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Command(resource_name: str,
opts: Optional[ResourceOptions] = None,
connection: Optional[ConnectionArgs] = None,
add_previous_output_in_env: Optional[bool] = None,
create: Optional[str] = None,
delete: Optional[str] = None,
environment: Optional[Mapping[str, str]] = None,
logging: Optional[Logging] = None,
stdin: Optional[str] = None,
triggers: Optional[Sequence[Any]] = None,
update: Optional[str] = None)
func NewCommand(ctx *Context, name string, args CommandArgs, opts ...ResourceOption) (*Command, error)
public Command(string name, CommandArgs args, CustomResourceOptions? opts = null)
public Command(String name, CommandArgs args)
public Command(String name, CommandArgs args, CustomResourceOptions options)
type: command:remote:Command
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var commandCommandResource = new Command.Remote.Command("commandCommandResource", new()
{
Connection = new Command.Remote.Inputs.ConnectionArgs
{
Host = "string",
AgentSocketPath = "string",
DialErrorLimit = 0,
HostKey = "string",
Password = "string",
PerDialTimeout = 0,
Port = 0,
PrivateKey = "string",
PrivateKeyPassword = "string",
Proxy = new Command.Remote.Inputs.ProxyConnectionArgs
{
Host = "string",
AgentSocketPath = "string",
DialErrorLimit = 0,
HostKey = "string",
Password = "string",
PerDialTimeout = 0,
Port = 0,
PrivateKey = "string",
PrivateKeyPassword = "string",
User = "string",
},
User = "string",
},
AddPreviousOutputInEnv = false,
Create = "string",
Delete = "string",
Environment =
{
{ "string", "string" },
},
Logging = Command.Remote.Logging.Stdout,
Stdin = "string",
Triggers = new[]
{
"any",
},
Update = "string",
});
example, err := remote.NewCommand(ctx, "commandCommandResource", &remote.CommandArgs{
Connection: &remote.ConnectionArgs{
Host: pulumi.String("string"),
AgentSocketPath: pulumi.String("string"),
DialErrorLimit: pulumi.Int(0),
HostKey: pulumi.String("string"),
Password: pulumi.String("string"),
PerDialTimeout: pulumi.Int(0),
Port: pulumi.Float64(0),
PrivateKey: pulumi.String("string"),
PrivateKeyPassword: pulumi.String("string"),
Proxy: &remote.ProxyConnectionArgs{
Host: pulumi.String("string"),
AgentSocketPath: pulumi.String("string"),
DialErrorLimit: pulumi.Int(0),
HostKey: pulumi.String("string"),
Password: pulumi.String("string"),
PerDialTimeout: pulumi.Int(0),
Port: pulumi.Float64(0),
PrivateKey: pulumi.String("string"),
PrivateKeyPassword: pulumi.String("string"),
User: pulumi.String("string"),
},
User: pulumi.String("string"),
},
AddPreviousOutputInEnv: pulumi.Bool(false),
Create: pulumi.String("string"),
Delete: pulumi.String("string"),
Environment: pulumi.StringMap{
"string": pulumi.String("string"),
},
Logging: remote.LoggingStdout,
Stdin: pulumi.String("string"),
Triggers: pulumi.Array{
pulumi.Any("any"),
},
Update: pulumi.String("string"),
})
var commandCommandResource = new com.pulumi.command.remote.Command("commandCommandResource", com.pulumi.command.remote.CommandArgs.builder()
.connection(ConnectionArgs.builder()
.host("string")
.agentSocketPath("string")
.dialErrorLimit(0)
.hostKey("string")
.password("string")
.perDialTimeout(0)
.port(0.0)
.privateKey("string")
.privateKeyPassword("string")
.proxy(ProxyConnectionArgs.builder()
.host("string")
.agentSocketPath("string")
.dialErrorLimit(0)
.hostKey("string")
.password("string")
.perDialTimeout(0)
.port(0.0)
.privateKey("string")
.privateKeyPassword("string")
.user("string")
.build())
.user("string")
.build())
.addPreviousOutputInEnv(false)
.create("string")
.delete("string")
.environment(Map.of("string", "string"))
.logging("stdout")
.stdin("string")
.triggers("any")
.update("string")
.build());
command_command_resource = command.remote.Command("commandCommandResource",
connection={
"host": "string",
"agent_socket_path": "string",
"dial_error_limit": 0,
"host_key": "string",
"password": "string",
"per_dial_timeout": 0,
"port": 0,
"private_key": "string",
"private_key_password": "string",
"proxy": {
"host": "string",
"agent_socket_path": "string",
"dial_error_limit": 0,
"host_key": "string",
"password": "string",
"per_dial_timeout": 0,
"port": 0,
"private_key": "string",
"private_key_password": "string",
"user": "string",
},
"user": "string",
},
add_previous_output_in_env=False,
create="string",
delete="string",
environment={
"string": "string",
},
logging=command.remote.Logging.STDOUT,
stdin="string",
triggers=["any"],
update="string")
const commandCommandResource = new command.remote.Command("commandCommandResource", {
connection: {
host: "string",
agentSocketPath: "string",
dialErrorLimit: 0,
hostKey: "string",
password: "string",
perDialTimeout: 0,
port: 0,
privateKey: "string",
privateKeyPassword: "string",
proxy: {
host: "string",
agentSocketPath: "string",
dialErrorLimit: 0,
hostKey: "string",
password: "string",
perDialTimeout: 0,
port: 0,
privateKey: "string",
privateKeyPassword: "string",
user: "string",
},
user: "string",
},
addPreviousOutputInEnv: false,
create: "string",
"delete": "string",
environment: {
string: "string",
},
logging: command.remote.Logging.Stdout,
stdin: "string",
triggers: ["any"],
update: "string",
});
type: command:remote:Command
properties:
addPreviousOutputInEnv: false
connection:
agentSocketPath: string
dialErrorLimit: 0
host: string
hostKey: string
password: string
perDialTimeout: 0
port: 0
privateKey: string
privateKeyPassword: string
proxy:
agentSocketPath: string
dialErrorLimit: 0
host: string
hostKey: string
password: string
perDialTimeout: 0
port: 0
privateKey: string
privateKeyPassword: string
user: string
user: string
create: string
delete: string
environment:
string: string
logging: stdout
stdin: string
triggers:
- any
update: string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Command resource accepts the following input properties:
- Connection Connection
- The parameters with which to connect to the remote host.
- Add
Previous boolOutput In Env - If the previous command's stdout and stderr (as generated by the prior create/update) is injected into the environment of the next run as PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR. Defaults to true.
- Create string
The command to run once on resource creation.
If an
update
command isn't provided, thencreate
will also be run when the resource's inputs are modified.Note that this command will not be executed if the resource has already been created and its inputs are unchanged.
Use
local.runOutput
if you need to run a command on every execution of your program.- Delete string
The command to run on resource delettion.
The environment variables
PULUMI_COMMAND_STDOUT
andPULUMI_COMMAND_STDERR
are set to the stdout and stderr properties of the Command resource from previous create or update steps.- Environment Dictionary<string, string>
- Additional environment variables available to the command's process. Note that this only works if the SSH server is configured to accept these variables via AcceptEnv. Alternatively, if a Bash-like shell runs the command on the remote host, you could prefix the command itself with the variables in the form 'VAR=value command'.
- Logging
Pulumi.
Command. Remote. Logging - If the command's stdout and stderr should be logged. This doesn't affect the capturing of stdout and stderr as outputs. If there might be secrets in the output, you can disable logging here and mark the outputs as secret via 'additionalSecretOutputs'. Defaults to logging both stdout and stderr.
- Stdin string
- Pass a string to the command's process as standard in
- Triggers List<object>
The resource will be updated (or replaced) if any of these values change.
The trigger values can be of any type.
If the
update
command was provided the resource will be updated, otherwise it will be replaced using thecreate
command.Please see the resource documentation for examples.
- Update string
The command to run when the resource is updated.
If empty, the create command will be executed instead.
Note that this command will not run if the resource's inputs are unchanged.
Use
local.runOutput
if you need to run a command on every execution of your program.The environment variables
PULUMI_COMMAND_STDOUT
andPULUMI_COMMAND_STDERR
are set to thestdout
andstderr
properties of the Command resource from previous create or update steps.
- Connection
Connection
Args - The parameters with which to connect to the remote host.
- Add
Previous boolOutput In Env - If the previous command's stdout and stderr (as generated by the prior create/update) is injected into the environment of the next run as PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR. Defaults to true.
- Create string
The command to run once on resource creation.
If an
update
command isn't provided, thencreate
will also be run when the resource's inputs are modified.Note that this command will not be executed if the resource has already been created and its inputs are unchanged.
Use
local.runOutput
if you need to run a command on every execution of your program.- Delete string
The command to run on resource delettion.
The environment variables
PULUMI_COMMAND_STDOUT
andPULUMI_COMMAND_STDERR
are set to the stdout and stderr properties of the Command resource from previous create or update steps.- Environment map[string]string
- Additional environment variables available to the command's process. Note that this only works if the SSH server is configured to accept these variables via AcceptEnv. Alternatively, if a Bash-like shell runs the command on the remote host, you could prefix the command itself with the variables in the form 'VAR=value command'.
- Logging Logging
- If the command's stdout and stderr should be logged. This doesn't affect the capturing of stdout and stderr as outputs. If there might be secrets in the output, you can disable logging here and mark the outputs as secret via 'additionalSecretOutputs'. Defaults to logging both stdout and stderr.
- Stdin string
- Pass a string to the command's process as standard in
- Triggers []interface{}
The resource will be updated (or replaced) if any of these values change.
The trigger values can be of any type.
If the
update
command was provided the resource will be updated, otherwise it will be replaced using thecreate
command.Please see the resource documentation for examples.
- Update string
The command to run when the resource is updated.
If empty, the create command will be executed instead.
Note that this command will not run if the resource's inputs are unchanged.
Use
local.runOutput
if you need to run a command on every execution of your program.The environment variables
PULUMI_COMMAND_STDOUT
andPULUMI_COMMAND_STDERR
are set to thestdout
andstderr
properties of the Command resource from previous create or update steps.
- connection Connection
- The parameters with which to connect to the remote host.
- add
Previous BooleanOutput In Env - If the previous command's stdout and stderr (as generated by the prior create/update) is injected into the environment of the next run as PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR. Defaults to true.
- create String
The command to run once on resource creation.
If an
update
command isn't provided, thencreate
will also be run when the resource's inputs are modified.Note that this command will not be executed if the resource has already been created and its inputs are unchanged.
Use
local.runOutput
if you need to run a command on every execution of your program.- delete String
The command to run on resource delettion.
The environment variables
PULUMI_COMMAND_STDOUT
andPULUMI_COMMAND_STDERR
are set to the stdout and stderr properties of the Command resource from previous create or update steps.- environment Map<String,String>
- Additional environment variables available to the command's process. Note that this only works if the SSH server is configured to accept these variables via AcceptEnv. Alternatively, if a Bash-like shell runs the command on the remote host, you could prefix the command itself with the variables in the form 'VAR=value command'.
- logging Logging
- If the command's stdout and stderr should be logged. This doesn't affect the capturing of stdout and stderr as outputs. If there might be secrets in the output, you can disable logging here and mark the outputs as secret via 'additionalSecretOutputs'. Defaults to logging both stdout and stderr.
- stdin String
- Pass a string to the command's process as standard in
- triggers List<Object>
The resource will be updated (or replaced) if any of these values change.
The trigger values can be of any type.
If the
update
command was provided the resource will be updated, otherwise it will be replaced using thecreate
command.Please see the resource documentation for examples.
- update String
The command to run when the resource is updated.
If empty, the create command will be executed instead.
Note that this command will not run if the resource's inputs are unchanged.
Use
local.runOutput
if you need to run a command on every execution of your program.The environment variables
PULUMI_COMMAND_STDOUT
andPULUMI_COMMAND_STDERR
are set to thestdout
andstderr
properties of the Command resource from previous create or update steps.
- connection Connection
- The parameters with which to connect to the remote host.
- add
Previous booleanOutput In Env - If the previous command's stdout and stderr (as generated by the prior create/update) is injected into the environment of the next run as PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR. Defaults to true.
- create string
The command to run once on resource creation.
If an
update
command isn't provided, thencreate
will also be run when the resource's inputs are modified.Note that this command will not be executed if the resource has already been created and its inputs are unchanged.
Use
local.runOutput
if you need to run a command on every execution of your program.- delete string
The command to run on resource delettion.
The environment variables
PULUMI_COMMAND_STDOUT
andPULUMI_COMMAND_STDERR
are set to the stdout and stderr properties of the Command resource from previous create or update steps.- environment {[key: string]: string}
- Additional environment variables available to the command's process. Note that this only works if the SSH server is configured to accept these variables via AcceptEnv. Alternatively, if a Bash-like shell runs the command on the remote host, you could prefix the command itself with the variables in the form 'VAR=value command'.
- logging Logging
- If the command's stdout and stderr should be logged. This doesn't affect the capturing of stdout and stderr as outputs. If there might be secrets in the output, you can disable logging here and mark the outputs as secret via 'additionalSecretOutputs'. Defaults to logging both stdout and stderr.
- stdin string
- Pass a string to the command's process as standard in
- triggers any[]
The resource will be updated (or replaced) if any of these values change.
The trigger values can be of any type.
If the
update
command was provided the resource will be updated, otherwise it will be replaced using thecreate
command.Please see the resource documentation for examples.
- update string
The command to run when the resource is updated.
If empty, the create command will be executed instead.
Note that this command will not run if the resource's inputs are unchanged.
Use
local.runOutput
if you need to run a command on every execution of your program.The environment variables
PULUMI_COMMAND_STDOUT
andPULUMI_COMMAND_STDERR
are set to thestdout
andstderr
properties of the Command resource from previous create or update steps.
- connection
Connection
Args - The parameters with which to connect to the remote host.
- add_
previous_ booloutput_ in_ env - If the previous command's stdout and stderr (as generated by the prior create/update) is injected into the environment of the next run as PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR. Defaults to true.
- create str
The command to run once on resource creation.
If an
update
command isn't provided, thencreate
will also be run when the resource's inputs are modified.Note that this command will not be executed if the resource has already been created and its inputs are unchanged.
Use
local.runOutput
if you need to run a command on every execution of your program.- delete str
The command to run on resource delettion.
The environment variables
PULUMI_COMMAND_STDOUT
andPULUMI_COMMAND_STDERR
are set to the stdout and stderr properties of the Command resource from previous create or update steps.- environment Mapping[str, str]
- Additional environment variables available to the command's process. Note that this only works if the SSH server is configured to accept these variables via AcceptEnv. Alternatively, if a Bash-like shell runs the command on the remote host, you could prefix the command itself with the variables in the form 'VAR=value command'.
- logging Logging
- If the command's stdout and stderr should be logged. This doesn't affect the capturing of stdout and stderr as outputs. If there might be secrets in the output, you can disable logging here and mark the outputs as secret via 'additionalSecretOutputs'. Defaults to logging both stdout and stderr.
- stdin str
- Pass a string to the command's process as standard in
- triggers Sequence[Any]
The resource will be updated (or replaced) if any of these values change.
The trigger values can be of any type.
If the
update
command was provided the resource will be updated, otherwise it will be replaced using thecreate
command.Please see the resource documentation for examples.
- update str
The command to run when the resource is updated.
If empty, the create command will be executed instead.
Note that this command will not run if the resource's inputs are unchanged.
Use
local.runOutput
if you need to run a command on every execution of your program.The environment variables
PULUMI_COMMAND_STDOUT
andPULUMI_COMMAND_STDERR
are set to thestdout
andstderr
properties of the Command resource from previous create or update steps.
- connection Property Map
- The parameters with which to connect to the remote host.
- add
Previous BooleanOutput In Env - If the previous command's stdout and stderr (as generated by the prior create/update) is injected into the environment of the next run as PULUMI_COMMAND_STDOUT and PULUMI_COMMAND_STDERR. Defaults to true.
- create String
The command to run once on resource creation.
If an
update
command isn't provided, thencreate
will also be run when the resource's inputs are modified.Note that this command will not be executed if the resource has already been created and its inputs are unchanged.
Use
local.runOutput
if you need to run a command on every execution of your program.- delete String
The command to run on resource delettion.
The environment variables
PULUMI_COMMAND_STDOUT
andPULUMI_COMMAND_STDERR
are set to the stdout and stderr properties of the Command resource from previous create or update steps.- environment Map<String>
- Additional environment variables available to the command's process. Note that this only works if the SSH server is configured to accept these variables via AcceptEnv. Alternatively, if a Bash-like shell runs the command on the remote host, you could prefix the command itself with the variables in the form 'VAR=value command'.
- logging
"stdout" | "stderr" | "stdout
And Stderr" | "none" - If the command's stdout and stderr should be logged. This doesn't affect the capturing of stdout and stderr as outputs. If there might be secrets in the output, you can disable logging here and mark the outputs as secret via 'additionalSecretOutputs'. Defaults to logging both stdout and stderr.
- stdin String
- Pass a string to the command's process as standard in
- triggers List<Any>
The resource will be updated (or replaced) if any of these values change.
The trigger values can be of any type.
If the
update
command was provided the resource will be updated, otherwise it will be replaced using thecreate
command.Please see the resource documentation for examples.
- update String
The command to run when the resource is updated.
If empty, the create command will be executed instead.
Note that this command will not run if the resource's inputs are unchanged.
Use
local.runOutput
if you need to run a command on every execution of your program.The environment variables
PULUMI_COMMAND_STDOUT
andPULUMI_COMMAND_STDERR
are set to thestdout
andstderr
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:
Supporting Types
Connection, ConnectionArgs
- Host string
- The address of the resource to connect to.
- Agent
Socket stringPath - SSH Agent socket path. Default to environment variable SSH_AUTH_SOCK if present.
- Dial
Error intLimit - Max allowed errors on trying to dial the remote host. -1 set count to unlimited. Default value is 10.
- Host
Key string - The expected host key to verify the server's identity. If not provided, the host key will be ignored.
- Password string
- The password we should use for the connection.
- Per
Dial intTimeout - Max number of seconds for each dial attempt. 0 implies no maximum. Default value is 15 seconds.
- Port double
- The port to connect to. Defaults to 22.
- Private
Key string - The contents of an SSH key to use for the connection. This takes preference over the password if provided.
- Private
Key stringPassword - The password to use in case the private key is encrypted.
- Proxy
Proxy
Connection - The connection settings for the bastion/proxy host.
- User string
- The user that we should use for the connection.
- Host string
- The address of the resource to connect to.
- Agent
Socket stringPath - SSH Agent socket path. Default to environment variable SSH_AUTH_SOCK if present.
- Dial
Error intLimit - Max allowed errors on trying to dial the remote host. -1 set count to unlimited. Default value is 10.
- Host
Key string - The expected host key to verify the server's identity. If not provided, the host key will be ignored.
- Password string
- The password we should use for the connection.
- Per
Dial intTimeout - Max number of seconds for each dial attempt. 0 implies no maximum. Default value is 15 seconds.
- Port float64
- The port to connect to. Defaults to 22.
- Private
Key string - The contents of an SSH key to use for the connection. This takes preference over the password if provided.
- Private
Key stringPassword - The password to use in case the private key is encrypted.
- Proxy
Proxy
Connection - The connection settings for the bastion/proxy host.
- User string
- The user that we should use for the connection.
- host String
- The address of the resource to connect to.
- agent
Socket StringPath - SSH Agent socket path. Default to environment variable SSH_AUTH_SOCK if present.
- dial
Error IntegerLimit - Max allowed errors on trying to dial the remote host. -1 set count to unlimited. Default value is 10.
- host
Key String - The expected host key to verify the server's identity. If not provided, the host key will be ignored.
- password String
- The password we should use for the connection.
- per
Dial IntegerTimeout - Max number of seconds for each dial attempt. 0 implies no maximum. Default value is 15 seconds.
- port Double
- The port to connect to. Defaults to 22.
- private
Key String - The contents of an SSH key to use for the connection. This takes preference over the password if provided.
- private
Key StringPassword - The password to use in case the private key is encrypted.
- proxy
Proxy
Connection - The connection settings for the bastion/proxy host.
- user String
- The user that we should use for the connection.
- host string
- The address of the resource to connect to.
- agent
Socket stringPath - SSH Agent socket path. Default to environment variable SSH_AUTH_SOCK if present.
- dial
Error numberLimit - Max allowed errors on trying to dial the remote host. -1 set count to unlimited. Default value is 10.
- host
Key string - The expected host key to verify the server's identity. If not provided, the host key will be ignored.
- password string
- The password we should use for the connection.
- per
Dial numberTimeout - Max number of seconds for each dial attempt. 0 implies no maximum. Default value is 15 seconds.
- port number
- The port to connect to. Defaults to 22.
- private
Key string - The contents of an SSH key to use for the connection. This takes preference over the password if provided.
- private
Key stringPassword - The password to use in case the private key is encrypted.
- proxy
Proxy
Connection - The connection settings for the bastion/proxy host.
- user string
- The user that we should use for the connection.
- host str
- The address of the resource to connect to.
- agent_
socket_ strpath - SSH Agent socket path. Default to environment variable SSH_AUTH_SOCK if present.
- dial_
error_ intlimit - Max allowed errors on trying to dial the remote host. -1 set count to unlimited. Default value is 10.
- host_
key str - The expected host key to verify the server's identity. If not provided, the host key will be ignored.
- password str
- The password we should use for the connection.
- per_
dial_ inttimeout - Max number of seconds for each dial attempt. 0 implies no maximum. Default value is 15 seconds.
- port float
- The port to connect to. Defaults to 22.
- private_
key str - The contents of an SSH key to use for the connection. This takes preference over the password if provided.
- private_
key_ strpassword - The password to use in case the private key is encrypted.
- proxy
Proxy
Connection - The connection settings for the bastion/proxy host.
- user str
- The user that we should use for the connection.
- host String
- The address of the resource to connect to.
- agent
Socket StringPath - SSH Agent socket path. Default to environment variable SSH_AUTH_SOCK if present.
- dial
Error NumberLimit - Max allowed errors on trying to dial the remote host. -1 set count to unlimited. Default value is 10.
- host
Key String - The expected host key to verify the server's identity. If not provided, the host key will be ignored.
- password String
- The password we should use for the connection.
- per
Dial NumberTimeout - Max number of seconds for each dial attempt. 0 implies no maximum. Default value is 15 seconds.
- port Number
- The port to connect to. Defaults to 22.
- private
Key String - The contents of an SSH key to use for the connection. This takes preference over the password if provided.
- private
Key StringPassword - The password to use in case the private key is encrypted.
- proxy Property Map
- The connection settings for the bastion/proxy host.
- user String
- The user that we should use for the connection.
Logging, LoggingArgs
- Stdout
- stdoutCapture stdout in logs but not stderr
- Stderr
- stderrCapture stderr in logs but not stdout
- Stdout
And Stderr - stdoutAndStderrCapture stdout and stderr in logs
- None
- noneCapture no logs
- Logging
Stdout - stdoutCapture stdout in logs but not stderr
- Logging
Stderr - stderrCapture stderr in logs but not stdout
- Logging
Stdout And Stderr - stdoutAndStderrCapture stdout and stderr in logs
- Logging
None - noneCapture no logs
- Stdout
- stdoutCapture stdout in logs but not stderr
- Stderr
- stderrCapture stderr in logs but not stdout
- Stdout
And Stderr - stdoutAndStderrCapture stdout and stderr in logs
- None
- noneCapture no logs
- Stdout
- stdoutCapture stdout in logs but not stderr
- Stderr
- stderrCapture stderr in logs but not stdout
- Stdout
And Stderr - stdoutAndStderrCapture stdout and stderr in logs
- None
- noneCapture no logs
- STDOUT
- stdoutCapture stdout in logs but not stderr
- STDERR
- stderrCapture stderr in logs but not stdout
- STDOUT_AND_STDERR
- stdoutAndStderrCapture stdout and stderr in logs
- NONE
- noneCapture no logs
- "stdout"
- stdoutCapture stdout in logs but not stderr
- "stderr"
- stderrCapture stderr in logs but not stdout
- "stdout
And Stderr" - stdoutAndStderrCapture stdout and stderr in logs
- "none"
- noneCapture no logs
ProxyConnection, ProxyConnectionArgs
- Host string
- The address of the bastion host to connect to.
- Agent
Socket stringPath - SSH Agent socket path. Default to environment variable SSH_AUTH_SOCK if present.
- Dial
Error intLimit - Max allowed errors on trying to dial the remote host. -1 set count to unlimited. Default value is 10.
- Host
Key string - The expected host key to verify the server's identity. If not provided, the host key will be ignored.
- Password string
- The password we should use for the connection to the bastion host.
- Per
Dial intTimeout - Max number of seconds for each dial attempt. 0 implies no maximum. Default value is 15 seconds.
- Port double
- The port of the bastion host to connect to.
- Private
Key string - The contents of an SSH key to use for the connection. This takes preference over the password if provided.
- Private
Key stringPassword - The password to use in case the private key is encrypted.
- User string
- The user that we should use for the connection to the bastion host.
- Host string
- The address of the bastion host to connect to.
- Agent
Socket stringPath - SSH Agent socket path. Default to environment variable SSH_AUTH_SOCK if present.
- Dial
Error intLimit - Max allowed errors on trying to dial the remote host. -1 set count to unlimited. Default value is 10.
- Host
Key string - The expected host key to verify the server's identity. If not provided, the host key will be ignored.
- Password string
- The password we should use for the connection to the bastion host.
- Per
Dial intTimeout - Max number of seconds for each dial attempt. 0 implies no maximum. Default value is 15 seconds.
- Port float64
- The port of the bastion host to connect to.
- Private
Key string - The contents of an SSH key to use for the connection. This takes preference over the password if provided.
- Private
Key stringPassword - The password to use in case the private key is encrypted.
- User string
- The user that we should use for the connection to the bastion host.
- host String
- The address of the bastion host to connect to.
- agent
Socket StringPath - SSH Agent socket path. Default to environment variable SSH_AUTH_SOCK if present.
- dial
Error IntegerLimit - Max allowed errors on trying to dial the remote host. -1 set count to unlimited. Default value is 10.
- host
Key String - The expected host key to verify the server's identity. If not provided, the host key will be ignored.
- password String
- The password we should use for the connection to the bastion host.
- per
Dial IntegerTimeout - Max number of seconds for each dial attempt. 0 implies no maximum. Default value is 15 seconds.
- port Double
- The port of the bastion host to connect to.
- private
Key String - The contents of an SSH key to use for the connection. This takes preference over the password if provided.
- private
Key StringPassword - The password to use in case the private key is encrypted.
- user String
- The user that we should use for the connection to the bastion host.
- host string
- The address of the bastion host to connect to.
- agent
Socket stringPath - SSH Agent socket path. Default to environment variable SSH_AUTH_SOCK if present.
- dial
Error numberLimit - Max allowed errors on trying to dial the remote host. -1 set count to unlimited. Default value is 10.
- host
Key string - The expected host key to verify the server's identity. If not provided, the host key will be ignored.
- password string
- The password we should use for the connection to the bastion host.
- per
Dial numberTimeout - Max number of seconds for each dial attempt. 0 implies no maximum. Default value is 15 seconds.
- port number
- The port of the bastion host to connect to.
- private
Key string - The contents of an SSH key to use for the connection. This takes preference over the password if provided.
- private
Key stringPassword - The password to use in case the private key is encrypted.
- user string
- The user that we should use for the connection to the bastion host.
- host str
- The address of the bastion host to connect to.
- agent_
socket_ strpath - SSH Agent socket path. Default to environment variable SSH_AUTH_SOCK if present.
- dial_
error_ intlimit - Max allowed errors on trying to dial the remote host. -1 set count to unlimited. Default value is 10.
- host_
key str - The expected host key to verify the server's identity. If not provided, the host key will be ignored.
- password str
- The password we should use for the connection to the bastion host.
- per_
dial_ inttimeout - Max number of seconds for each dial attempt. 0 implies no maximum. Default value is 15 seconds.
- port float
- The port of the bastion host to connect to.
- private_
key str - The contents of an SSH key to use for the connection. This takes preference over the password if provided.
- private_
key_ strpassword - The password to use in case the private key is encrypted.
- user str
- The user that we should use for the connection to the bastion host.
- host String
- The address of the bastion host to connect to.
- agent
Socket StringPath - SSH Agent socket path. Default to environment variable SSH_AUTH_SOCK if present.
- dial
Error NumberLimit - Max allowed errors on trying to dial the remote host. -1 set count to unlimited. Default value is 10.
- host
Key String - The expected host key to verify the server's identity. If not provided, the host key will be ignored.
- password String
- The password we should use for the connection to the bastion host.
- per
Dial NumberTimeout - Max number of seconds for each dial attempt. 0 implies no maximum. Default value is 15 seconds.
- port Number
- The port of the bastion host to connect to.
- private
Key String - The contents of an SSH key to use for the connection. This takes preference over the password if provided.
- private
Key StringPassword - The password to use in case the private key is encrypted.
- user String
- The user that we should use for the connection to the bastion host.
Package Details
- Repository
- command pulumi/pulumi-command
- License
- Apache-2.0