cf-terraforming icon indicating copy to clipboard operation
cf-terraforming copied to clipboard

cloudflare_rate_limit is incorrectly being generated for zone_id and timeout

Open wesleykirkland opened this issue 3 years ago • 0 comments

Confirmation

  • [X] My issue isn't already found on the issue tracker.
  • [X] I have replicated my issue using the latest version of the library and it is still present.

cf-terraforming version

0.8.4

Expected outcome

Side note, 0.8.4 is the latest available via brew.

When generate cloudflare_rate_limit resources, wherever the api returns a timeout = 0 value this is incorrectly generated in the code. As described here the timeout is optional. The Cloudflare API is returning 0 for something that is optional, the generating provider should recongize this and omit it from generating it in the action block.

In addition it does not add the zone_id parameter.

Actual outcome

resource "cloudflare_rate_limit" "terraform_managed_resource_REDACTED" { description = "description" disabled = true period = 60 threshold = 5 action { mode = "challenge" timeout = 0 } match { request { methods = ["ALL"] schemes = ["ALL"] url_pattern = "mywebsite.com*" } response { headers = [ { name = "Cf-Cache-Status" op = "ne" value = "HIT" } ] origin_traffic = true } } }

Steps to reproduce

Run cf-terraforming cf-terraforming generate --resource-type "cloudflare_rate_limit" --zone "zoneid" --account "accountid" > cf_rate_limit.tf

References

This is a half duplicate of https://github.com/cloudflare/cf-terraforming/issues/362 which is open with no feedback on a much older version and this issue also mentions the zone_id.

wesleykirkland avatar Nov 28 '22 20:11 wesleykirkland