cf-terraforming
cf-terraforming copied to clipboard
rate_limit action for js_challenge should not be putting timeout value in
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.6.3
Expected outcome
Use the below command to generate legitimate rate_limit configuration file: cf-terraforming generate --resource-type cloudflare_rate_limit --zone ${ZONE_ID} > rate_limit.tf
Actual outcome
When the below is used to generate rate_limit configuration and the action is either js_challenge or challenge, the timeout value is set to zero. cf-terraforming generate --resource-type cloudflare_rate_limit --zone ${ZONE_ID} > rate_limit.tf
... action { mode = "js_challenge" timeout = 0 } ...
The API reference guide says the below on timeout value (this value should not be supplied):
"min value:1
max value:86400
notes: If mode is challenge or js_challenge then the Zone Challenge Passage time is used and this value should not be supplied."
The zero value then causes terraform to error when issue terraform plan:
Error: expected action.0.timeout to be in the range (1 - 86400), got 0 with cloudflare_rate_limit.terraform_managed_resource_a76sdgyiufg7itfgqiytsfasdqwd, on rate_limit.tf line 65, in resource "cloudflare_rate_limit" "terraform_managed_resource_a76sdgyiufg7itfgqiytsfasdqwd": timeout = 0
The API does return the timeout value to be zero, however the API guide does say this value should not be supplied for js_challenge and challenge:
"threshold": 150,
"period": 600,
"action": {
"mode": "js_challenge",
"timeout": 0
}
Steps to reproduce
-
generate rate_limit resources where the action mode is js_challenge or challenge cf-terraforming generate --resource-type cloudflare_rate_limit --zone ${ZONE_ID} > rate_limit.tf
-
use this configuration file in terraform configuration and perform: terraform plan
References
No response
I do have the same problem. Thank you for flagging this error @gray1117