https://rancher.com/ logo
Title
b

brainy-minister-91634

09/28/2022, 12:10 PM
hi all, am running terraform with rancher2 provider 1.24.1 trying to get the cluster id through a rancher_cluster resource however I am having 422 error code with the details of fieldname=Cluster name, code=notUnique
q

quick-sandwich-76600

09/28/2022, 5:30 PM
Hi, Terraform resources are used to create objects so what you are getting is really an error because there's already a cluster with that name. If you want to retrieve information from an existing object (like the ID of an existing cluster), you should use a data source: https://registry.terraform.io/providers/rancher/rancher2/latest/docs/data-sources/cluster
b

brainy-minister-91634

09/28/2022, 6:14 PM
ok, that makes sense and sort it out my issue. Thanks
­čĹŹ 1