Overview

An env0 plugin represents a composite set of commands that are executed as a single unit. In order to use an already implemented plugin, you need to add it to your version: 2 env0.yaml file.

Here's an example usage of the OPA plugin:

version: 2
deploy:
  steps:
    terraformPlan:
      after:
        - name: OPA
          use: https://github.com/env0/env0-opa-plugin
          inputs:
            path: bundle-file-path
            flags: --fail --format=raw
            query: data.example.violation[x]

How to create a new env0 Plugin

In order to create a new env0 plugin of yours, you must follow these guidelines:

  1. Create a new public Git repository.
  2. Add a new env0.plugin.yaml to it. This YAML file uses the following schema:
    1. name(Required) - the name of the plugin
    2. icon - A URL to the icon of the plugin.
    3. inputs - An object defining the expected inputs for your plugin. The inputs attribute has its own schema as well:
      1. inputs.<id> - The identifier of the input. Has to be unique.
      2. inputs.<id>.description - (Required) - A short description of the input.
      3. inputs.<id>.required - a boolean value that states whether this input is required or not.
    4. run - An object defining what the plugin executes. Currently, the plugin environment only supports bash runtime. In order to execute commands, you should use the run.exec attribute.
  3. Use it in an env0.yaml file.

Feel free to check out the implementation of the OPA and Checkov plugins as reference.

📘

The plugins location at runtime

As a plugin author, if you need the path to where your plugin resides, you can use the ENV0_PLUGIN_PATH env variable.