iagctl run service executable

Executes an executable service.

Use this command to execute an executable service. The command displays the resulting stdout, stderr, return code, and execution time.

To pass arguments when running an executable service, use the --set flag with key=value syntax. If the service was created with a decorator, any variables you pass in using --set are validated against that decorator.

For more information, see Run an executable service.

Syntax

iagctl run service executable <service-name> [flags]

How arguments are passed

The format in which arguments are passed to your executable depends on the --arg-format specified when the service was created. The default format is --{{.Key}} {{.Value}}, which passes arguments as command-line flags.

For example, if you run:

$iagctl run service executable my-script --set device=10.0.0.1 --set port=22

With the default --arg-format "--{{.Key}} {{.Value}}", IAG executes:

$/path/to/executable --device 10.0.0.1 --port 22

If the service was created with --arg-format "{{.Key}}={{.Value}}", IAG executes:

$/path/to/executable device=10.0.0.1 port=22

Make sure your executable can parse arguments in the format specified when the service was created.

Runtime secrets

You can inject secrets at runtime using the --set-secret flag. Runtime secrets are merged with or override the secrets defined on the service at creation time. The --set-secret flag uses the same comma-separated syntax as the create command:

--set-secret name=my-secret,type=env,target=ENV_VAR_NAME

Examples

Run an executable service with no arguments

Runs an executable service called backup-script.

$iagctl run service executable backup-script

Run an executable service with arguments

Runs an executable service called network-config with device and interface arguments.

$iagctl run service executable network-config \
> --set device=router-01 \
> --set interface=eth0

Run an executable service with a runtime secret

Runs an executable service and injects a secret at runtime as an environment variable.

$iagctl run service executable api-caller \
> --set endpoint=https://api.example.com \
> --set-secret name=api-token,type=env,target=API_TOKEN

Run an executable service with multiple arguments and a runtime secret

Runs an executable service with multiple arguments and a runtime secret.

$iagctl run service executable deployment-script \
> --set environment=production \
> --set region=us-east-1 \
> --set replicas=3 \
> --set-secret name=deploy-key,type=env,target=DEPLOY_KEY

Options

-h, --help help for executable
--set stringArray Input argument to pass into the script at runtime using key=value syntax.
If the service has a decorator, inputs must match what is defined in the
decorator. If no decorator is defined, you can pass any arguments.
--set-secret stringArray Secret to use during script execution. These are merged with or override
the secrets defined on the service.
--use Display the possible inputs of the script via the decorator.

Options inherited from parent commands

--config string Specify the path to the configuration file
--profile string Specify the client profile to use (case-insensitive, defaults to [client] section)
--raw Displays the result of the command in its raw format
--verbose Enable verbose output