-
Notifications
You must be signed in to change notification settings - Fork 626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix browser_cache_ttl page rule action bugs #379
Fix browser_cache_ttl page rule action bugs #379
Conversation
}) | ||
} | ||
|
||
func buildPageRule(actions string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's swap this one for a specific configuration setup (like we do for testAccCheckCloudflarePageRuleConfigMinify
). It's probably a bit more verbose but it will be explicit about what is getting setup.
Thanks for getting this up @stevehodgkiss! 🍰 I like the additional tests we've added here however a couple things we should update to align with the other tests.
|
} | ||
|
||
//################################################################# | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think changing the field to string is a good compromise, and in the end should not deal any major damage, provided Terraform uses strings implicitly everywhere in |
I think this is all the scenarios.
|
Looking great @stevehodgkiss! The only three test cases I think we're missing here is the ones for importing resources (one with a value of 0, one with a value of > 0 and one without the attribute entirely). Here is an example of another resource testing the import. Looking at the code, this should Just Work™ once the tests are added. I've run the integration tests on CI and in another couple of accounts and so far, 💚 all the way. |
…nally This warning was being emitted, and the main import test would fail if `browser_cache_ttl = 0` (or any value) was added. Error setting actions in page rule "8f8d71918b97a24ed742e037596b5e1c": actions.0.browser_cache_ttl: '' expected type 'string', got unconvertible type 'float64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is awesome work! thanks @stevehodgkiss 🍭
Big thanks @stevehodgkiss for helping out with this issue! Appreciated. |
* gofmt flarectl.go a no-op, which my editor picke up on. * pass cli context to writeTable ... so that ultimately writeTable, an internal function, will be able to support a different output type depending on the client options given. * support json output via --json ... for all outputs which were previously using writeTable
Addresses 2 issues with
browser_cache_ttl
due to0
being the default value and also a valid & desirable value to define it with.browser_cache_ttl
page rule action has been applied, it can't be deleted because its value is the default of0
when it's removed, so it ends up in the update PUT request as being set to0
.browser_cache_ttl = 0
initially doesn't work because it's not seen as a change (current workaround is to set to something else first, then 0).Using an integer for this value in the schema makes that quite challenging. Another option might be to make
-1
a special and default value used to mean "not set". The approach in this PR is to use a string instead.I'd like to take a closer look at some of the test cases before this merged (hence WIP in the title).