@@ -256,6 +256,53 @@ func TestAccCloudflareZoneSetting_Ciphers(t *testing.T) {
256
256
})
257
257
}
258
258
259
+ // Regression test for https://github.com/cloudflare/terraform-provider-cloudflare/issues/5795
260
+ // where certain zone settings have inconsistent "editable" values between plan and apply
261
+ func TestAccCloudflareZoneSetting_EditableInconsistency (t * testing.T ) {
262
+ zoneID := os .Getenv ("CLOUDFLARE_ZONE_ID" )
263
+
264
+ // Test the problematic settings that have editable inconsistency issues
265
+ problematicSettings := []struct {
266
+ settingID string
267
+ value string
268
+ }{
269
+ {"advanced_ddos" , "on" },
270
+ {"http2" , "on" },
271
+ {"long_lived_grpc" , "on" },
272
+ {"origin_error_page_pass_thru" , "on" },
273
+ {"prefetch_preload" , "on" },
274
+ {"proxy_read_timeout" , "300" },
275
+ {"response_buffering" , "on" },
276
+ {"sort_query_string_for_cache" , "on" },
277
+ {"true_client_ip_header" , "on" },
278
+ }
279
+
280
+ for _ , setting := range problematicSettings {
281
+ t .Run (setting .settingID , func (t * testing.T ) {
282
+ rnd := utils .GenerateRandomResourceName ()
283
+ resourceName := fmt .Sprintf ("cloudflare_zone_setting.%s" , rnd )
284
+
285
+ valueCheck := knownvalue .StringExact (setting .value )
286
+
287
+ resource .Test (t , resource.TestCase {
288
+ PreCheck : func () { acctest .TestAccPreCheck (t ) },
289
+ ProtoV6ProviderFactories : acctest .TestAccProtoV6ProviderFactories ,
290
+ CheckDestroy : testAccCheckCloudflareZoneSettingDestroy ,
291
+ Steps : []resource.TestStep {
292
+ {
293
+ Config : testCloudflareZoneSettingEditableInconsistency (rnd , zoneID , setting .settingID , setting .value ),
294
+ ConfigStateChecks : []statecheck.StateCheck {
295
+ statecheck .ExpectKnownValue (resourceName , tfjsonpath .New (consts .ZoneIDSchemaKey ), knownvalue .StringExact (zoneID )),
296
+ statecheck .ExpectKnownValue (resourceName , tfjsonpath .New ("setting_id" ), knownvalue .StringExact (setting .settingID )),
297
+ statecheck .ExpectKnownValue (resourceName , tfjsonpath .New ("value" ), valueCheck ),
298
+ },
299
+ },
300
+ },
301
+ })
302
+ })
303
+ }
304
+ }
305
+
259
306
func testCloudflareZoneSettingConfigOnOff (resourceID , zoneID string ) string {
260
307
return acctest .LoadTestCase ("on_off.tf" , resourceID , zoneID )
261
308
}
@@ -288,6 +335,10 @@ func testCloudflareZoneSettingConfigCiphers(resourceID, zoneID string) string {
288
335
return acctest .LoadTestCase ("ciphers.tf" , resourceID , zoneID )
289
336
}
290
337
338
+ func testCloudflareZoneSettingEditableInconsistency (resourceID , zoneID , settingID , value string ) string {
339
+ return acctest .LoadTestCase ("editable_inconsistency.tf" , resourceID , zoneID , settingID , value )
340
+ }
341
+
291
342
func testAccCheckCloudflareZoneSettingDestroy (s * terraform.State ) error {
292
343
client := acctest .SharedClient ()
293
344
0 commit comments