citrix / terraform-provider-citrix

Terraform Provider for Citrix
https://registry.terraform.io/providers/citrix/citrix/latest
Apache License 2.0
46 stars 6 forks source link

[ERROR] - Cannot create azure_hypervisor #80

Closed Xufuru closed 3 months ago

Xufuru commented 4 months ago

I'm trying to create using terrakube an azure_hypervisor for citrix cloud (Daas). The resource cannot be created and in return i have this error: ��� ��� Error: Error creating Hypervisor ��� ��� with module.vdr["vdr1"].module.citrix.citrix_azure_hypervisor.azure-hypervisor, ��� on modules/citrix/main.tf line 22, in resource "citrix_azure_hypervisor" "azure-hypervisor": ��� 22: resource "citrix_azure_hypervisor" "azure-hypervisor" { ��� ��� TransactionId: a6474466-e9e7-4adc-b2ab-b22f5883c3bf ��� JobId: 4354068b-4993-44cc-aa29-8b91a7198a9e ��� Error message: Connection: Failed || Error: Object does not exist. ���

For clarification i use this provider:

Azure Hypervisor

resource "citrix_azure_hypervisor" "example-azure-hypervisor" { name = "example-azure-hypervisor" zone = "" active_directory_id = "" subscription_id = "" application_secret = "" application_id = "" }

FYI: I use the correct value in to the code.

Hope for a quick response, thanks in advace for the support.

zhuolun-citrix commented 4 months ago

Hi @Xufuru ,

Thank you for reporting this issue. Are you creating hypervisor for a Citrix Cloud customer, or an CVAD on-premises customer?

If you are using a Citrix Cloud customer, could you please provide the region you are in?

Zhuolun

zhuolun-citrix commented 4 months ago

Hi @Xufuru ,

We looked into the transaction ID you shared in the description and was able to find the failed job. Looks like the zone that you specified for creating the hypervisor cannot be found for the customer.

Please make sure that the zone ID you specified for the hypervisor is correct, and has cloud connectors created and powered on for the resource location behind the zone.

Thank you, Zhuolun

Xufuru commented 4 months ago

What I am trying to do is automate the entire process of creating Citrix objects using Terrakube. In fact, I create the resource location with Terrakube and then subsequently the hypervisor and the hypervisor resource pool. In the Zone field, I use the value of the resource location ID, but from the documentation, it is not clear what value I need to pass other than the resource location ID. Could you provide support with the steps I need to take to create these resources?

zhuolun-citrix commented 4 months ago

Resource Location and Zone are two separate and different resources, although they are interconnected in a certain way. Zone has a different ID from Resource Location ID.

In order to use the Zone that comes from a Resource Location, you need to do one of following options:

  1. Extract the Zone ID and use it as plaintext value in the citrix_azure_hypervisor.zone field, or any other resource's zone field.
  2. You can import the zone into a citrix_zone resource with the same name and description specified in terraform and run terraform apply, which will import the zone into state. You can then specify citrix_zone.{zone resource name}.id in the zone field of other resources.

Unfortunately there's no way to directly plumb through from Resource Location to Hypervisor yet. We will improve our provider to better support this use case.

Please let me know if you need more help with this issue.

Thanks, Zhuolun

Xufuru commented 4 months ago

Correct me if i’m wrong: in order to use the zone resource, from the documentation i see that i need to install te cloud connector inside the resource location. There is a way, which i can pass the zone id without using a cloud connector first ?

aneeshk-citrix commented 4 months ago

Hi @Xufuru,

You can define a zone resource in your tf for the existing zone (a corresponding zone is automatically created for a CC Resource Location) that you created . For hypervisor, pass the zone ID instead of the resource location ID. You should be able to create hypervisor and resource pool without connectors. However, if you need to create a Domain Joined Machine Catalog, you will need to have connectors installed for your zone (CC Resource Location).

We will take this issue as a bug to update documentation for zone and as @zhuolun-citrix mentioned, to update provider to make use of zone/resource location less ambiguous.

Aneesh

zhuolun-citrix commented 3 months ago

Hi @Xufuru ,

We have implemented a new change on zones for Citrix Cloud customers in the new release #92 . Please try using the new version according to the docs and see if it help clear the confusing / fuzziness in the cloud zone workflow.

If you find new issues in the new release, please report by opening a new GitHub Issue.

Thank you, Zhuolun