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

Transformation Errors after Upgrading #2636

Open
abuechler opened this issue Nov 27, 2024 · 0 comments
Open

Transformation Errors after Upgrading #2636

abuechler opened this issue Nov 27, 2024 · 0 comments
Labels

Comments

@abuechler
Copy link

We see an error when we upgrade the provider from 2.7.1 to 2.8.0 (or the latest version 2.34.0) on a kubernetes_manifest resource.

Terraform Version, Provider Version and Kubernetes Version

Terraform v1.9.8
on darwin_arm64
+ provider registry.terraform.io/hashicorp/google v6.4.0
+ provider registry.terraform.io/hashicorp/google-beta v6.4.0
+ provider registry.terraform.io/hashicorp/helm v2.15.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.34.0
+ provider registry.terraform.io/hashicorp/null v3.2.3
+ provider registry.terraform.io/hashicorp/random v3.6.3
Client Version: v1.30.4
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.30.5-gke.1014003

Affected Resource(s)

  • kubernetes_manifest

Terraform Configuration Files

resource "kubernetes_manifest" "cert_manager_issuer" {
  manifest = {
    apiVersion = "cert-manager.io/v1"
    kind       = "Issuer"
    metadata = {
      name      = "letsencrypt"
      namespace = kubernetes_namespace.cert_manager.metadata[0].name
    }
    spec = {
      acme = {
        email  = "[email protected]"
        server = "https://acme-v02.api.letsencrypt.org/directory"
        privateKeySecretRef = {
          name = "my-letsencrypt-key"
        }
        solvers = [
          {
            dns01 = {
              cloudDNS = {
                project = "abc-defgh-123456"
                serviceAccountSecretRef = {
                  name : "clouddns-sa-key"
                  key : "service-account.json"
                }
              }
            }
            selector = {
              dnsNames = [
                "mydomain.com",
                "*.mydomain.com",
              ]
            }
          },
          {
            dns01 = {
              cloudDNS = {
                project = var.project_id
                serviceAccountSecretRef = {
                  name : "clouddns-sa-key"
                  key : "service-account.json"
                }
              }
            }
          }
        ]
      }
    }
  }
  field_manager {
    force_conflicts = true
  }
  depends_on = [helm_release.cert_manager]
}

Steps to Reproduce

  1. Apply the manifest with kubernetes-provider 2.7.1
  2. Upgrade the provider to 2.8.0 (or even the latest version)
  3. Run terraform plan

Expected Behavior

There were no transformation errors with terraform-provider-kubernetes 2.7.1 so no errors expected with 2.8.0 or any other higher version.

Actual Behavior

Terraform fails with:

│ Error: Failed to transform List value into Tuple of different length
│
│   with module.dev-k8s.kubernetes_manifest.cert_manager_issuer,
│   on modules/kubernetes/certmanager.tf line 48, in resource "kubernetes_manifest" "cert_manager_issuer":
│   48: resource "kubernetes_manifest" "cert_manager_issuer" {
│
│ Error: %!s(<nil>)
│ ...at attribute:
│ spec.acme.solvers

Important Factoids

Some other stuff we tried out:

  • Delete the resource from the Terraform state
  • Upgrade the kubernetes provider
  • Import the resource => which failed with AttributeName("spec").AttributeName("acme").AttributeName("solvers")] failed to morph list into tuple (length mismatch)

References

There are some similar issues, don't know whether the underlying problem is the same.

@abuechler abuechler added the bug label Nov 27, 2024
@appilon appilon removed their assignment Nov 29, 2024
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

2 participants