citrix / terraform-provider-citrix

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

[Bug] Error during Hypervisor Resource Pool creation #126

Open Xufuru opened 5 days ago

Xufuru commented 5 days ago

In the new version of the provider (1.0.3), as it was in the old version (1.0.1, 1.0.1-bugfix-1 and 1.0.1-bugfix-2 ), I'm having trouble creating the Hypervisor Resource Pool. The error appened random when i launch the code (by random i means, if i run the code 5 times, the error could appear in the first run and after disappear, and could return in the fourth run), this is the error:

��� Error: Error creating Hypervisor Resource Pool for Azure ��� ��� with module.vdr["VDR-TEST1"].module.citrix.citrix_azure_hypervisor_resource_pool.azure-hypervisor-resource-pool, ��� on modules/citrix/main.tf line 13, in resource "citrix_azure_hypervisor_resource_pool" "azure-hypervisor-resource-pool": ��� 13: resource "citrix_azure_hypervisor_resource_pool" "azure-hypervisor-resource-pool" { ��� ��� TransactionId: 78a0e868-dde7-4e6c-aca7-05c858822481 ��� Failed to resolve virtual network vnt-itn-tecp-001-VDR-TEST1 in region ��� Italy North, error: could not find resource

This is my terraform code for the resource:

resource "citrix_azure_hypervisor_resource_pool" "azure-hypervisor-resource-pool" { name = upper("RP-AZ-NI-TECS-P-${var.vdr_name}") hypervisor = local.azure_hypervisor_id region = var.location virtual_network_resource_group = var.resource_group_vdr virtual_network = var.virtual_network subnets = [var.subnet_vdi] }

For more clearnce, the vnet specified in the error exist and i can see it in my azure portal.

zhuolun-citrix commented 5 days ago

Hi @Xufuru ,

Can you consistently reproduce this issue?

Xufuru commented 5 days ago

Yes, it happens, at least, every time i launch my code in a new workspace of terraform and randomly if i delete the resources using terraform-destroy and after that using terraform plan and apply.

zhuolun-citrix commented 5 days ago

OK so when you run it for the first time in a new terraform workspace, it will consistently fail?

Xufuru commented 5 days ago

From the tests done so far, it would seem so.

zhuolun-citrix commented 5 days ago

Is it possible that you share the total time for the first run on a fresh terraform workspace? You can check terraform output for the [{time} elapsed] to get the total time that the first apply took if it fails.

zhuolun-citrix commented 3 days ago

Hi @Xufuru ,

Any update on this?