cloudflare_ruleset
: Panic on import when serve_stale
action parameter is empty/nil
#4813
Closed
3 tasks done
Labels
kind/bug
Categorizes issue or PR as related to a bug.
triage/debug-log-attached
Indicates an issue or PR has a complete Terraform debug log.
Confirmation
Terraform and Cloudflare provider version
terraform -v
Terraform v1.10.2
on darwin_arm64
Affected resource(s)
cloudflare_ruleset
Terraform configuration files
Link to debug output
https://gist.github.com/guineveresaenger/af2fff842cfc94024aa707651293bdae
Panic output
Expected output
A successful import of the resource, or an error that
serve_stale
field cannot be nilActual output
Panic trying to dereference a nil pointer.
Steps to reproduce
This occurs when, on a cache ruleset, the
serve_stale
parameter is set to{}
. Not sure how the Rule got into this state originally, but you can force the issue like this:The following updates the Ruleset to have a new Description of "hello" (for quick verification) and setting "serve_stale" to an empty object on the cache rule.
terraform import cloudflare_ruleset.example zone/zone-id/-ruleset-id
in a stack with the above configuration.Additional factoids
This was first reported as a bug inherited by the pulumi-cloudflare provider. It's unclear how the Rule got into this state, but it's clearly possible via the API, and it should not panic.
References
https://developers.cloudflare.com/api/resources/rulesets/subresources/rules/methods/edit/ was helpful here for knowing what kind of permissions are needed to repro this.
The text was updated successfully, but these errors were encountered: