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

crash when set multi env config in manifest

Open nnsay opened this issue 1 year ago • 1 comments

Terraform Version, Provider Version and Kubernetes Version

Terraform version: v1.5.7
Kubernetes provider version: v2.30.0
Kubernetes version: v1.29.2

Affected Resource(s)

  • kubernetes_manifest
  • knative serving

Terraform Configuration Files

terraform {
  backend "local" {}
  required_providers {
    kubernetes = {
      source  = "hashicorp/kubernetes"
      version = "2.30.0"
    }
  }
}

provider "kubernetes" {
  config_path = "~/.kube/config"
}


resource "kubernetes_manifest" "demo_service" {
  manifest = {
    "apiVersion" = "serving.knative.dev/v1"
    "kind"       = "Service"
    "metadata" = {
      "labels" = {
        "networking.knative.dev/visibility" = "cluster-local"
      }
      "name"      = "busybox-service"
      "namespace" = "default"
    }
    "spec" = {
      "template" = {
        "metadata" = {
          "annotations" = {
            "autoscaling.knative.dev/target" = "10"
          }
          "labels" = {
            "app" = "busybox-service"
          }
        }
        "spec" = {
          "containerConcurrency" = 10
          "containers" = [
            {
              "env" = [
                {
                  "name" = "WEATHERFILE_S3"
                  "valueFrom" = {
                    "secretKeyRef" = {
                      "key"  = "WEATHER_FILES_S3"
                      "name" = "bucket-name"
                    }
                  }
                },
                {
                  "name" = "PROJECT_REPORT_S3"
                  "valueFrom" = {
                    "secretKeyRef" = {
                      "key"  = "PROJECT_REPORT_DATA_S3"
                      "name" = "bucket-name"
                    }
                  }
                }
              ]
              "image" = "busybox:latest"
              "name"  = "busybox"
              "ports" = [
                {
                  "containerPort" = 3000
                }
              ]
              "readinessProbe" = {
                "httpGet" = {
                  "path" = "/health"
                  "port" = 3000
                }
                "initialDelaySeconds" = 3
              }
            }
          ]
        }
      }
    }
  }
}

Debug Output

https://gist.github.com/nnsay/56673a736926f51960e0d0f537798a34

Panic Output

https://gist.github.com/nnsay/6cb8f990444703b1709547be0fea9d6f

Steps to Reproduce

terraform plan

Expected Behavior

output the new resource should be created

Actual Behavior

error and crash

Important Factoids

if only set the one env item, the plan command is ok.

References

no

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

nnsay avatar Jun 11 '24 03:06 nnsay

I got the same crash and error, when also using kubernetes_manifest resource. The crash is also happening on version 2.31.0

The temporary solution that worked for me, it was downgrading to 2.29.

g-sponda avatar Jun 19 '24 15:06 g-sponda

Marking this issue as stale due to inactivity. If this issue receives no comments in the next 30 days it will automatically be closed. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. This helps our maintainers find and focus on the active issues. Maintainers may also remove the stale label at their discretion. Thank you!

github-actions[bot] avatar Oct 11 '25 00:10 github-actions[bot]