citrix / terraform-provider-citrix

Terraform provider for Citrix
Apache License 2.0
41 stars 5 forks source link

Inconsistent result observed with minimum_functional_level when updating the catalog image #52

Closed j7lloyd closed 3 months ago

j7lloyd commented 3 months ago

This only happens if the minimum_functional_level is set to any value other than "L7_20", as per the following error sample:

2024-03-27T10:31:24.168Z [ERROR] vertex "citrix_machine_catalog.MC09-AVDdaasCMP-009" error: Provider produced inconsistent result after apply
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to citrix_machine_catalog.MC09-AVDdaasCMP-009, provider "provider[\"citrix/citrix\"]" produced an unexpected new value: .minimum_functional_level: was cty.StringVal("L7_34"),    
│ but now cty.StringVal("L7_20").
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Looking at the code for the function updateCatalogImageAndMachineProfile (in the _machine_catalog_mcsutils.go file), I can see the value is indeed hardcoded:

710: updateProvisioningSchemeModel.SetMinimumFunctionalLevel("L7_20")

Which presumably needs replacing with something like this:

functionalLevel, err := citrixorchestration.NewFunctionalLevelFromValue(plan.MinimumFunctionalLevel.ValueString())
if err != nil {
    resp.Diagnostics.AddError(
        "Error updating Machine Catalog",
        fmt.Sprintf("Unsupported minimum functional level %s.", plan.MinimumFunctionalLevel.ValueString()),
    )
    return err
}
updateProvisioningSchemeModel.SetMinimumFunctionalLevel(*functionalLevel)
aneeshk-citrix commented 3 months ago

Hi @j7lloyd,

Thank you for bringing this up. We will have the fix in the next release.

Aneesh