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

Creating a computer account fails #60

Closed SLemonier closed 5 months ago

SLemonier commented 5 months ago

Dear all,

I tried to create a machine catalog using the provider and I face the following error: │ with citrix_machine_catalog.AAA-TF, │ on machine_catalog.tf line 1, in resource "citrix_machine_catalog" "AAA-TF": │ 1: resource "citrix_machine_catalog" "AAA-TF" { │ │ TransactionId: 4e2e6eab-a195-4091-9998-64a4447217f9 │ JobId: f5f8b338-9e11-4901-a351-a82ddb70ad7a │ Error message: Failed to create a computer account SDNE20001, due to an unknown error.

I successfully created a machine catalog manually with the same parameters.

May I ask you to check please?

Thanks, Steven

aneeshk-citrix commented 5 months ago

Hi @SLemonier,

From the logs, there seems be a problem authenticating to the domain. Can you make sure you are using the correct username and password and that the password hasn't expired.

Thanks, Aneesh

SLemonier commented 5 months ago

I am 100% sure, I used the same account to manually create the machine catalog.

aneeshk-citrix commented 5 months ago

@SLemonier What is the format of the input that you are passing in for the service_account? Please note that we only expect the username and not domain\username.

Thanks, Aneesh

SLemonier commented 5 months ago

Ah correct, I removed domain\ but now it failed with:

│ TransactionId: ce0ee8ba-9869-4122-9c41-4e63cce7e86b │ JobId: a0bd4666-a98c-4ad9-95f9-8501a17dc796 │ Error message: Failed to create the virtual machine; RCCAD\SDNE20002$.

aneeshk-citrix commented 5 months ago

@SLemonier,

The error I see is - You do not have access to a default security group in VPC vpc-05d0f96b3f84d67ee. Specify a security group, and try again.

Can you share your tf config for machine catalog? Specifically, we are looking for network_mapping.

SLemonier commented 5 months ago

I used this code for the network_mapping:

network_mapping = { network_device = "0" network = citrix_aws_hypervisor_resource_pool.NPRD-RIC-EUC-1A-TF.subnets[0] }

aneeshk-citrix commented 5 months ago

What is the value for network?

aneeshk-citrix commented 5 months ago

@SLemonier Can you also make sure the service account you provided to create the hypervisor has enough permissions to perform write operation on the security group for the VPC and VPC subnet you are using.

SLemonier commented 5 months ago

Here is the output before applying:

Of course the account has proper rights. It's the same that we used in in the wizard.

aneeshk-citrix commented 5 months ago

@SLemonier When you use Studio UI to create machine catalog, what do you choose in the Security section? Is it default or something else?

SLemonier commented 5 months ago

I use default choice: CleanShot 2024-04-16 at 14 05 21

aneeshk-citrix commented 5 months ago

Ok. We've found the issue. We do not have an input field for security group when creating an AWS machine catalog in the provider. However, It is an optional field for orchestration and when no value for security group is specified, it uses the default security group. In your case, the default security group does not show up and uses a custom security group (which is fw-citrix-nprd-eu).

We will work on adding this missing field.

Thanks, Aneesh