hashicorp / terraform-provider-kubernetes

Terraform Kubernetes provider

Home Page:https://www.terraform.io/docs/providers/kubernetes/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

resource_version not updated during apply, needs to reapply (with refresh enabled)

davidfischer-ch opened this issue · comments

When updating a ConfigMap and a Secret the field resourceVersion is updated accordingly.

So one can expect that the field metadata.0.resource_version is also changed (and reported as is).

However its not the case and we have to apply twice (multiple times) the configuration in order to chain updates from a resource using this field to another --> leading to a stable configuration. What we expect to be done in one apply.

Terraform Version, Provider Version and Kubernetes Version

Terraform version: v0.12.28
Kubernetes provider version: 1.11.3
OpenShift Master: v3.11.170
Kubernetes Master: v1.11.0+d4cacc0
OpenShift Web Console: v3.11.170

Affected Resource(s)

  • kubernetes_config_map
  • kubernetes_secret
  • ... (?)

Terraform Configuration Files

provider "kubernetes" {
  version              = "= 1.11.3"
  load_config_file = false
}

resource "kubernetes_config_map" "data" {
  metadata {
    name      = "data"
    namespace = var.namespace
    labels    = local.labels
  }

  data = {
    foo = "42"
  }
}

resource "kubernetes_secret" "secret" {
  metadata {
    name      = "secret"
    namespace = var.namespace
    labels    = local.labels
  }

  data = {
    bar = "11"
  }

  type = "Opaque"
}

output "data_version" {
    value = kubernetes_config_map.data.metadata.0.resource_version
}

output "secret_version" {
    value = kubernetes_secret.secret.metadata.0.resource_version
}

Steps to Reproduce

Apply configuration once.
Then update foo to 43 and bar to 12 and apply:

terraform apply
terraform apply
terraform apply

Expected Behavior

terraform apply  # changed (both config and output)
terraform apply  # no change
terraform apply  # no change

Actual Behavior

terraform apply  # changed (the config)
terraform apply  # changed (the output)
terraform apply  # no change

Important Factoids

None

References

None

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

I was able to replicate this both in v1.11.3 and v1.13.3

It seems that the issue is fixed with the provider at version 2.0.2 and Terraform v0.14.5 :)

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!