Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Error creating vsphere citrix_machine_catalog #135

Open
jsiguenzacle opened this issue Oct 5, 2024 · 7 comments
Open

[Bug] Error creating vsphere citrix_machine_catalog #135

jsiguenzacle opened this issue Oct 5, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@jsiguenzacle
Copy link

Describe the bug

When trying to create a citrix_machine_catalog resource in vsphere on premise infraestructure
I get this error

...
citrix_machine_catalog.vsphere-mcatalog: Still creating... [3m40s elapsed]
citrix_machine_catalog.vsphere-mcatalog: Still creating... [3m50s elapsed]
citrix_machine_catalog.vsphere-mcatalog: Still creating... [4m0s elapsed]

│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to citrix_machine_catalog.vsphere-mcatalog, provider "provider[\"registry.terraform.io/citrix/citrix\"]" produced an unexpected new value: .provisioning_scheme: inconsistent values for 
│ sensitive attribute.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

After having the error, resources appear created correctly in citrix cloud portal

Terraform command (import, apply, etc):
Resource impacted:

resource citrix_machine_catalog vsphere-mcatalog {
    zone      = data.external.GetZoneID.result.ZoneID
    name      = "mctest" 
    description       = "Maquinas test terrafom-vmware-tc"
    allocation_type   = "Random"
    session_support   = "MultiSession"
    provisioning_type = "MCS"

    provisioning_scheme         = {
        hypervisor                = data.external.GetHypervisorID.result.HypervisorID # sacamos las IDs en el Module
        hypervisor_resource_pool  = data.external.GetHypResPoolID.result.HypResPoolID
        identity_type   = "ActiveDirectory"
        machine_domain_identity = {
          domain          = "domain.foo" # "<DomainFQDN>"
          service_account = "adminDOMJoin" 
          service_account_password = "xxxxxxxx" 
          domain_ou       = "OU=Server,DC=domain,DC=foo"
        }
        vsphere_machine_config = {
          master_image_vm = "Masters.resourcepool\\server-mstr0-psp" 
          image_snapshot  = "snap_0000/snap_0001"
          cpu_count       = 2
          memory_mb       = 4096
        }
        number_of_total_machines = 0
        machine_account_creation_rules = {
          naming_scheme      = "tst2-ccloud-##"
          naming_scheme_type = "Numeric"
        }
    }
}

Versions

Terraform: v1.9.5
citrix/citrix provider: v1.0.4
Operation system: windows_amd64

@jsiguenzacle jsiguenzacle added the bug Something isn't working label Oct 5, 2024
@yashbhokare-citrix
Copy link
Contributor

Hi @jsiguenzacle,

Can you please attach the Terraform logs for this issue? You can get the logs by following these steps: Terraform Log File Instructions.

Additionally, can you set provisioning_scheme.identity_type = "Workgroup" and remove provisioning_scheme.machine_domain_identity? I'm hoping that will let Terraform print all of the inconsistencies.

Thanks,
Yash Bhokare

@jsiguenzacle
Copy link
Author

Hi @yashbhokare-citrix,
here you have attached both logs, with DOMAIN and WORKGROUP information.
Using Workgroup I get this final message,

citrix_machine_catalog.vsphere-mcatalog: Still creating... [4m40s elapsed]
citrix_machine_catalog.vsphere-mcatalog: Still creating... [4m50s elapsed]
citrix_machine_catalog.vsphere-mcatalog: Still creating... [5m0s elapsed]
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to citrix_machine_catalog.vsphere-mcatalog, provider "provider[\"registry.terraform.io/citrix/citrix\"]" produced an unexpected new value: .provisioning_scheme.vsphere_machine_config.master_image_vm:   
│ was cty.StringVal("Masters.resourcepool\\reda-mstr0-psp"), but now cty.StringVal("Masters.resourcepool").
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to citrix_machine_catalog.vsphere-mcatalog, provider "provider[\"registry.terraform.io/citrix/citrix\"]" produced an unexpected new value: .provisioning_scheme.vsphere_machine_config.image_snapshot:    
│ was cty.StringVal("SWO_CU3_02102023/reda-mstr0-psp_NuevosDDCs_16112023"), but now cty.StringVal("reda-mstr0-psp.vm/SWO_CU3_02102023/reda-mstr0-psp_NuevosDDCs_16112023").
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker. 

In both cases the machine catalog seems to be correctly created in citrix cloud portal

image

citrix-provider-issue_DOMAIN.txt
citrix-provider-issue_WORKGROUP.txt

Thank you very much
jsiguenzacle

@yashbhokare-citrix
Copy link
Contributor

Hi @jsiguenzacle,

Looks like the resource pool name was also passed with the image vm name in master_image_vm. Can you try rerunning it while specifying only the image vm name for vsphere_machine_config.master_image_vm ?

Example: master_image_vm = "server-mstr0-psp"

Thanks,
Yash Bhokare

@jsiguenzacle
Copy link
Author

Hi @yashbhokare-citrix,
using only vm name master_image_vm = "reda-mstr0-psp" does not find the vm

╷
│ Error: Error getting Hypervisor resources
│
│   with citrix_machine_catalog.vsphere-mcatalog,
│   on main.tf line 35, in resource "citrix_machine_catalog" "vsphere-mcatalog":
│   35: resource citrix_machine_catalog vsphere-mcatalog {
│
│ TransactionId: eaaca0d7-e3cf-4ede-a445-279e53e37d2f
│ JobId: 92d15f03-131d-48d6-b82e-262d78238e87
│ Error message: Cannot find path 'XDHyp:\HostingUnits\VSAN_TresCantos_respool_00\reda-mstr0-psp.vm\SWO_CU3_02102023.snapshot' because it does not exist.
╵

Using the value master_image_vm = "Masters.resourcepool\\reda-mstr0-psp" I get the initial error
image

The master image information I get via powershell command get-provscheme -ProvisioningSchemeUid xxxxxxx of the catalog created with the initial terraform configuration is :
ProvisioningSchemeName : mctest
MasterImageVM : XDHyp:\HostingUnits\VSAN_TresCantos_respool_00\Masters.resourcepool\reda-mstr0-psp.vm\SWO_CU3_02102023.snapshot\reda-mstr0-psp_NuevosDDCs_16112023.snapshot

the same info I get when creating the machine catalog manually through citrix cloud portal :
ProvisioningSchemeName : mctest_manual
MasterImageVM : XDHyp:\HostingUnits\VSAN_TresCantos_respool_00\Masters.resourcepool\reda-mstr0-psp.vm\SWO_CU3_02102023.snapshot\reda-mstr0-psp_NuevosDDCs_16112023.snapshot

Thank you very much
jsiguenzacle

@aneeshk-citrix
Copy link
Collaborator

aneeshk-citrix commented Oct 11, 2024

Hi @jsiguenzacle,

Looks like we're making some incorrect assumptions that's resulting in inconsistent values in provider even after the Machine Catalog seems to be provisioned.

I have a few questions:

  1. Can you show a screenshot of the Studio UI of the step where you select a master image? I'm attaching a screenshot of what I'm expecting. I'm trying to understand if the master image has a folder structure.
    image

  2. I see that you posted a screenshot of the provisioned catalog. I see that there are no machines. Did you intend to create a machine catalog with 0 machines?

Thanks,
Aneesh

@aneeshk-citrix
Copy link
Collaborator

aneeshk-citrix commented Oct 11, 2024

Hi @jsiguenzacle,

We were able to figure out the issue. We weren't taking the folder structure into consideration. We're working on a fix for this.
Thanks again for reporting and providing the needed info.

Aneesh

@jsiguenzacle
Copy link
Author

Hi @aneeshk-citrix ,

Thank you very much for the effort !!
Anyway, I'll answer your questions in case it helps you.

  1. This is what I see through the Studio UI, there you have the vm (reda-mstr0-psp) in the resource pool (Masters) with two snapshots (SWO_CU3_02102023/reda-mstr0-psp_NuevosDDCs_16112023).
    image
    Using this code is the only way I found to get the vm with its snapshots:
          master_image_vm = "Masters.resourcepool\\reda-mstr0-psp" 
          image_snapshot  = "SWO_CU3_02102023/reda-mstr0-psp_NuevosDDCs_16112023"
  1. I use number_of_total_machines=0 just to be a bit quicker in my testing, with for example number_of_total_machines=1 I get the new VM created OK and working in vmware and it appears in its required OU.

Thank you again !
jsiguenzacle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants