Unleash / terraform-provider-unleash

Terraform provider for unleash, the Open-source feature management solution
https://www.getunleash.io
Apache License 2.0
6 stars 1 forks source link

Support project envrionments for Enterprise instances #135

Open carlosjgp opened 2 months ago

carlosjgp commented 2 months ago

Describe the feature request

Each deployment of the application represents a new environment for us

Background

On Enterprise instances of Unleash you can create and name as many environments as you want

We would like to leverage this capacity to create a new environment for each of our customers who have dedicated environments and each might adopt feature or release at different cadences

Solution suggestions

data "unleash_project" "my_project" {
  id = "default"
}

resource "unleash_project_envrionment" "client_env" {
  project_id = data.unleash_project.my_project
  name       = "client 1"
  type       = "production"
}

I haven't use Enterprise for too long so I might be missing some properties very basic here

andreas-unleash commented 2 months ago

Hi @carlosjgp , thanks for your input. I will bring this to the team and get back to you.

gastonfournier commented 2 months ago

Hi @carlosjgp we added this to our backlog, it's not something that's on our top priority list. We're open for contributions though. I think I should write some contribution guidelines with more information on how to contribute, but overall:

  1. We expose the APIs we want to use in https://github.com/Unleash/unleash-server-api-go. It's an auto-generated client for a subset of all our APIs which is defined here: https://github.com/Unleash/unleash-server-api-go/blob/main/operations.yaml
  2. We code the Terraform resource. This is not easy, but can be done by using some of the existing ones.

One thing we try to do is to have 1 API call per resource so we don't have to deal with invalid state if an API call fails. Usually this means we have to create additional resources (e.g. one for the environment and another one for the project-environment link). We said we're going to create APIs in Unleash in case we want to have a specific Terraform resource that does both the creation and the linking (this would be step zero).

We haven't have the need for it yet and I'm not fully convinced is that simple (i.e. the environment should have a list of projects cause it had to be defined only once, or will the project have a list of environments? If the latter then the creation of the environment has to be conditional (or an upsert).

Anyway, this is open for contributions and we'll keep it in our backlog for now.