Description
clickhouse_service_scheduled_scaling: "inconsistent result after apply" for entries with idle_scaling = false
Description
clickhouse_service_scheduled_scaling cannot be applied for any entry with idle_scaling = false. terraform apply fails with "Provider produced inconsistent result after apply … does not correlate with any element in actual". Since disabled idle scaling is the common case for fixed-size scheduled windows, the resource is effectively unusable for those entries.
Cloud provider
AWS
Service tier
Not applicable
Affected resource(s)
clickhouse_service_scheduled_scaling
Provider version
3.18.0 (resource introduced in 3.17.0; affects all versions that ship it)
Terraform version
1.12.2
Terraform configuration
resource "clickhouse_service_scheduled_scaling" "reader" {
service_id = clickhouse_service.reader.id
entries = [
{
name = "Business Hours"
weekdays = [0, 1, 2, 3, 4, 5, 6]
start_hour_utc = 5
end_hour_utc = 19
min_replicas = 10
max_replicas = 10
min_replica_memory_gb = 236
max_replica_memory_gb = 236
idle_scaling = false
},
]
}
Expected behavior
The schedule is created and the apply completes cleanly, with the entry stored as written (idle_scaling = false).
Actual behavior
The API call succeeds, but the apply then aborts with a provider-consistency error:
Error: Provider produced inconsistent result after apply
When applying changes to clickhouse_service_scheduled_scaling.reader, provider
"provider[\"registry.terraform.io/clickhouse/clickhouse\"]" produced an unexpected
new value: .entries: planned set element cty.ObjectVal(map[string]cty.Value{
"end_hour_utc":cty.NumberIntVal(19), "idle_scaling":cty.False,
"idle_timeout_minutes":cty.NumberIntVal(5), "max_replica_memory_gb":cty.NumberIntVal(236),
"max_replicas":cty.NumberIntVal(10), "min_replica_memory_gb":cty.NumberIntVal(236),
"min_replicas":cty.NumberIntVal(10), "name":cty.StringVal("Business Hours"),
"start_hour_utc":cty.NumberIntVal(5), "weekdays":cty.SetVal([]cty.Value{...})})
does not correlate with any element in actual.
This is a bug in the provider, which should be reported in the provider's own
issue tracker.
The same happens whether idle_timeout_minutes is set or omitted. Retrying loops: a subsequent plan shows -/+ replacement because the failed apply leaves the resource tainted in state.
Additional context
Root cause (from reading the source at v3.18.0):
entries is a SetNestedAttribute whose nested fields are Optional + Computed. Two problems compound:
- Terraform correlates set elements by a hash of their contents. Any nested field left unset is
(known after apply) at plan time; a set element containing an unknown can't be hash-matched to a returned element → "does not correlate."
- For a non-idle entry the server does not echo the idle fields, and
apiEntryToModel maps them back with nil → null (boolPtrToValue / int64PtrToValue in pkg/resource/service_scheduled_scaling.go). So the applied element differs from the planned one (idle_scaling: false → null) even when every field is specified.
The existing round-trip test (TestRoundTrip_NoServerNormalization) doesn't catch this because it only exercises idle_scaling = true, where the server preserves the idle fields.
Likely fix: model entries as a ListNestedAttribute (lists correlate by index and tolerate Computed fields resolving after apply) and map a nil idle_scaling to an explicit false.
Cloud provider
AWS
Service tier
Production
Affected resource(s)
No response
Provider version
3.18.0
Terraform version
1.12.2
Terraform configuration
resource "clickhouse_service_scheduled_scaling" "reader" {
service_id = clickhouse_service.reader.id
entries = [
{
name = "Business Hours"
weekdays = [0, 1, 2, 3, 4, 5, 6]
start_hour_utc = 5
end_hour_utc = 19
min_replicas = 10
max_replicas = 10
min_replica_memory_gb = 236
max_replica_memory_gb = 236
idle_scaling = false
},
]
}
Expected behavior
Created correctly.
Actual behavior
Error: Provider produced inconsistent result after apply
When applying changes to clickhouse_service_scheduled_scaling.reader, provider
"provider["registry.terraform.io/clickhouse/clickhouse"]" produced an unexpected
new value: .entries: planned set element cty.ObjectVal(map[string]cty.Value{
"end_hour_utc":cty.NumberIntVal(19), "idle_scaling":cty.False,
"idle_timeout_minutes":cty.NumberIntVal(5), "max_replica_memory_gb":cty.NumberIntVal(236),
"max_replicas":cty.NumberIntVal(10), "min_replica_memory_gb":cty.NumberIntVal(236),
"min_replicas":cty.NumberIntVal(10), "name":cty.StringVal("Business Hours"),
"start_hour_utc":cty.NumberIntVal(5), "weekdays":cty.SetVal([]cty.Value{...})})
does not correlate with any element in actual.
This is a bug in the provider, which should be reported in the provider's own
issue tracker.
Additional context
No response
Description
clickhouse_service_scheduled_scaling: "inconsistent result after apply" for entries with idle_scaling = false
Description
clickhouse_service_scheduled_scalingcannot be applied for any entry withidle_scaling = false.terraform applyfails with "Provider produced inconsistent result after apply … does not correlate with any element in actual". Since disabled idle scaling is the common case for fixed-size scheduled windows, the resource is effectively unusable for those entries.Cloud provider
AWS
Service tier
Not applicable
Affected resource(s)
clickhouse_service_scheduled_scalingProvider version
3.18.0(resource introduced in 3.17.0; affects all versions that ship it)Terraform version
1.12.2Terraform configuration
Expected behavior
The schedule is created and the apply completes cleanly, with the entry stored as written (
idle_scaling = false).Actual behavior
The API call succeeds, but the apply then aborts with a provider-consistency error:
The same happens whether
idle_timeout_minutesis set or omitted. Retrying loops: a subsequent plan shows-/+ replacementbecause the failed apply leaves the resource tainted in state.Additional context
Root cause (from reading the source at
v3.18.0):entriesis aSetNestedAttributewhose nested fields areOptional + Computed. Two problems compound:(known after apply)at plan time; a set element containing an unknown can't be hash-matched to a returned element → "does not correlate."apiEntryToModelmaps them back withnil → null(boolPtrToValue/int64PtrToValueinpkg/resource/service_scheduled_scaling.go). So the applied element differs from the planned one (idle_scaling: false→null) even when every field is specified.The existing round-trip test (
TestRoundTrip_NoServerNormalization) doesn't catch this because it only exercisesidle_scaling = true, where the server preserves the idle fields.Likely fix: model
entriesas aListNestedAttribute(lists correlate by index and tolerate Computed fields resolving after apply) and map a nilidle_scalingto an explicitfalse.Cloud provider
AWS
Service tier
Production
Affected resource(s)
No response
Provider version
3.18.0
Terraform version
1.12.2
Terraform configuration
Expected behavior
Created correctly.
Actual behavior
Error: Provider produced inconsistent result after apply
When applying changes to clickhouse_service_scheduled_scaling.reader, provider
"provider["registry.terraform.io/clickhouse/clickhouse"]" produced an unexpected
new value: .entries: planned set element cty.ObjectVal(map[string]cty.Value{
"end_hour_utc":cty.NumberIntVal(19), "idle_scaling":cty.False,
"idle_timeout_minutes":cty.NumberIntVal(5), "max_replica_memory_gb":cty.NumberIntVal(236),
"max_replicas":cty.NumberIntVal(10), "min_replica_memory_gb":cty.NumberIntVal(236),
"min_replicas":cty.NumberIntVal(10), "name":cty.StringVal("Business Hours"),
"start_hour_utc":cty.NumberIntVal(5), "weekdays":cty.SetVal([]cty.Value{...})})
does not correlate with any element in actual.
This is a bug in the provider, which should be reported in the provider's own
issue tracker.
Additional context
No response