Git Product home page Git Product logo

env0-environment's Introduction

Description

The env0 module uses a 1:1 relationship, so for every environment there will be a corresponding template. This mirrors the way we build our code where each environment has it's own folder with it's own terraform code. In fact, Env0 requires that the template refers to actual code that we are going to run, so this 1:1 relationship is dictated by our architecture.

This module consumes an edited map of data generated from the global module via the data input. Two keys need to be injected in (one for the triggers and one for the path to the template) and the map needs to be filtered to relevant contexts. Triggers are required to be in glob format. I recommend adding an empty path key in the default context in quadpay-devops/terraform/modules/global/context.tf then adding keys in the relevant contexts like:

locals {
  //contexts are to be defined as <country>-<az slug>-<env>
  ctxt = {
    default              = {
      #..
      root-private-link-zones = ""
      #...
    }
    #...
    us-eastus-prd        = {
      #..
      root-private-link-zones = "terraform/environments/production/private-link-zones"
      #..
    }
    #...
  }
}

This populates the local.all map with everything you need to both find the code Env0 needs to run, and filter the environments. You can inject needed keys and filter by doing the following:

locals {
  all-private-link-zones = { for context, v in local.all : context =>
  merge(
      v,
      {
        env0-triggers = "+(${lookup(v, "root-private-link-zones", "")}/**)"
      },
      {
        env0-template-root = "${lookup(v, "root-private-link-zones", "")}"
      }
    )
    if length(lookup(v, "root-private-link-zones", "")) > 0
  }
}

module "private-link-zones" {
  source = "./modules/environment"
  providers = {
    env0 = env0
  }

  name-suffix = "private-link-zones"
  data        = local.all-private-link-zones
  github-id  = local.github-id
  repo       = module.global.repo

  terraform-version = "1.1.3"
}

Requirements

Name Version
terraform ~> 1.0.5
env0 0.0.22

Providers

Name Version
env0 0.0.22

Modules

No modules.

Resources

Name Type
env0_environment.example resource
env0_template.template resource
env0_template_project_assignment.assignment resource

Inputs

Name Description Type Default Required
data Map of data with triggers (env0-triggers) and root (env0-template-root) injected in map(any) n/a yes
github-id Env0 id for the Github repo for the template number n/a yes
name-suffix templates and environment names will have this appended to them like {each.key}- string n/a yes
repo url to the github repo ex: https://github.com/quadpay/quadpay-devops string n/a yes
revision git branch the code resides on string "master" no
terraform-version The version of terraform that should run your project. Not to be confused with the version of Terraform
that will build the Env0 project/template/environment/variables
string "1.0.5" no

Outputs

Name Description
environments n/a
templates n/a

env0-environment's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.