terraform-provider-cloudflare icon indicating copy to clipboard operation
terraform-provider-cloudflare copied to clipboard

cloudflare_page_rule: Unsupported argument `smart_errors`

Open alex-feel opened this issue 2 years ago • 5 comments

Confirmation

  • [X] My issue isn't already found on the issue tracker.
  • [X] I have replicated my issue using the latest version of the provider and it is still present.

Terraform and Cloudflare provider version

Terraform v1.1.7 on windows_amd64

  • provider registry.terraform.io/cloudflare/cloudflare v3.11.0

Affected resource(s)

  • cloudflare_page_rule

Terraform configuration files

terraform {
  required_version = ">= 0.15.0"

  required_providers {
    cloudflare = {
      source  = "cloudflare/cloudflare"
      version = ">= 3.11.0"
    }
  }
}

variable "cloudflare_api_token" {
  type      = string
  sensitive = true
}

provider "cloudflare" {
  api_token = var.cloudflare_api_token
}

resource "cloudflare_zone" "acme_com" {
  zone = "acme.com"
}

resource "cloudflare_page_rule" "page" {
  zone_id = cloudflare_zone.acme_com.id
  target  = "acme.com"

  actions {
    smart_errors = "on"
  }
}

Debug output

$ terraform plan
2022-04-01T21:46:22.738+0300 [INFO]  Terraform version: 1.1.7
2022-04-01T21:46:22.760+0300 [INFO]  Go runtime version: go1.17.2                                                                             
2022-04-01T21:46:22.760+0300 [INFO]  CLI args: []string{"C:\\Program Files\\CLI\\terraform.exe", "plan"}                                      

The full output is here.

Panic output

No response

Expected output

The creation of a resource of cloudflare_page_rule type with the smart_errors argument in the actions block must be planed. smart_errors argument in the actions block must be supported.

Actual output

╷
│ Error: Unsupported argument
│
│   on main.tf line 30, in resource "cloudflare_page_rule" "page":
│   30:     smart_errors = "on"
│
│ An argument named "smart_errors" is not expected here.
╵

Steps to reproduce

  1. Use the configuration above.
  2. Run terraform plan.

Additional factoids

No response

References

No response

alex-feel avatar Apr 01 '22 18:04 alex-feel

hi, this isn't a bug but an enhancement as it is a new feature.

jacobbednarz avatar Apr 01 '22 19:04 jacobbednarz

Hi, I assumed that if the argument is present in the official documentation for the resource, then it is already supported. It turns out that the documentation is simply irrelevant?

For example, look at the disable_zaraz argument, it was added in v.3.11.0 and this argument is not in the previous version of the documentation. Therefore, my reasoning is logical and expected.

The smart_errors has been in the documentation for two years now at least since v.2.9.0. It doesn't look like new feature 🤷‍♂️

alex-feel avatar Apr 01 '22 19:04 alex-feel

I assumed that if the argument is present in the official documentation for the resource, then it is already supported. It turns out that the documentation is simply irrelevant?

the documentation isn't irrelevant but it is also isn't the only factor.

for the differentiation check out the GitHub new issue page - https://github.com/cloudflare/terraform-provider-cloudflare/issues/new/choose

Bugs: When something isn't working as expected or documented Feature request: Suggest a new feature or other enhancement

this is the latter as despite it being the in the documentation, it doesn't yet exist so cannot have bugs but instead is actually an addition to what we already have.

jacobbednarz avatar Apr 01 '22 19:04 jacobbednarz

i also can't answer why it is included in the documentation; i'll have to dig internally why it was put here but not included in the functionality itself.

jacobbednarz avatar Apr 01 '22 19:04 jacobbednarz

Okay, I just didn't know this feature didn't exist, I was thinking that if it's been in the documentation for 2 years, then it's supported.

alex-feel avatar Apr 01 '22 19:04 alex-feel

closing this out as smart_errors isn't something that is supported anymore (looks to be a very old key).

page rules is on the way out however, the documentation will get an update once we swap it to be automatically generated from the schema in future PRs.

jacobbednarz avatar Nov 28 '22 22:11 jacobbednarz