You like env0 because it can automate your IaC deployment process, but you also like your existing manual approval workflow through Jira or ServiceNow. With env0’s custom flow and API, we can easily integrate your manual approval workflow with env0’s IaC deployment workflow. This blog will show an example of approving the env0 deployment through your ticketing system.

In order to simplify this blog, we’ll start with a very simple ticketing system built on top of Zapier (note: Zapier Subscription with Premium apps is required).  

Code example can be found here.

First in Zapier, we’ll create a flow (use this link to make a copy) composed of two webhook stages and an approval stage. The first webhook stage will be our receiver, the endpoint which our custom flow will call in order to notify that a plan is complete.

We will also need to create an API key for Zapier to call env0 APIs. To create an API key, see our API reference docs. The API key will be used by the Webhook PUT action at the end of our Zapier workflow.

The API we’ll be using is the Resume Deployment endpoint. It takes the deployment ID as part of the path.

https://api.env0.com/environments/deployments/$ENV0_DEPLOYMENT_LOG_ID

This completes our Zapier setup. Next, we need to add a custom flow.

CUSTOM FLOW

The env0 Custom Flow allows us to add custom scripts at various stages of the deployment workflow. You can read more about it here.

In your env0 template, we will add a Custom Flow env0.yml, that will call the Zapier webhook after the Terraform Plan stage. The most important piece of information we need to send is the deployment ID. This will be used later after the manual approval process to resume (and approve) the deployment through the env0 API. Luckily for us, the deployment ID is easily referenced through the environment variable ENV0_DEPLOYMENT_LOG_ID.  Also, we are going to use an additional environment variable $ZAP_HOOK so that we can dynamically configure the endpoint in env0’s UI.

env0.yml
```yaml

version: 1
deploy:
 steps:
   terraformPlan:
     after:
       - echo "Request external approval"
       - curl --location --header "Content-Type:application/json" --request POST "$ZAP_HOOK" -d "{\"deployment\":\"$ENV0_DEPLOYMENT_LOG_ID\"}"
       - echo "To approve, visit https://tables.zapier.com/approval/inbox/id/3784"
```

We now have a 3rd party Manual Approval workflow system that can easily be adapted to your ticketing system. Check out this short gif of this Custom Flow in action.


You like env0 because it can automate your IaC deployment process, but you also like your existing manual approval workflow through Jira or ServiceNow. With env0’s custom flow and API, we can easily integrate your manual approval workflow with env0’s IaC deployment workflow. This blog will show an example of approving the env0 deployment through your ticketing system.

In order to simplify this blog, we’ll start with a very simple ticketing system built on top of Zapier (note: Zapier Subscription with Premium apps is required).  

Code example can be found here.

First in Zapier, we’ll create a flow (use this link to make a copy) composed of two webhook stages and an approval stage. The first webhook stage will be our receiver, the endpoint which our custom flow will call in order to notify that a plan is complete.

We will also need to create an API key for Zapier to call env0 APIs. To create an API key, see our API reference docs. The API key will be used by the Webhook PUT action at the end of our Zapier workflow.

The API we’ll be using is the Resume Deployment endpoint. It takes the deployment ID as part of the path.

https://api.env0.com/environments/deployments/$ENV0_DEPLOYMENT_LOG_ID

This completes our Zapier setup. Next, we need to add a custom flow.

CUSTOM FLOW

The env0 Custom Flow allows us to add custom scripts at various stages of the deployment workflow. You can read more about it here.

In your env0 template, we will add a Custom Flow env0.yml, that will call the Zapier webhook after the Terraform Plan stage. The most important piece of information we need to send is the deployment ID. This will be used later after the manual approval process to resume (and approve) the deployment through the env0 API. Luckily for us, the deployment ID is easily referenced through the environment variable ENV0_DEPLOYMENT_LOG_ID.  Also, we are going to use an additional environment variable $ZAP_HOOK so that we can dynamically configure the endpoint in env0’s UI.

env0.yml
```yaml

version: 1
deploy:
 steps:
   terraformPlan:
     after:
       - echo "Request external approval"
       - curl --location --header "Content-Type:application/json" --request POST "$ZAP_HOOK" -d "{\"deployment\":\"$ENV0_DEPLOYMENT_LOG_ID\"}"
       - echo "To approve, visit https://tables.zapier.com/approval/inbox/id/3784"
```

We now have a 3rd party Manual Approval workflow system that can easily be adapted to your ticketing system. Check out this short gif of this Custom Flow in action.


Logo Podcast
With special guest
Andrew Brown

Schedule a technical demo. See env0 in action.

CTA Illustration