tencentcloudstack / terraform-provider-tencentcloud

Terraform Tencent Cloud Provider
https://www.terraform.io/docs/providers/tencentcloud/
Mozilla Public License 2.0
191 stars 132 forks source link

tencentcloud_cdn_domain add support for cache configuration #560

Open jossy opened 3 years ago

jossy commented 3 years ago

For every non-trivial CDN distribution is seems essential that it's possible to configure caching rules. Is there any ETA when we can expect support for that?

gailwang commented 3 years ago

Hi, @jossy We have arranged a special version mainly to solve CDN issue (this cache rule feature is included), and it is expected to support in January

gailwang commented 3 years ago

@jossy the latest version(1.53.0) has supported rule_cache parameter. You can have a try with it, see if it meets the needs

jossy commented 3 years ago

@gailwang Support for this is a huge improvement, thank you!

However, I think cache_time shouldn't be a required setting. There are rules like this here, where a TTL doesn't make sense and can't even be configured in the UI:

tencent_cache_rules

In order to achieve the same result with the Terraform provider cache_time needs to be set to 2592000 which is IMHO very confusing. I can see that this number is returned by the API, but maybe it should be a default value then?

Currently, you have to do the following to come to the same result:

rule_cache {
  cache_time      = 2592000
  no_cache_switch = "on"
  rule_paths      = ["no max-age"]
  rule_type       = "default"
}
rule_cache {
  cache_time           = 2592000
  follow_origin_switch = "on"
  rule_paths           = ["*"]
  rule_type            = "all"
}