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

cloudflare_ruleset produced inconsistent result for preserve_query_string #2408

Closed
2 tasks done
florianmutter opened this issue May 3, 2023 · 5 comments · Fixed by #2414
Closed
2 tasks done

cloudflare_ruleset produced inconsistent result for preserve_query_string #2408

florianmutter opened this issue May 3, 2023 · 5 comments · Fixed by #2414
Labels
kind/bug Categorizes issue or PR as related to a bug. provider/internals Categorizes issue or PR as related to the provider internals. triage/accepted Indicates an issue or PR is ready to be actively worked on. triage/debug-log-attached Indicates an issue or PR has a complete Terraform debug log. workflow/synced
Milestone

Comments

@florianmutter
Copy link

Confirmation

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

Terraform and Cloudflare provider version

Terraform v1.3.5
on darwin_arm64

  • provider registry.terraform.io/cloudflare/cloudflare v4.5.0

Affected resource(s)

cloudflare_ruleset

Terraform configuration files

resource "cloudflare_ruleset" "stylebop_com_redirect_rules" {
  kind    = "zone"
  name    = "default"
  phase   = "http_request_dynamic_redirect"
  zone_id = data.cloudflare_zone.stylebop_com.id
  rules {
    action = "redirect"
    action_parameters {
      from_value {
        status_code = 301
        target_url {
          expression = "concat(\"https://www.peek-cloppenburg.de\", http.request.uri.path)"
        }
      }
    }
    description = "Redirect Invoice URL to www.peek-cloppenburg.de"
    enabled     = true
    expression  = "(ends_with(http.host, \"stylebop.com\") and starts_with(http.request.uri.path, \"/s3media\"))"
  }

  rules {
    action = "redirect"
    action_parameters {
      from_value {
        status_code = 301
        target_url {
          expression = "concat(\"https://www.peek-cloppenburg.de/de/stylebop\", http.request.uri.path)"
        }
      }
    }
    description = "Redirect to www.peek-cloppenburg.de"
    enabled     = true
    expression  = "(ends_with(http.host, \"stylebop.com\"))"
  }
}

Link to debug output

https://gist.github.com/florianmutter/86feee086b4319fecce056e6e26aa341

Panic output

No response

Expected output

No changes for resource.

Actual output

Error: Provider produced inconsistent result after apply

When applying changes to cloudflare_ruleset.stylebop_com_redirect_rules, provider "provider["registry.terraform.io/cloudflare/cloudflare"]" produced an unexpected new value: .rules[0].action_parameters[0].from_value[0].preserve_query_string: was null, but now cty.False.

Steps to reproduce

  1. Create redirect rule in cloudflare dashboard
  2. Create configuration in terraform
  3. Import existing redirect rule into terraform state
  4. Run terraform apply

Additional factoids

No response

References

No response

@florianmutter florianmutter 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 May 3, 2023
@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2023

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 May 3, 2023
@jacobbednarz jacobbednarz added triage/accepted Indicates an issue or PR is ready to be actively worked on. provider/internals Categorizes issue or PR as related to the provider internals. workflow/synced and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 3, 2023
@jacobbednarz
Copy link
Member

thanks for the issue and reproduction case here. this is partially caused by the underlying Go library so i've addressed that in cloudflare/cloudflare-go#1275 and will push up the provider fix once i resolve some local development issues i'm having.

@cnk
Copy link

cnk commented May 7, 2023

@jacobbednarz I am getting a very similar error but in my case the error starts when I add a "skip" rule to my cloudflare. I see your cloudflare-go change is merged. Should I just ignore this message until the next cloudflare-go release (which based on previous cadence should be in the next couple of weeks)? The skip rule is created - it just appears to be a problem recording the terraform state thereof.

@jacobbednarz
Copy link
Member

@cnk if you're hitting this specific issue (same field names, error messages, etc) you can follow along here and it will note once it is released and ready to be updated to. otherwise, if you're getting a different issue, i'd recommend opening an issue specific to your setup/output to have it triaged as it may be something different and i can only speculate at this point.

jacobbednarz added a commit that referenced this issue May 8, 2023
… be nullable

Updates the `FromValue.PreserveQueryString` handling in the request + state
handler to use the changes from cloudflare/cloudflare-go#1275 and allows
conditional handling of null in resources.

Closes #2408
jacobbednarz added a commit that referenced this issue May 8, 2023
… be nullable

Updates the `FromValue.PreserveQueryString` handling in the request + state
handler to use the changes from cloudflare/cloudflare-go#1275 and allows
conditional handling of null in resources.

Closes #2408
@github-actions github-actions bot added this to the v4.6.0 milestone May 11, 2023
@github-actions
Copy link
Contributor

This functionality has been released in v4.6.0 of the Terraform Cloudflare Provider.

Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. provider/internals Categorizes issue or PR as related to the provider internals. triage/accepted Indicates an issue or PR is ready to be actively worked on. triage/debug-log-attached Indicates an issue or PR has a complete Terraform debug log. workflow/synced
Projects
None yet
3 participants