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.
Prerequisites
Before creating an executable service, you must create an executable object that points to the binary or interpreter used to run your executable. For more information, see Create an executable object.
Syntax
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 IAG’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
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.
Create an executable service with a working directory
Creates an executable service where the executable file exists in a subdirectory of the repository.
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.
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.
Create a complex executable service
Creates an executable service using multiple available options, including description, tags, working directory, decorator, and secrets.