terraform-provider-tanzu-mission-control
terraform-provider-tanzu-mission-control copied to clipboard
Import a manually attached cluster failing
Describe the bug
I have cut my teeth on Tanzu and I want to now automate provisioning of clusters via TMC's terraform provider. I understand how to create Terraform for a given resource, and I also understand the basics of Terraform importing.
I can successfully import a cluster I create manually thru TMC, but I have several "legacy" clusters that were attached manually.
.. specifically states that the import command is compromised of mgmt-cluster-name/provisioner_name/cluster_name.
The cluster I imported successfully which I provisioned thru TMC as a test is supervisor-name/vsphere-namespace/terraform-demo-cluster-1
terraform import tanzu-mission-control_tanzu_kubernetes_cluster.terraform-test-1 mgmt-supervisor/tanzu-simcheck/terraform-test-1
<--- Success
The clusters I've previously manually attached display (in the UI) mgmt-cluster-name = 'attached'
and provisioner_name = 'attached'
.
tkg-attached-cluster is an example of a cluster I've previously attached and has these displayed in the UI:
terraform import tanzu-mission-control_tanzu_kubernetes_cluster.attach_cluster_without_apply attached/attached/tkg-attached-cluster
<--- Fails
Results in:
tanzu-mission-control_tanzu_kubernetes_cluster.attach_cluster_without_apply: Importing from ID "attached/attached/tkg-attached-cluster"...
╷
│ Error: Couldn't import TKG cluster.
│ Management Cluster Name: attached, Provisioner: attached, Cluster Name: tkg-attached-cluster: get request(v1alpha1/managementclusters/attached/provisioners/attached/tanzukubernetesclusters/tkg-attached-cluster) failed with status : 404 Not Found, response: {"error":"cluster not found tkg-attached-cluster","code":5,"message":"cluster not found tkg-attached-cluster"}
tkg-attached-cluster definitely exists, I see it in the TMC Console.
Reproduction steps
- Provision TKG cluster thru kubectl
- Manually attach to TMC
- Attempt to terraform import
- Failure ...
Expected behavior
I expect a successful import like in the first example
Additional context
Importing a cluster from TMC is clearly documented/thought about, but is importing previously attached clusters not supported?
I would prefer not to have to reroll the clusters in order to bring them under Terraform control.