diff --git a/.changelog/11083.txt b/.changelog/11083.txt new file mode 100644 index 0000000000..a52ef3c769 --- /dev/null +++ b/.changelog/11083.txt @@ -0,0 +1,3 @@ +```release-note:bug +compute: fixed a bug preventing the creation of `google_compute_autoscaler` and `google_compute_region_autoscaler` resources if both `maxReplicas` and `minReplicas` were configured as zero. +``` \ No newline at end of file diff --git a/google-beta/services/compute/resource_compute_autoscaler.go b/google-beta/services/compute/resource_compute_autoscaler.go index 68339ad6a1..b33c06ff21 100644 --- a/google-beta/services/compute/resource_compute_autoscaler.go +++ b/google-beta/services/compute/resource_compute_autoscaler.go @@ -1222,7 +1222,7 @@ func expandComputeAutoscalerAutoscalingPolicy(v interface{}, d tpgresource.Terra transformedMaxReplicas, err := expandComputeAutoscalerAutoscalingPolicyMaxReplicas(original["max_replicas"], d, config) if err != nil { return nil, err - } else if val := reflect.ValueOf(transformedMaxReplicas); val.IsValid() && !tpgresource.IsEmptyValue(val) { + } else { transformed["maxNumReplicas"] = transformedMaxReplicas } diff --git a/google-beta/services/compute/resource_compute_region_autoscaler.go b/google-beta/services/compute/resource_compute_region_autoscaler.go index 33a80f5602..921a06a77b 100644 --- a/google-beta/services/compute/resource_compute_region_autoscaler.go +++ b/google-beta/services/compute/resource_compute_region_autoscaler.go @@ -1217,7 +1217,7 @@ func expandComputeRegionAutoscalerAutoscalingPolicy(v interface{}, d tpgresource transformedMaxReplicas, err := expandComputeRegionAutoscalerAutoscalingPolicyMaxReplicas(original["max_replicas"], d, config) if err != nil { return nil, err - } else if val := reflect.ValueOf(transformedMaxReplicas); val.IsValid() && !tpgresource.IsEmptyValue(val) { + } else { transformed["maxNumReplicas"] = transformedMaxReplicas }