Skip to content

cloudflare_page_rule Page rule creation with redirect fails #5178

@albertodonato

Description

@albertodonato

Confirmation

  • This is a bug with an existing resource and is not a feature request or enhancement. Feature requests should be submitted with Cloudflare Support or your account team.
  • I have searched the issue tracker and my issue isn't already found.
  • I have replicated my issue using the latest version of the provider and it is still present.

Terraform and Cloudflare provider version

Using v5.1.0 plugin, creating a page rule with a redirect action fails.

The resource is defined as:

resource "cloudflare_page_rule" "mydomain_redirect" {
  zone_id = "my-zone-id"

  target = "example.com"
  actions = {
    forwarding_url = {
      url         = "https://something.example.com"
      status_code = 302
    }
  }
  status = "active"
}

Applying fails with the following error:

│ Value Conversion Error An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the following to the provider developer:
│ 
│ Received null value, however the target type cannot handle null values. Use the corresponding `types` package type, a pointer type or a custom type that handles null values.
│ 
│ Path: 
│ Target Type: page_rule.PageRuleActionsForwardingURLModel
│ Suggested `types` Type: basetypes.ObjectValue
│ Suggested Pointer Type: *page_rule.PageRuleActionsForwardingURLModel

As a side note, documentation shows examples of actions as a struct, but it needs to be a variable.

Affected resource(s)

  • cloudflare_page_rule

Terraform configuration files

resource "cloudflare_page_rule" "mydomain_redirect" {
  zone_id = "my-zone-id"

  target = "example.com"
  actions = {
    forwarding_url = {
      url         = "https://something.example.com"
      status_code = 302
    }
  }
  status = "active"
}

Link to debug output

n/a

Panic output

No response

Expected output

n/a

Actual output

n/a

Steps to reproduce

create a resource like the one described

Additional factoids

No response

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    service/page_rulesCategorizes issue or PR as related to the Page Rules service.version/5Categorizes issue or PR as related to version 5 of the provider.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions