digitalocean / terraform-provider-digitalocean

Terraform DigitalOcean provider
https://registry.terraform.io/providers/digitalocean/digitalocean/latest/docs
Mozilla Public License 2.0
510 stars 278 forks source link

digitalocean_kubernetes_cluster tags causing updates every time terraform apply #1250

Open joesonw opened 1 month ago

joesonw commented 1 month ago

Bug Report


Describe the bug

When there tags added to digitalocean_kubernetes_cluster resources, they are reconciled everytime. I suspected is because when the clusters are created, digitalocean attaches additional tags (k8s:worker, k8s:**) to the node pool. And it's different than what's specified in terraform resources, so it tries to update the tags every time

Affected Resource(s)

Expected Behavior

not updating digitalocean_kubernetes_cluster everytime applies

Actual Behavior

digitalocean_kubernetes_cluster is updating every time (tags)

Steps to Reproduce

provision a digitalocean_kubernetes_cluster resource with tags

Terraform Configuration Files

Terraform version

Terraform v1.9.7 on linux_amd64

Debug Output

Panic Output

Additional context

Important Factoids

References

andrewsomething commented 1 month ago

Hi @joesonw,

Thanks for reporting this issue. I have not been able to reproduce it. Would you be able to provide share your Terraform configuration or a sample that can demonstrate the problem?

jcassee commented 3 weeks ago

I think some extra tags are added automatically. Did you include something like this? (May interfere with the desire to be able to change those tags through Terraform.)

  lifecycle {
    # Ignore the tags/labels added by DigitalOcean
    ignore_changes = [
      tags, node_pool["labels"], node_pool["tags"]
    ]
  }
andrewsomething commented 3 weeks ago

There are some extra tags added automatically, but Terraform should be ignoring:

https://github.com/digitalocean/terraform-provider-digitalocean/blob/549f5e8ce78285fa35e52b70f6f4ef13193e0581/digitalocean/kubernetes/kubernetes.go#L364-L377