vmware / terraform-provider-tanzu-mission-control

Terraform provider to manage resources of Tanzu Mission Control
Mozilla Public License 2.0
37 stars 31 forks source link

Provision cluster from latest provider #104

Closed joelcomp1 closed 1 year ago

joelcomp1 commented 1 year ago

Describe the bug

With the new provider I can now successfully run this without the provider crashing but now when following the example for creating a AWS Cluster I always get this error:

Unable to create Tanzu Mission Control cluster entry, name : tkgm-aws-workload: POST request failed with status : 400 Bad Request, response: {"error":"invalid GetCredentialRequest.ProvisionerCred: embedded message failed validation | caused by: invalid FullName.Name: value must be a valid Tanzu name | caused by: a name cannot be empty or be longer than 63 characters","code":3,"message":"invalid GetCredentialRequest.ProvisionerCred: embedded message failed validation | caused by: invalid FullName.Name: value must be a valid Tanzu name | caused by: a name cannot be empty or be longer than 63 characters"}

Reproduction steps

  1. Follow guide here for AWS cluster: https://registry.terraform.io/providers/vmware/tanzu-mission-control/latest/docs/resources/cluster
  2. update management_cluster_name and provisioner_name for my config
  3. Get the above error

Expected behavior

Should provision cluster

Additional context

I was able to successfully use the data source to import an existing cluster I provisioned in Tanzu Mission Control so I believe my provider is setup correctly.

Vasundharashukla commented 1 year ago

Hi @joelcomp1 !

Apologies for the delay with the follow-up, I tried to create the workload cluster which got created perfectly. To me it seems to be more like an issue with your inputs for the provisioner name, can you please provide with the details of the full name of the cluster, cluster specs, endpoint and stack that you are using.

Meanwhile, I will check with the internal team to take a look into this.

bitsf commented 1 year ago

the validation is in TMC API entry, this mostly seems input problem or provider issue. BTW, the credential name is longer than 63, not the cluster name, maybe too long suffix is appended in provider.

image
bitsf commented 1 year ago

and what you mean update management_cluster_name and provisioner_name, what did you changed?

joelcomp1 commented 1 year ago

so I meant that i updated in the tanzu-mission-control_cluster resource the management_cluster_name and the provisioner_name to match up to what I did in Tanzu Mission Control. I was able to use the same vmw_cloud_api_token and endpoint configuration to import a existing cluster without issues though.

Vasundharashukla commented 1 year ago

@joelcomp1 in the provider, if you change the management_cluster_name or provisioner_name in your tf script, the provider will consider it as a new resource altogether and create another cluster with the new names and the previous one shall be destroyed. Regarding your issue, this seems to be that the specs under full name of the cluster don't have the correct values, either string is empty or too many characters/ special characters. Kindly check that and if that is correct, please provide with the values you are populating.

shreyassreenivas commented 1 year ago

@joelcomp1 , please reopen this issue if it is not addressed yet.