Skip to content

Commit

Permalink
Merge pull request #4814 from guineveresaenger/fix-nil-dereference-se…
Browse files Browse the repository at this point in the history
…rvestale
  • Loading branch information
jacobbednarz authored Dec 26, 2024
2 parents 1ef0bed + ff0305a commit b45c0b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .changelog/4814.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/cloudflare_ruleset: handle when `disable_stale_while_updating` is an empty object but not nil
```
8 changes: 5 additions & 3 deletions internal/framework/service/rulesets/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b45c0b9

Please sign in to comment.