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

bug - variable set defined in env0_project, shows as something drifted to env0_environment #895

Closed
away168 opened this issue Jul 10, 2024 · 0 comments · Fixed by #889
Closed
Labels
bug Something isn't working

Comments

@away168
Copy link
Contributor

away168 commented Jul 10, 2024

Describe the bug
A variable set defined in the project layer - is showing as a variable set that should be removed in env0_environment.

To Reproduce
create a variable_set and assign it to the project.
create an env0_environment in the same project.
run the deployment that uses env0_environment multiple times.

  # env0_environment.default_projects will be updated in-place
  ~ resource "env0_environment" "default_projects" {
        id                               = "f29bfdca-1a77-49dd-b197-f2f0c4913a99"
        name                             = "Skunkworks Project"
      ~ variable_sets                    = [
          - "69cfcac0-5135-4967-a9d5-c6166f216f4c",
        ]
        # (13 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Expected behavior
No Drift Message.

Provider Version
1.19.1

Screenshots
n/a

Additional context
Sample Code:

resource "env0_api_key" "mgmt" {
  name = "control plane"
}

resource "env0_variable_set" "env0_keys" {
  name        = "Control-ENV0_API_KEY"
  description = "mgmt api key - control plane org api key"
  scope       = "project"
  scope_id    = data.env0_environment.this.project_id

  variable {
    name  = "ENV0_API_KEY"
    value = env0_api_key.mgmt.api_key_id
    type  = "environment"
  }

  variable {
    name         = "ENV0_API_SECRET"
    value        = env0_api_key.mgmt.api_key_secret
    type         = "environment"
    is_sensitive = true
  }
}

resource "env0_variable_set_assignment" "env0_keys" {
  scope    = "project"
  scope_id = var.project_id
  set_ids  = [env0_variable_set.env0_keys.id]
}

resource "env0_environment" "default_projects" {
  name                       = "${var.default_team_name} Project"
  project_id                 = var.project_id
  template_id                = env0_template.projects.id
  approve_plan_automatically = true
  is_remote_backend          = true
  removal_strategy           = "mark_as_archived"
  workspace                  = "${var.default_team_name}_project"

}
@away168 away168 added the bug Something isn't working label Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant