microsoft / terraform-provider-azuredevops

Terraform Azure DevOps provider
https://www.terraform.io/docs/providers/azuredevops/
MIT License
387 stars 280 forks source link

Change azuredevops_variable_group's "variable" from type "Set" to type "TypeList" #137

Open DamonStamper opened 4 years ago

DamonStamper commented 4 years ago

Community Note

Description

This is the 4th issue I've opened today so I think I'm going to "back off" after this for a little before I drive you wonderful folks mad. I love where this provider is headed!

I feel like this is an edge case so I don't expect this to be implemented anytime soon. My use case is that I have my ADO Pipelines update variable groups to track what is currently released. Thus an external actor changes the values of the variables. I'd like to use TF to be able to spin up the variable groups (each application gets its own pipeline and "ArtifactTracter_APP" variable group) but ignore changes to the variable's values.

When trying to set the below I get an error.

resource "azuredevops_variable_group" "ArtifactTracker_APP" {
  project_id   = azuredevops_project.project.id
  name         = "ArtifactTracker_APP"
  description  = "Variables that are specific to the application being built."
  allow_access = true

  variable {
    name  = "Production_Image"
    value = ""
  }

  variable {
    name  = "Production_Image_Minus_1"
    value = ""
  }
  lifecycle {
    ignore_changes = [
      variable.0.value,
      variable.1.value,
    ]
  }
}

The error:

Block type "variable" is represented by a set of objects, and set elements do
not have addressable keys. To find elements matching specific criteria, use a
"for" expression with an "if" clause.

New or Affected Resource(s)

References

Similar issue but for a different provider:

petero-dk commented 6 months ago

My problem is that my variables are linked to a keyvault, and for some reason even though there are no changes, TF plan wants to recreate them.