Import of TKC to TMC Terraform Plugin fails with error message:
terraform import tanzu-mission-control_tanzu_kubernetes_cluster.tkgs_cluster <MANAGEMENT_CLUSTER>/<NAMESPACE_NAME>/<CLUSTER_NAME>
tanzu-mission-control_tanzu_kubernetes_cluster.tkgs_cluster: Importing from ID "################################"...
╷
│ Error: Plugin did not respond
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ImportResourceState call. The plugin logs may contain more details.
╵
Stack trace from the terraform-name-of-clusterl_v1.4.5.exe plugin:
panic: interface conversion: interface {} is nil, not map[string]interface {}
goroutine 25 [running]:
github.com/vmware/terraform-name-of-cluster/internal/resources/tanzukubernetescluster.removeModelVariable({0x1704fe0?, 0xc000a91b30}, {0x1704fe0?, 0xc000b95fb0?})
github.com/vmware/terraform-name-of-cluster/internal/resources/tanzukubernetescluster/helper.go:464 +0x2c8
github.com/vmware/terraform-provider-tanzu-mission-control/internal/resources/tanzukubernetescluster.removeModelVariable({0x1704fe0?, 0xc000a916b0}, {0x1704fe0?, 0xc000b95e90?})
.
.
.
Error: The terraform-name-of-cluster_v1.4.5.exe 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.
==============================
Terraform import fails for the cluster class spec. The osImageRef does not have any additionalProperties although see labels does and it has a name field nested within it:
spec:
labels:
additionalProperties:
type: string
type: object
osImageRef:
type: object
x-kubernetes-preserve-unknown-fields: true
actual yaml for the cluster:
osImageRef:
name: ob-##########-photon-3-amd64-vmi-k8s-v#.##.#---vmware.2-tkg.1-zshippable
This causes the TF import code to fail because it expects that additionalProperties field or properties to exist when there is a nested object like osImageRef
This is fixed in release 1.4.6 Terraform provider