command-exists
Invicton-Labs/command-exists/external
A Terraform module that determines whether a given command is available on the CLI (Unixshell or Windows PowerShell).
Command Exists Determines whether a given command is available on the CLI (Linux shell or Windows PowerShell). During a terraform import, it will return null (since the external data source isn't run during an import). Usage: `` // Check if Git is installed and available module "command_exists" { source = "Invicton-Labs/command-exists/external" // The command to look for on Unix systems command_unix = "git" // The command to look for on Windows systems // This is technically not required because if only command_unix or command_windows is specified, // it will be used on both operating system types command_windows = "git" // Specify the working directory if the command is not installed system-wide working_dir = path.root // If Git isn't installed, fail Terraform so that nothing gets planned
| Name | Type | Description | Default |
|---|---|---|---|
| working_dir | string | The directory to check for the command in. Defaults to the module directory. | required |
| command_unix | string | The command to check for on unix-based systems. If not provided, the `command_wi | required |
| command_windows | string | The command to check for on Windows systems. If not provided, the `command_unix` | required |
| fail_if_command_missing | bool | Whether to fail the Terraform plan/apply if the given command isn't available. | false |
command_windows — The value of the `command_windows` input variable, or the default value if the input was `null`.command — The command that was tested (either the `command_unix` or `command_windows` input variable, dependinexists — Whether the given command exists.command_unix — The value of the `command_unix` input variable, or the default value if the input was `null`.