Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Import a manually attached cluster failing #401

Open
dsputnikk opened this issue May 16, 2024 · 0 comments
Open

Import a manually attached cluster failing #401

dsputnikk opened this issue May 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@dsputnikk
Copy link

dsputnikk commented May 16, 2024

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.

This doc

.. 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:
image

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

  1. Provision TKG cluster thru kubectl
  2. Manually attach to TMC
  3. Attempt to terraform import
  4. 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.

@dsputnikk dsputnikk added the bug Something isn't working label May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant