Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

panic: AttributeName("*"): can't use tftypes.DynamicPseudoType as tftypes.List #2052

Closed
niklasember opened this issue Mar 20, 2023 · 1 comment

Comments

@niklasember
Copy link

niklasember commented Mar 20, 2023

Terraform Version, Provider Version and Kubernetes Version

Terraform version: v1.4.2
Kubernetes provider version: v2.18.1
Kubernetes version: v1.26.1

Affected Resource(s)

kubernetes_manifest

Terraform Configuration Files

resource "kubernetes_manifest" "openebs_cstor_disk_pool_mirrored" {
  manifest = {
    "apiVersion" = "cstor.openebs.io/v1"
    "kind" = "CStorPoolCluster"
    "metadata" = {
      "name" = "cstor-disk-pool"
      "namespace" = "openebs"
    }
    "spec" = {
      "pools" = [
         for node, disk in local.disks_merged:
         {
           "dataRaidGroups" = [
             {
               "blockDevices" = [
                 for disk in disk[0]:
                 {
                   "blockDeviceName" = disk
                 }
               ]
             },
           ]
           "nodeSelector" = {
             "kubernetes.io/hostname" = node
           }
           "poolConfig" = {
             "dataRaidGroupType" = "mirror"
           }
         }
      ]
    }
  }
}

locals {
  disks = [
    for item in data.kubernetes_resources.openebs_blockstorage.objects:
    {disk: item.metadata.name, node: item.spec.nodeAttributes.nodeName}
  ]

  # Merge disks with the same node
  disks_merged = {
    for disk in data.kubernetes_resources.openebs_blockstorage.objects:
    disk.spec.nodeAttributes.nodeName => [
      for item in local.disks:
      item.disk if item.node == disk.spec.nodeAttributes.nodeName
    ]...
  }
}

Debug Output

Panic Output

│ Error: Plugin did not respond
│
│   with kubernetes_manifest.openebs_cstor_disk_pool_mirrored,
│   on cstor.tf line 1, in resource "kubernetes_manifest" "openebs_cstor_disk_pool_mirrored":
│    1: resource "kubernetes_manifest" "openebs_cstor_disk_pool_mirrored" {
│
│ 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.18.1_x5 plugin:

panic: AttributeName("pools"): can't use tftypes.DynamicPseudoType as tftypes.List[tftypes.Object["dataRaidGroups":tftypes.List[tftypes.Object["blockDevices":tftypes.List[tftypes.Object["blockDeviceName":tftypes.String, "capacity":tftypes.Number, "devLink":tftypes.String]]]], "nodeSelector":tftypes.Map[tftypes.String], "poolConfig":tftypes.Object["auxResources":tftypes.Object["limits":tftypes.Map[tftypes.String], "requests":tftypes.Map[tftypes.String]], "compression":tftypes.String, "dataRaidGroupType":tftypes.String, "priorityClassName":tftypes.String, "resources":tftypes.Object["limits":tftypes.Map[tftypes.String], "requests":tftypes.Map[tftypes.String]], "roThresholdLimit":tftypes.Number, "thickProvision":tftypes.Bool, "tolerations":tftypes.List[tftypes.Object["effect":tftypes.String, "key":tftypes.String, "operator":tftypes.String, "tolerationSeconds":tftypes.Number, "value":tftypes.String]], "writeCacheGroupType":tftypes.String], "writeCacheRaidGroups":tftypes.List[tftypes.Object["blockDevices":tftypes.List[tftypes.Object["blockDeviceName":tftypes.String, "capacity":tftypes.Number, "devLink":tftypes.String]]]]]]

goroutine 143 [running]:
github.com/hashicorp/terraform-plugin-go/tftypes.NewValue(...)
        github.com/hashicorp/terraform-plugin-go@v0.14.2/tftypes/value.go:273
github.com/hashicorp/terraform-provider-kubernetes/manifest/morph.DeepUnknown({0x22e2c38, 0xc001ea2210?}, {{0x22e2c38?, 0xc001f8e9c0?}, {0x1ce6840?, 0xc001f8e600?}}, 0xc002fa7db8)
        github.com/hashicorp/terraform-provider-kubernetes/manifest/morph/scaffold.go:38 +0x2179
github.com/hashicorp/terraform-provider-kubernetes/manifest/morph.DeepUnknown({0x22e2c38, 0xc001f7bb00?}, {{0x22e2c38?, 0xc001f8eed0?}, {0x1ce6840?, 0xc001f7bd70?}}, 0xc002fa79f8)
        github.com/hashicorp/terraform-provider-kubernetes/manifest/morph/scaffold.go:29 +0x1ebe
github.com/hashicorp/terraform-provider-kubernetes/manifest/provider.(*RawProviderServer).PlanResourceChange(0xc0010c4c00, {0x22dc7c0, 0xc001e6c180}, 0xc0002a9590)
        github.com/hashicorp/terraform-provider-kubernetes/manifest/provider/plan.go:366 +0x3994
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.muxServer.PlanResourceChange({0xc000b0a030, 0xc000b0a090, {0xc0011ce700, 0x2, 0x2}, 0xc000b0a060, 0xc000f289c0, 0xc0011961b0, 0xc000b0a0c0}, {0x22dc7c0, ...}, ...)
        github.com/hashicorp/terraform-plugin-mux@v0.7.0/tf5muxserver/mux_server_PlanResourceChange.go:27 +0x142
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).PlanResourceChange(0xc0002b8820, {0x22dc7c0?, 0xc001e618f0?}, 0xc000252e00)
        github.com/hashicorp/terraform-plugin-go@v0.14.2/tfprotov5/tf5server/server.go:783 +0x574
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_PlanResourceChange_Handler({0x1ebd7c0?, 0xc0002b8820}, {0x22dc7c0, 0xc001e618f0}, 0xc000252d90, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.14.2/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:367 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0009943c0, {0x22e3280, 0xc001286820}, 0xc001e24fc0, 0xc0012847b0, 0x31fbf88, 0x0)
        google.golang.org/grpc@v1.51.0/server.go:1340 +0xd23
google.golang.org/grpc.(*Server).handleStream(0xc0009943c0, {0x22e3280, 0xc001286820}, 0xc001e24fc0, 0x0)
        google.golang.org/grpc@v1.51.0/server.go:1713 +0xa2f
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        google.golang.org/grpc@v1.51.0/server.go:965 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.51.0/server.go:963 +0x28a

Error: The terraform-provider-kubernetes_v2.18.1_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

Expected Behavior

What should have happened?

Actual Behavior

What actually happened?

Important Factoids

Was able to create the resource last week with same config.

References

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
@BBBmau
Copy link
Contributor

BBBmau commented Mar 22, 2023

Hello! I'll be closing this issue since we just recently merged a PR that addresses this issue. #2055

@BBBmau BBBmau closed this as completed Mar 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

2 participants