-
Notifications
You must be signed in to change notification settings - Fork 610
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
Please document how to upgrade cloudflare_ruleset past 4.1.0 #2464
Comments
Community NoteVoting for Prioritization
Volunteering to Work on This Issue
|
the v4.2.0 release notes are all that is required to go from 4.1.0 to 4.2.0. this is a process I've walked through for my personal configuration as well as two internal zones without issues so there is either something about your configuration that isn't accounted for here or an edge case that wasn't considered. can you provide a specific and minimal reproduction test case to what you are seeing to diagnose? the general steps included in the reproduction steps here are not enough to trigger the issue. |
@jacobbednarz can you give me an email from your CF account to tps-infra-cloud-and-hosting [at] mediahuis . (be)lgium I would be happy to share the full statefile once I've verified you're a CF employee ;-) |
i don't need your state file; i'm after the reproduction steps which should work irrespective of your state file as the steps will build the reproduction case. |
Let me try to give you pointers how we got here, not sure if you'll have the same outcome as this can very well also happen because the domain was once created against an older CF api with different behaivior. Following code is a exact copy, except the domain names. Our TF part: resource "cloudflare_ruleset" domain_tld-origin-ruleset{
zone_id = cloudflare_zone.domain_tld.id
name = "Origin ruleset (Gitlab managed)"
description = "Origin ruleset (Gitlab managed)"
kind = "zone"
phase = "http_request_origin"
rules {
expression = "(http.host matches \"(testm|test).domain.tld\" and http.request.uri matches \"^/path\" and not http.request.uri matches \"^/path/api\")"
description = "Send /path traffic to test s3 bucket website"
enabled = true
action = "route"
action_parameters {
host_header = "test-bucket.s3-website-eu-west-1.amazonaws.com"
origin {
host = "test-application.domain.tld"
port = 0
}
}
}
rules {
expression = "(http.host matches \"(previewm|preview).domain.tld\" and http.request.uri matches \"^/path\" and not http.request.uri matches \"^/path/api\")"
description = "Send /path traffic to acceptance s3 bucket website"
enabled = true
action = "route"
action_parameters {
host_header = "acc-bucket.s3-website-eu-west-1.amazonaws.com"
origin {
host = "acc-application.domain.tld"
port = 0
}
}
}
rules {
expression = "(http.host matches \"(www.|m.).domain.tld\" and http.request.uri matches \"^/path\" and not http.request.uri matches \"^/path/api\")"
description = "Send /path traffic to production s3 bucket website"
enabled = true
action = "route"
action_parameters {
host_header = "prod-bucket.s3-website-eu-west-1.amazonaws.com"
origin {
host = "prod-application.domain.tld"
port = 0
}
}
}
} Do you need more? |
other than
did you follow the guidance on the upgrade guide about removing from state and reimporting to make sure you were getting the full benefits? |
Yes, see my report:
Note that we have around 6000 domains in CF (and a few 100 premiums). |
Agree with previous comment, this broken change was introduced in a minor release. Documentation says nothing about this, only a warning in release notes. |
the choice to migrate wasn't made lightly as not only was this problematic for customers but it was quite an engineering effort on our side too. the migration involved swapping the internals of our provider to an experimental backend which no other provider of our size had yet attempted. you can see the full context in #2170 and #2271.
correct - and this was due to the broken nature of the resource prior to this change (see the PR links above). if you were using the resource in older versions, you were already running a broken resource that would potentially break if you provided it the right combination of values and there was no way to manually recover due to the internal. additionally at the time, 4.1.0 had < 10 active installations, all of them internal to Cloudflare teams so the remainder of traffic should have got a newer version out of the box unless they specifically asked for that version. as for the issue here, i'm still not sure why you have |
@jacobbednarz it's not possible to upgrade from 3.35 provider directly to 4.6. Only through 3.35 -> 4.1 -> 4.6. Existing issue with this problem #2452. I managed it in that way
Fortunately, I have only 22 rulesets across all zones, and everything, with checking, manipulating state etc. took only one work day |
The process described in #2464 (comment) worked in order to update the version. However, when I made any change on an existing rule, seems that it wants to update all the rule IDs:
which seems the same problem present in #2172 . Seems that changes done in #2271 made that this problem re-appear (also the comment |
@marcel-puchol-jt that output looks correct since those fields are now marked as computed. the tricky bit here is that you are using a module too; not just the resource directly which may store the resource with different values through abstraction however, it looks as expected. as for the investigation, that was completed and it was the same in the end. the exact test suite used in the initial PR was used to determine the correctness following the upgrade. |
@jacobbednarz the output represents a ruleset in which only one rule is changed. In this case, the IDs should not change when a single rule is updated. Even for the changed rule, the ID should remain the same, as only the expression in changing. In fact, I tested to apply the previous change, and all IDs remain (so the plan is not accurate on showing that IDs are going to change) for those unchanged rules. However, the ID in which the expression changes, it really change the ID for this rule (which shouldn't, or at least, this was not the behaviour before 4.1.0). Finally, I don't understand the tricky part related to using a module. Which is the problem on using the code inside a module? |
the plan is accurate. it is not telling you the ID value is changing but that something inside the structure has changed and because the value is optional and computed, it will be calculated for that run but it doesn't yet know the final value. once the regarding using modules: a module is an abstraction over one or more resources and and these abstractions can hold their own logic bugs which are outside of the provider and not able to be diagnosed. for example, in the module you have handling for your desired defaults if they are not provided. if you typo the value, it may miss the key and not be set at all which is something that won't show up in debug logs like this since it is a client side bug in your definition. |
#2481 pulls the release note into the upgrade guide for anyone who is performing the upgrade. |
This functionality has been released in v4.7.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! |
Confirmation
Terraform and Cloudflare provider version
4.6.0
Affected resource(s)
cloudflare_ruleset
Terraform configuration files
Gist to tfstate file (v4.1.0): https://gist.github.com/hp197/82dfda7e3743e4bbad8ccea5734b6bf7
Link to debug output
https://gist.github.com/hp197/c1d13c72e861f60d7263282f566b5613
Panic output
/ See debug log /
Expected output
Something working
Actual output
Non working
Steps to reproduce
Additional factoids
Please update the documentation on how to get from from v4.1.0 onwards with rulesets.
The warning in the v4.2.0 wont cut it here, it's too brief.
Searched in https://github.com/cloudflare/terraform-provider-cloudflare/blob/master/docs/guides/version-4-upgrade.md
But couldn't find any info there.
We are CF business/premium plan user.
I can contact our account manager if that would help for you to get extra prio.
References
Might be related to #2452
The text was updated successfully, but these errors were encountered: