-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Bug Report: Provider sends UNSPECIFIED enum values (0) on cluster updates
PR 150 Created a PR for this fix, as it seems straightforward enough. Please reject if I am incorrect.
Description
The terraform-provider-qdrant-cloud sends gpu_type: 0 and restart_policy: 0 (UNSPECIFIED enum values) during cluster update operations, which the Qdrant Cloud API rejects with a validation error.
Environment
- Provider version:
v1.18.0 - Pulumi bridged provider:
pulumi_qdrant_cloud==1.18.0
Error
error: Invalid argument for cluster update [cluster-id]: invalid request: validation error:
- cluster.configuration.gpu_type: value must not be in list [0] (value: 0) [enum.not_in]
- cluster.configuration.restart_policy: value must not be in list [0] (value: 0) [enum.not_in]
Steps to Reproduce
- Create a cluster without specifying
gpu_typeorrestart_policy - Run
terraform apply(orpulumi up) again — even with no changes - Provider attempts an update and sends
gpu_type: 0,restart_policy: 0 - API rejects the request
Root Cause
PR #147 fixed the flatten (read) path to skip storing UNSPECIFIED values in state. However, the expand (write) path in expandClusterConfiguration() still accepts UNSPECIFIED as a valid enum:
// schemas_accounts_clusters.go:972-976
if v, ok := item[dbConfigGpuTypeFieldName]; ok {
gt, gtOK := qcCluster.ClusterConfigurationGpuType_value[v.(string)]
if gtOK { // ← "CLUSTER_CONFIGURATION_GPU_TYPE_UNSPECIFIED" passes this check
config.GpuType = newPointer(qcCluster.ClusterConfigurationGpuType(gt))
}
}Since ClusterConfigurationGpuType_value includes "CLUSTER_CONFIGURATION_GPU_TYPE_UNSPECIFIED": 0, the expand function sets GpuType to a pointer to 0 instead of leaving it nil.
Possible Fix (if helpful)
One approach might be to filter out UNSPECIFIED values in the expand path, similar to how PR #147 filters them in the flatten path:
if v, ok := item[dbConfigGpuTypeFieldName]; ok {
gt, gtOK := qcCluster.ClusterConfigurationGpuType_value[v.(string)]
if gtOK && gt != int32(qcCluster.ClusterConfigurationGpuType_CLUSTER_CONFIGURATION_GPU_TYPE_UNSPECIFIED) {
config.GpuType = newPointer(qcCluster.ClusterConfigurationGpuType(gt))
}
}The same pattern would apply to restart_policy and rebalance_strategy.
Submitted a PR that I believe will work to fix this.
Additional Context
- The update is triggered even when Pulumi/Terraform detects no diff (
[diff: ]is empty) - Using
ignore_changesonconfigurationdoes not prevent the issue - Clusters without GPU have no valid value to send — the field must be omitted entirely