Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected Validation Error for TTL Settings of cloudflare_ruleset #4412

Open
3 tasks done
digglife opened this issue Oct 24, 2024 · 2 comments
Open
3 tasks done

Unexpected Validation Error for TTL Settings of cloudflare_ruleset #4412

digglife opened this issue Oct 24, 2024 · 2 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. triage/debug-log-attached Indicates an issue or PR has a complete Terraform debug log.

Comments

@digglife
Copy link

digglife commented Oct 24, 2024

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

  • terraform 1.9.8
  • terraform-provider-cloudflare 4.44.0

Affected resource(s)

cloudflare_ruleset

Terraform configuration files

terraform {
  required_version = "~> 1.9.8"
  required_providers {
    cloudflare = {
      source  = "cloudflare/cloudflare"
      version = "4.44.0"
    }
  }
}

variable "my_ttl" {
  default = 86400
  type = number
}

provider "cloudflare" {
  api_key = "api_key"
  email   = "[email protected]"
}
resource "cloudflare_ruleset" "caches" {
  kind    = "zone"
  name    = "bug-reproduce-rules"
  phase   = "http_request_cache_settings"
  zone_id = "zone_a"

  rules {
    action      = "set_cache_settings"
    description = "bug_reproduce"
    enabled     = true
    expression  = "(http.host eq \"hello\")"

    action_parameters {
      cache                      = true
      origin_error_page_passthru = true
      respect_strong_etags       = false

      edge_ttl {
        mode       = "override_origin"
        default    = var.my_ttl
      }
    }
  }
}

Link to debug output

https://gist.github.com/digglife/1b4d145d95d9a4e7ca744c0d55f43eac

Panic output

No response

Expected output

When the default of edge_ttl is set with variable, terraform plan should be executed successfully.

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # cloudflare_ruleset.caches will be created
  + resource "cloudflare_ruleset" "caches" {
      + description = (known after apply)
      + id          = (known after apply)
      + kind        = "zone"
      + name        = "bug-reproduce-rules"
      + phase       = "http_request_cache_settings"
      + zone_id     = "zone_a"

      + rules {
          + action       = "set_cache_settings"
          + description  = "bug_reproduce"
          + enabled      = true
          + expression   = "(http.host eq \"hello\")"
          + id           = (known after apply)
          + last_updated = (known after apply)
          + ref          = (known after apply)
          + version      = (known after apply)

          + action_parameters {
              + cache                      = true
              + origin_error_page_passthru = true
              + respect_strong_etags       = false
              + version                    = (known after apply)

              + edge_ttl {
                  + default = 3200
                  + mode    = "override_origin"
                }
            }
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Actual output

╷
│ Error: invalid configuration
│ 
│   with cloudflare_ruleset.caches,
│   on main.tf line 37, in resource "cloudflare_ruleset" "caches":
│   37:       edge_ttl {
│ 
│ using mode 'override_origin' requires setting a default for ttl
╵

Steps to reproduce

It can be reproduced with the configuration I provided. api_key, email and zone_id need to be replaced with actual values.

Additional factoids

No response

References

No response

@digglife digglife added kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 24, 2024
Copy link
Contributor

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the triage/debug-log-attached Indicates an issue or PR has a complete Terraform debug log. label Oct 24, 2024
@digglife digglife changed the title Unexpected Validation Error for TTL Settings of cloudflare_ruleset During Terraform Plan Phase Unexpected Validation Error for TTL Settings of cloudflare_ruleset Oct 24, 2024
digglife added a commit to digglife/terraform-provider-cloudflare that referenced this issue Oct 24, 2024
digglife added a commit to digglife/terraform-provider-cloudflare that referenced this issue Oct 24, 2024
@MAN98
Copy link

MAN98 commented Oct 24, 2024

Encountering this issue too. This is blocking us from proceeding to upgrade our provider version to 4.44.0 which we need for our Cache Rule migration work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. triage/debug-log-attached Indicates an issue or PR has a complete Terraform debug log.
Projects
None yet
2 participants