rancher / terraform-provider-rancher2

Terraform Rancher2 provider
https://www.terraform.io/docs/providers/rancher2/
Mozilla Public License 2.0
263 stars 228 forks source link

Cannot create a "import existing" cluster via `rancher2_cluster_v2` #955

Open alankan-finocomp opened 2 years ago

alankan-finocomp commented 2 years ago

There is an example for creating an "imported" cluster via rancher2_cluster but not in rancher2_cluster_v2.

Since kubernetes_version is mandatory in rancher2_cluster_v2, I tried

resource "rancher2_cluster_v2" "empty_string" {
  name               = "empty_string"
  kubernetes_version = ""
}

However, if I create an "import existing" cluster via GUI like this: image The manual one gui-created looks different from the one created by Terraform, most importantly, without error KubernetesVersion not set on fleet-default/empty-string.

I tried ignoring that and run the registration command in downstream cluster and eventually no luck. I also tried reversely loading the gui-created one as Terraform resource and found the kubernetes_version = null which it's impossible to be mimicked...

Any advice? Thank you very much in advance :bow:

next0262 commented 1 year ago

I think the "imported" cluster created via rancher2_cluster (like below) is able to import rke2 cluster.

resource "rancher2_cluster" "foo-imported" {
  name = "foo-imported"
  description = "Foo rancher2 imported cluster"
}

Why do you need that in rancher2_cluster_v2???