1

这是我的规则

resource "cloudflare_page_rule" "https-only" {
    zone = "${var.domain}"
    target = "http://*${var.domain}/*"
    priority = 1

    actions = {
        always_use_https = true,
    }
}

always_use_https文档说默认值为false。我想为该区域的所有 http 流量启用此规则。

当我应用规则时,我收到此错误:

* cloudflare_page_rule.https-only: Failed to create page rule: error 
from makeRequest: HTTP status 400: content "
{\"success\":false,\"errors\":[{\"code\":1004,\"message\":\"Page Rule 
validation failed: See messages for details.\"}],\"messages\":
[{\"code\":1,\"message\":\".settings[0]: Invalid setting 
always_use_https\",\"type\":null}],\"result\":null}"

我尝试了诸如“on”之类的替代值,但它被拒绝了,因为 terraform 说该设置只接受布尔值。

如何使用 terraform 设置此规则?

4

2 回答 2

1

a 与其他一些区域覆盖设置也有同样的问题。对我有用的是进行完整的 terraform 销毁,升级到 cf 2.2.0 提供程序并进行应用。看起来旧版本的提供程序可能与执行某些区域覆盖功能的 api 不同步。

于 2019-12-21T17:11:57.047 回答
0

确保将域设置为使用 Cloudflare 的名称服务器。

于 2019-04-06T21:52:31.393 回答