> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.itential.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server.

# iagctl create service executable

Create a new executable service.

Use this command to create an executable service. An executable service is a service type that runs scripts or applications using a pre-defined executable object. Executable services provide flexibility to run any type of script or tool, including Bash scripts, Terraform configurations, or custom applications.

For more information, see [Executable services](../executable-services-overview).

## Prerequisites

Before creating an executable service, you must [create an executable object](./create-executable-object) that points to the binary or interpreter used to run your executable. For more information, see [Create an executable object](../create-executable-object).

## Syntax

```
iagctl create service executable <service-name> --executable-object <string> [flags]
```

## Repository and file configuration

The `--repository` flag specifies which repository contains your executable file.

The `--filename` flag specifies the name of the executable file within the repository. The file must exist in the `--working-dir` if specified, otherwise it must be at the root of the repository.

The `--working-dir` flag is optional and specifies the path to the directory where the executable file exists, relative to the root of the repository.

## Argument formatting

The `--arg-format` flag controls how arguments are passed to your executable at runtime. The default format is `--{{.Key}} {{.Value}}`, which passes arguments as command-line flags. You can customize this to match your executable's expected input format:

* `--arg-format "--{{.Key}} {{.Value}}"` produces: `--name value`
* `--arg-format "{{.Key}}={{.Value}}"` produces: `name=value`
* `--arg-format "-{{.Key}} {{.Value}}"` produces: `-name value`

## Secrets

You can set secrets from Gateway's secret store on an executable service using the `--secret` flag. The flag value consists of three comma-separated parts:

* **Name** — The name of the secret
* **Type** — The type of secret to inject
* **Target** — The name of the environment variable to inject into the service

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

## Metadata

Use the `--env` flag to specify environment variables to apply at runtime.

Use the `--description` flag to provide a brief description of the service.

Use the `--tag` flag to associate metadata tags with the service for organization and categorization. Specify multiple tags by using the `--tag` flag multiple times.

## Examples

### Create a simple shell script service

Creates an executable service called `backup-script` that runs a bash script. This example assumes you've already created an executable object called `bash` that points to `/bin/bash`.

```bash
iagctl create service executable backup-script \
  --executable-object bash
```

### Create an executable service with a working directory

Creates an executable service where the executable file exists in a subdirectory of the repository.

```bash
iagctl create service executable network-config \
  --executable-object bash \
  --repository automation-repo \
  --working-dir network-scripts \
  --filename configure.sh
```

### Create an executable service with a custom argument format

Creates an executable service that passes arguments as `KEY=VALUE` pairs instead of the default `--KEY VALUE` format.

```bash
iagctl create service executable env-setup \
  --executable-object bash \
  --repository scripts-repo \
  --filename setup.sh \
  --arg-format "{{.Key}}={{.Value}}"
```

### Create an executable service with a decorator and secrets

Creates an executable service that uses a decorator for input validation and injects a secret as an environment variable.

```bash
iagctl create service executable api-caller \
  --executable-object bash \
  --repository scripts-repo \
  --filename call-api.sh \
  --decorator api-decorator \
  --secret name=api-token,type=env,target=API_TOKEN
```

### Create a complex executable service

Creates an executable service using multiple available options, including description, tags, working directory, decorator, and secrets.

```bash
iagctl create service executable database-backup \
  --executable-object bash \
  --repository automation-repo \
  --working-dir database-scripts \
  --filename backup-db.sh \
  --decorator backup-decorator \
  --description "Automated database backup script" \
  --tag backup \
  --tag database \
  --secret name=db-password,type=env,target=DB_PASSWORD
```

## Options

```
      --arg-format string          The format to pass arguments into an executable at runtime
                                   (default "--{{.Key}} {{.Value}}")
      --decorator string           The name of the decorator to associate with the service
      --description string         A brief description of the service
      --executable-object string   The name of the executable object resource that points to a specific
                                   executable file on execution nodes
      --filename string            The name of the executable service file in the repository. This file
                                   must exist in the working-dir
  -h, --help                       help for executable
      --repository string          The repository that contains the executable service
      --secret stringArray         Secret to inject into the service at runtime
      --tag stringArray            Metadata tag(s) to associate with the service
      --working-dir string         The path to the directory where the executable file exists. The path
                                   must be relative to the root of the repository
```

## 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
```