Chris' Corner - March 2023

env0

Posted by Chris Noon on Wed, Mar 1, 2023

Note: This is a copy of my env0 post.

Introduction

The development within the env0 platform is fantastic, one of the many reasons I love working here. The features come thick and fast and this is the motivation behind this monthly blog, to highlight the latest features and showcase Chris’ favorites.

If you want to keep up to date with the features as they are released, follow the changelog.

So far in 2023, we’ve released the following features:

This month’s highlighted feature will be Project Level Custom Flows.

What’s the problem?

env0 originally had the custom flow feature restricted to per environment. This meant any time you wanted multiple environments to run through plugin checks with agents such as OPA, TFlint, CheckOV, etc you would have to present the code in each environment folder.

Not only is this time-consuming, but it means any updates to the plugin checks may not be pushed to all relevant environments creating logistical or security concerns.

We listened to our customers and prioritized the highlighted feature to remove these pain points with Custom Flows defined for all environments within a Project.

How does env0 solve the problem?

We now have the ability to set plugin checks at the Project level, which then applies to all environments within that project. This can be extremely useful in several scenarios, a key one to mention is having an application project or sub-project. All application deployments will then be subjected to the relevant checks defined by the user and/or the business.

The documentation to set up the project-level custom flows can be found here:

https://docs.env0.com/docs/project-level-custom-flow

It’s also relevant to mention that env0 has two methods of integrating third-party tools. Either writing a script that is consumed at the custom flow level or using our native plugin feature.

New Feature

This can be easily enabled by navigating to the Project Settings within the chosen Project. Select the POLICIES tab and press configure under the Custom Flow section.

Project Settings

Select the VCS, in this example, I’m using GitHub. Populate the Repository, Branch, and Custom Flow File Path. Take note that the path doesn’t end at a directory, but the specific .yml or .yaml file.

Configure Custom Flow

Once you applied the configuration, ensure you enable the check box, Apply custom flow to all environments in the project.

Custom Flow

This will make sure any new deployments in the Project will be subject to this check.

Custom Flow Apply

If you’re a little lost, don’t worry, follow along with the video below that integrates an OPA check into our Application Projects.

https://vimeo.com/804066385

 1Code
 2<code>
 3version: 2
 4deploy:
 5 steps:
 6   terraformPlan:
 7     after:
 8       - name: Generate plan output
 9         run: terraform show -json .tf-plan > tf-plan.json
10       - name: Running OPA check
11         use: https://github.com/env0/env0-opa-plugin
12         inputs:
13           path: ${ENV0_ROOT_DIR}/integrations/opa/rego
14           flags: --input tf-plan.json --fail-defined --format=raw
15           query: data.terraform.validation.violations[msg]
16</code>
17‍```
18
19Thanks for reading! If you have any questions you can reach out to Chris on [LinkedIn](https://www.linkedin.com/in/chrisgrahamnoon/), or [schedule a demo](https://www.env0.com/demo-request) with the Sales Engineering Team.