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

Plugin did not respond error

Open cherifsahraoui opened this issue 8 months ago • 2 comments

Terraform Version, Provider Version and Kubernetes Version

Terraform version: Terraform v1.5.7
Kubernetes provider version: v2.36.0
Kubernetes version: v1.32.2

Affected Resource(s)

  • kubernetes_manifest

Terraform Configuration Files

resource "kubernetes_manifest" "testkube-manifest" {
  manifest = {
    apiVersion = "testworkflows.testkube.io/v1"
    kind       = "TestWorkflow"
    metadata = {
      name      = "test"
      namespace = "testkube"
    }
    spec = {
      steps = [
        {
          name = "some-steps"
          execute = {
            workflows = [
              { name = "test1" },
              { name = "test2" }
            ]
          }
        }
      ]
    }
  }
}

Debug Output

Panic Output

│ Error: Plugin did not respond
│ 
│   with kubernetes_manifest.testkube-manifest,
│   on main.tf line 585, in resource "kubernetes_manifest" "testkube-manifest":
│  585: resource "kubernetes_manifest" "testkube-manifest" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).PlanResourceChange call. The plugin logs
│ may contain more details.
╵

Stack trace from the terraform-provider-kubernetes_v2.36.0_x5 plugin:

panic: ElementKeyInt(0): can't use tftypes.Object["artifacts":tftypes.Object["compress":tftypes.Object["name":tftypes.String], "paths":tftypes.List[tftypes.String], "workingDir":tftypes.String], "condition":tftypes.String, "container":tftypes.Object["args":tftypes.List[tftypes.String], "command":tftypes.List[tftypes.String], "env":tftypes.List[tftypes.Object["name":tftypes.String, "value":tftypes.String, "valueFrom":tftypes.Object["configMapKeyRef":tftypes.Object["key":tftypes.String, "name":tftypes.String, "optional":tftypes.Bool], "fieldRef":tftypes.Object["apiVersion":tftypes.String, "fieldPath":tftypes.String], "resourceFieldRef":tftypes.Object["containerName":tftypes.String, "divisor":tftypes.String...

goroutine 41 [running]:
github.com/hashicorp/terraform-plugin-go/tftypes.NewValue(...)
        github.com/hashicorp/[email protected]/tftypes/value.go:278
github.com/hashicorp/terraform-provider-kubernetes/manifest/morph.DeepUnknown({0x106e327f0, 0x140037ff440}, {{0x106e327f0?, 0x14002ed6de0?}, {0x1069c17c0?, 0x1400318db78?}}, 0x14003ab06a8)
        github.com/hashicorp/terraform-provider-kubernetes/manifest/morph/scaffold.go:86 +0x14d4
github.com/hashicorp/terraform-provider-kubernetes/manifest/morph.DeepUnknown({0x106e32360, 0x14002cbad80}, {{0x106e32360?, 0x14002ee4930?}, {0x106af4960?, 0x14002ec3a70?}}, 0x14003ab03c0)
        github.com/hashicorp/terraform-provider-kubernetes/manifest/morph/scaffold.go:33 +0x1780
github.com/hashicorp/terraform-provider-kubernetes/manifest/morph.DeepUnknown({0x106e32360, 0x14002ec30e0}, {{0x106e32360?, 0x14002efe6f0?}, {0x106af4960?, 0x14002ec3350?}}, 0x1400318dd40)
        github.com/hashicorp/terraform-provider-kubernetes/manifest/morph/scaffold.go:33 +0x1780
github.com/hashicorp/terraform-provider-kubernetes/manifest/provider.(*RawProviderServer).PlanResourceChange(0x1400070ae00, {0x106e29618, 0x14001f00990}, 0x14000e166e0)
        github.com/hashicorp/terraform-provider-kubernetes/manifest/provider/plan.go:395 +0x2e18
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).PlanResourceChange(0x1400070ad80, {0x106e29618?, 0x14001f00450?}, 0x14000e166e0)
        github.com/hashicorp/[email protected]/tf5muxserver/mux_server_PlanResourceChange.go:73 +0x250
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).PlanResourceChange(0x14000706140, {0x106e29618?, 0x14004285650?}, 0x14004128000)
        github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:826 +0x2c8
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_PlanResourceChange_Handler({0x106d8e6a0, 0x14000706140}, {0x106e29618, 0x14004285650}, 0x14002961f00, 0x0)
        github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:593 +0x1c0
google.golang.org/grpc.(*Server).processUnaryRPC(0x140008f4000, {0x106e29618, 0x14001ece840}, 0x14000a41980, 0x14000716f60, 0x107f0a620, 0x0)
        google.golang.org/[email protected]/server.go:1392 +0xc58
google.golang.org/grpc.(*Server).handleStream(0x140008f4000, {0x106e29b20, 0x14000f49380}, 0x14000a41980)
        google.golang.org/[email protected]/server.go:1802 +0x910
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/[email protected]/server.go:1030 +0x8c
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 31
        google.golang.org/[email protected]/server.go:1041 +0x13c

Error: The terraform-provider-kubernetes_v2.36.0_x5 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Steps to Reproduce

  1. terraform apply

Expected Behavior

What should have happened? Terraform should apply the kubernetes_manifest resource successfully.

Actual Behavior

What actually happened? Terraform produces the error above.

Important Factoids

The crash only happens when we have more than 1 elements in workflows[] However, when removing the second workflow (- name: "test2"), the issue disappears:

resource "kubernetes_manifest" "testkube-manifest" {
  manifest = {
    apiVersion = "testworkflows.testkube.io/v1"
    kind       = "TestWorkflow"
    metadata = {
      name      = "test"
      namespace = "testkube"
    }
    spec = {
      steps = [
        {
          name = "some-steps"
          execute = {
            workflows = [
              { name = "test1" },
            ]
          }
        }
      ]
    }
  }
}

References

Similar to:

  • GH-2663

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

cherifsahraoui avatar Mar 27 '25 13:03 cherifsahraoui

Facing similar issue when trying to create resource quota

resource "kubernetes_resource_quota_v1" "resource-quota" { metadata { name = "test-quota" namespace = "test-ns" } spec { hard = {
} } }

│ Error: Plugin did not respond │ 45: resource "kubernetes_resource_quota_v1" "resource-quota" { │ The plugin encountered an error, and failed to respond to the │ plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may │ contain more details.

Stack trace from the terraform-provider-kubernetes_v2.36.0_x5 plugin: panic: interface conversion: interface {} is nil, not map[string]interface {} goroutine 16 [running]: github.com/hashicorp/terraform-provider-kubernetes/kubernetes.expandResourceQuotaSpec({0xc00128c950, 0x1, 0x0?}) github.com/hashicorp/terraform-provider-kubernetes/kubernetes/structures.go:336 +0x2a5 github.com/hashicorp/terraform-provider-kubernetes/kubernetes.resourceKubernetesResourceQuotaV1Create({0x25ff6e0, 0xc00012c690}, 0xc00050cb80, {0x217d360, 0xc00020e380}) github.com/hashicorp/terraform-provider-kubernetes/kubernetes/resource_kubernetes_resource_quota_v1.go:118 +0x1ef github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc0006b4500, {0x25ff638, 0xc000c54930}, 0xc00050cb80, {0x217d360, 0xc00020e380}) github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:838 +0x119 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0006b4500, {0x25ff638, 0xc000c54930}, 0xc000c368f0, 0xc00050ca00, {0x217d360, 0xc00020e380}) github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:969 +0xa89 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0004662a0, {0x25ff638?, 0xc000c54870?}, 0xc00048c5a0) github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1188 +0xd5c github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ApplyResourceChange(0xc0004dc580, {0x25ff638?, 0xc000c545a0?}, 0xc00048c5a0) github.com/hashicorp/[email protected]/tf5muxserver/mux_server_ApplyResourceChange.go:36 +0x193 github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc000126320, {0x25ff638?, 0xc00065c930?}, 0xc00012c070) github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:866 +0x3d0 github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x21f3f60, 0xc000126320}, {0x25ff638, 0xc00065c930}, 0xc00050c180, 0x0) github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:611 +0x1a6 google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000ee600, {0x25ff638, 0xc00065c8d0}, 0xc000b85b00, 0xc0004cb5f0, 0x372f3f8, 0x0) google.golang.org/[email protected]/server.go:1392 +0xfd2 google.golang.org/grpc.(*Server).handleStream(0xc0000ee600, {0x25ffb40, 0xc000a7c000}, 0xc000b85b00) google.golang.org/[email protected]/server.go:1802 +0xbaa google.golang.org/[email protected]/server.go:1030 +0x8b created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 13

Error: The terraform-provider-kubernetes_v2.36.0_x5 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely helpful if you could report the crash with the plugin's maintainers so that it can be fixed. The output above should help diagnose the issue.

nbharti16 avatar Apr 11 '25 09:04 nbharti16

Also encountering this error when using "kubernetes_manifest" to create an argoproj.io/v1alpha1 ApplicationSet in EKS 1.32. Rolling the provider back to v2.29.0 fixed the issue, so it seems to have been introduced in v2.30.0.

resource "kubernetes_manifest" "applicationset" {
  manifest = {
    "apiVersion" = "argoproj.io/v1alpha1"
    "kind"       = "ApplicationSet"
    "metadata" = {
      "name"      = var.project_name
      "namespace" = var.argo_namespace
    }
    "spec" = {
      "goTemplate" = true
      "goTemplateOptions" = [
        "missingkey=error"
      ]
      "generators" = [
        {
          "list" = {
            # Commenting out the following line stops the crash
            "elements" = [for environment in var.environments : { "environment" = environment }]
          }
        }
      ]
      "template" = {
        ... # Truncated for size
      }
    }
  }
}

Let me know if you'd like my crash output - I omitted it since it's pretty long, and the test case from @cherifsahraoui seems like it should suffice.

calebmckay avatar Apr 22 '25 21:04 calebmckay

I had a similar issue with GKE and rolling back to 2.29.0 worked!

raphaelluchini avatar Jul 04 '25 22:07 raphaelluchini

Rolling back to 2.29.0 worked for me as well.

maateen avatar Sep 04 '25 09:09 maateen