From ceca12d4f1e359e436471d62832a8aa997b28bf5 Mon Sep 17 00:00:00 2001 From: guineveresaenger Date: Fri, 20 Dec 2024 12:53:33 -0800 Subject: [PATCH 1/2] Add extra nil check on ServeStale.DisableStaleWhileUpdating --- internal/framework/service/rulesets/resource.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/framework/service/rulesets/resource.go b/internal/framework/service/rulesets/resource.go index 84902ef3dc..6de78078a0 100644 --- a/internal/framework/service/rulesets/resource.go +++ b/internal/framework/service/rulesets/resource.go @@ -623,9 +623,11 @@ func toRulesetResourceModel(ctx context.Context, zoneID, accountID basetypes.Str } if ruleResponse.ActionParameters.ServeStale != nil { - rule.ActionParameters[0].ServeStale = []*ActionParameterServeStaleModel{{ - DisableStaleWhileUpdating: types.BoolValue(*ruleResponse.ActionParameters.ServeStale.DisableStaleWhileUpdating), - }} + if ruleResponse.ActionParameters.ServeStale.DisableStaleWhileUpdating != nil { + rule.ActionParameters[0].ServeStale = []*ActionParameterServeStaleModel{{ + DisableStaleWhileUpdating: types.BoolValue(*ruleResponse.ActionParameters.ServeStale.DisableStaleWhileUpdating), + }} + } } if ruleResponse.ActionParameters.FromList != nil { From ff0305abcfe02dbb6d26785cf4dcbb25f3f30743 Mon Sep 17 00:00:00 2001 From: Jacob Bednarz Date: Thu, 26 Dec 2024 13:39:09 +1100 Subject: [PATCH 2/2] add changelog entry --- .changelog/4814.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/4814.txt diff --git a/.changelog/4814.txt b/.changelog/4814.txt new file mode 100644 index 0000000000..d037303bca --- /dev/null +++ b/.changelog/4814.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/cloudflare_ruleset: handle when `disable_stale_while_updating` is an empty object but not nil +```