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

digitalocean_kubernetes_cluster tags causing updates every time terraform apply #1250

Open
joesonw opened this issue Oct 16, 2024 · 3 comments
Labels

Comments

@joesonw
Copy link

joesonw commented Oct 16, 2024

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)

  • digitalocean_kubernetes_cluster

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

  • provider registry.terraform.io/digitalocean/digitalocean v2.42.0

Debug Output

Panic Output

Additional context

Important Factoids

References

@joesonw joesonw added the bug label Oct 16, 2024
@andrewsomething
Copy link
Member

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
Copy link

jcassee commented Oct 30, 2024

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
Copy link
Member

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

// FilterTags filters tags to remove any automatically added to avoid state problems,
// these are tags starting with "k8s:" or named "k8s"
func FilterTags(tags []string) []string {
filteredTags := make([]string, 0)
for _, t := range tags {
if !strings.HasPrefix(t, "k8s:") &&
!strings.HasPrefix(t, "terraform:") &&
t != "k8s" {
filteredTags = append(filteredTags, t)
}
}
return filteredTags
}

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

No branches or pull requests

3 participants