Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment environment variable map #74

Open
johnhoran opened this issue May 22, 2024 · 1 comment
Open

Deployment environment variable map #74

johnhoran opened this issue May 22, 2024 · 1 comment

Comments

@johnhoran
Copy link

I'd suggest that the environmental variables should be defined as a map instead of in a list. e.g. instead of

resource "astro_deployment" "hybrid" {
  environment_variables = [{
    key       = "key1"
    value     = "value1"
    is_secret = true
  }]
}

it would be

resource "astro_deployment" "hybrid" {
  environment_variables = {
    key1 = {
      value     = "value1"
      is_secret = true
    }
  }
}

There are two benefits to this, firstly keys need to be unique anyway, so defining them as a map instead of a list implicitly enforces this in terraform. However the primary reason is because we would then be able to utilize terraforms lifecycle.ignore_changes meta argument to ignore changes in certain attributes. e.g.

resource "astro_deployment" "hybrid" {
  environment_variables = {
    key1 = {
      value     = "value1"
      is_secret = true
    }
  }
  lifecycle {
    ignore_changes = [
      environment_variables["key2"]
    ]
  }
}

This is desirable for us because we have some environmental variables managed by our CICD pipeline, and others would be more suited to terraform. Terraform does support ignore_changes applied to array elements, however relying on the order of the variables feels fragile.

@vandyliu
Copy link
Collaborator

Hi @johnhoran

Thanks for the request.
This is actually quite a smart change and I think would benefit a lot of other people as well.
Not sure of the timeline of when this can be added but definitely will be!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants