terraform-provider-kubernetes icon indicating copy to clipboard operation
terraform-provider-kubernetes copied to clipboard

Plugin crash while creating Kyverno policies

Open aukevanleeuwen opened this issue 11 months ago • 1 comments

Terraform Version, Provider Version and Kubernetes Version

Terraform version: v1.10.2
Kubernetes provider version: v2.30.0 through v2.35.0
Kubernetes version: v1.31.3

Affected Resource(s)

  • kubernetes_manifest

Terraform Configuration Files

I have a directory of plain Kubernetes manifests directly from the Kyverno policies Github here: https://github.com/kyverno/policies. For example the stuff in the best-practices directory. I want to apply all of the manifests I copy in this directory like this:

resource "helm_release" "kyverno-policies" {
  repository       = "https://kyverno.github.io/kyverno/"
  chart            = "kyverno"
  name             = "kyverno"
  namespace        = "kyverno"
  create_namespace = true
}

resource "kubernetes_manifest" "kyverno-policies" {
  for_each = fileset("${path.module}/../kyverno-policies-extra", "**/*.yaml")

  manifest = yamldecode(file("${path.module}/../kyverno-policies-extra/${each.value}"))
  depends_on = [helm_release.kyverno-policies]
}

Debug / Panic Output

Here is a gist to the output on standard error: https://gist.github.com/aukevanleeuwen/4787507bfb9b9e709294101f0b99102e

Panic Output

Same as above.

Steps to Reproduce

  1. Essentially this is just a terraform plan

Expected Behavior

What should have happened? It should have presented me with a plan.

Actual Behavior

It panic-ed.

Important Factoids

This works in v2.29.0!. Stops working in v2.30.0. I'm suspecting this change to be the culprit (since it's part of v2.30.0 and it tinkers with the code that is in the stacktrace of the panic): https://github.com/hashicorp/terraform-provider-kubernetes/commit/f83d63aca40ed9699bc79cdbcc95a7a2457f3f75. My Go foo really isn't good enough to understand why this would be happening though.

References

  • https://github.com/hashicorp/terraform-provider-kubernetes/issues/2487 seems to have similar errors, but different conditions?
  • https://github.com/hashicorp/terraform-provider-kubernetes/issues/2440 seems quite a 'polluted' issue to be honest, I don't think the initial crash is related to it, but the latest comments seem to be quite similar to what I'm describing above.

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

aukevanleeuwen avatar Dec 17 '24 14:12 aukevanleeuwen

Any updates on this one? Still happening in v2.35.0

skripted-io avatar May 03 '25 13:05 skripted-io