Closed bryanhorstmann closed 7 months ago
@bryanhorstmann can you instead turn it to type = list(object(blah blah))
and make a complex object type to represent what the provider expects? See here https://developer.hashicorp.com/terraform/language/expressions/type-constraints#optional-object-type-attributes
@bryanhorstmann can you instead turn it to
type = list(object(blah blah))
and make a complex object type to represent what the provider expects? See here https://developer.hashicorp.com/terraform/language/expressions/type-constraints#optional-object-type-attributes
@kevcube, I did start down this path, but then ran into a minor stumbling block. The cloudflare provider is not always clear on type. See https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/page_rule#actions. I can make an educated guess for all of them. eg all *_ttl
should be int.
I'd need to increase the required version of Terraform to > 1.3.0
in order to support the optional()
fields.
I've also just run into this same issue with firewall_rules
. Happy to extend this change to include them as well.
@kevcube, I did start down this path, but then ran into a minor stumbling block. The cloudflare provider is not always clear on type. See https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/page_rule#actions. I can make an educated guess for all of them. eg all
*_ttl
should be int.
Yeah I think educated guess is good. They look descriptive enough to guess most or all.
I'd need to increase the required version of Terraform to
> 1.3.0
in order to support theoptional()
fields.
No problem
I've also just run into this same issue with
firewall_rules
. Happy to extend this change to include them as well.
👍
Hey @kevcube, PR has been updated as requested. I've done the following:
page_rules
objectfirewall_rules
object> 1.3.0
in order to use optional()
in the object spec.docs/terraform.md
still needs to be updated. I can see they're generated with terraform-docs but I'm not sure if this is meant to be done manually or the CI will handle this.
/terratest
@bryanhorstmann see failing tests
This pull request now has conflicts. Could you fix it @bryanhorstmann? 🙏
This PR has been closed due to inactivity and merge conflicts. Please resolve the conflicts and reopen if necessary.
Thanks @bryanhorstmann for creating this pull request!
A maintainer will review your changes shortly. Please don't be discouraged if it takes a while.
While you wait, make sure to review our contributor guidelines.
[!TIP]
Need help or want to ask for a PR review to be expedited?
Join us on Slack in the
#pr-reviews
channel.
what
Change the type of the
page_rules
variable fromlist(any)
toany
. See https://github.com/hashicorp/terraform/issues/26265 for more information on why this is happeningwhy
When creating a list of page rules where some rules contain any of
cache_ttl_by_status
,forwarding_url
,minify
orcache_key_fields
but others do not you receive the following error:Steps to reproduce: