Env0

Env0 GitOps Workflow

Automated IaC deployments with GitOps triggers and drift detection.

Env0GitOpsDrift DetectionSlack

A reference implementation of GitOps-driven infrastructure using Env0. Push to a feature branch, and Env0 automatically runs a plan. Merge to main triggers apply. Environment drift is detected on a schedule and reported via Slack.

Updated 18 February 2026 Env0

Tech Stack

Env0Cloud
Terraform~> 1.7
GitLab CIWebhook trigger

Features

  • Branch-based plan on every merge request
  • Auto-apply on merge to main with approval gate
  • Scheduled drift detection every 6 hours
  • Slack notifications on plan diff and drift events
  • Environment TTL auto-destroy for ephemeral feature envs

How It Works

Env0 connects to the GitLab repository via webhook. Any push to a branch matching the `feature/*` pattern triggers a Terraform plan in an isolated environment. Reviewers approve the plan in the Env0 UI before apply runs.

Drift Detection

A cron-based policy runs `terraform plan` against the live state every 6 hours. If Env0 detects out-of-band changes, it fires a Slack alert with a diff summary and marks the environment as drifted in the dashboard.

Setup

Import the Env0 template from this repository. Set the `TF_VAR_slack_webhook` variable in the Env0 project settings. Optionally configure the TTL policy under Environment Settings → Auto-Destroy.

File Structure

  • env0.yaml
  • terraform/
    • main.tf
    • variables.tf
    • outputs.tf
  • policies/
    • approval-policy.json
    • drift-policy.json
  • notifications/
    • slack-template.json
  • README.md
GitLab (coming soon)