1

I want to create a pagerule to ensure all the incoming http traffic will be converted to https

Here is my rule:

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

    actions = {
        always_use_https = true
    }
}

The target line is based on the example provided by terraform

enter image description here

However when I run the terraform file, I get this error

Error: resource 'cloudflare_page_rule.https-only' config: cannot contain self-reference self.domain

Is the example no longer valid? If so, what is the proper syntax?

Anthony Kong
  • 37,791
  • 46
  • 172
  • 304
  • That's never been valid. `self` is used on provisioners only AFAIK so it's odd that it's in the docs like that. Why not just re-use `${var.domain}` again? – ydaetskcoR Apr 19 '18 at 10:35

0 Answers0