diff --git a/.changelog/4860.txt b/.changelog/4860.txt new file mode 100644 index 0000000000..d6ff22ab57 --- /dev/null +++ b/.changelog/4860.txt @@ -0,0 +1,3 @@ +```release-note:note +resource/cloudflare_ruleset: remove deprecated `http_request_sbfm` phase +``` diff --git a/docs/data-sources/rulesets.md b/docs/data-sources/rulesets.md index eb6f3e3887..fdb3a0f7fb 100644 --- a/docs/data-sources/rulesets.md +++ b/docs/data-sources/rulesets.md @@ -43,7 +43,7 @@ Optional: - `id` (String) The ID of the Ruleset to target. - `kind` (String) Type of Ruleset to create. Available values: `custom`, `managed`, `root`, `zone`. - `name` (String) Name of the ruleset. -- `phase` (String) Point in the request/response lifecycle where the ruleset will be created. Available values: `ddos_l4`, `ddos_l7`, `http_config_settings`, `http_custom_errors`, `http_log_custom_fields`, `http_ratelimit`, `http_request_cache_settings`, `http_request_dynamic_redirect`, `http_request_firewall_custom`, `http_request_firewall_managed`, `http_request_late_transform`, `http_request_origin`, `http_request_redirect`, `http_request_sanitize`, `http_request_sbfm`, `http_request_transform`, `http_response_compression`, `http_response_firewall_managed`, `http_response_headers_transform`, `magic_transit`. +- `phase` (String) Point in the request/response lifecycle where the ruleset will be created. Available values: `ddos_l4`, `ddos_l7`, `http_config_settings`, `http_custom_errors`, `http_log_custom_fields`, `http_ratelimit`, `http_request_cache_settings`, `http_request_dynamic_redirect`, `http_request_firewall_custom`, `http_request_firewall_managed`, `http_request_late_transform`, `http_request_origin`, `http_request_redirect`, `http_request_sanitize`, `http_request_transform`, `http_response_compression`, `http_response_firewall_managed`, `http_response_headers_transform`, `magic_transit`. - `version` (String) Version of the ruleset to filter on. diff --git a/docs/resources/ruleset.md b/docs/resources/ruleset.md index 6a8962d906..1fdbfb41a6 100644 --- a/docs/resources/ruleset.md +++ b/docs/resources/ruleset.md @@ -442,7 +442,7 @@ resource "cloudflare_ruleset" "response_compress_brotli_html" { - `kind` (String) Type of Ruleset to create. Available values: `custom`, `managed`, `root`, `zone`. - `name` (String) Name of the ruleset. -- `phase` (String) Point in the request/response lifecycle where the ruleset will be created. Available values: `ddos_l4`, `ddos_l7`, `http_config_settings`, `http_custom_errors`, `http_log_custom_fields`, `http_ratelimit`, `http_request_cache_settings`, `http_request_dynamic_redirect`, `http_request_firewall_custom`, `http_request_firewall_managed`, `http_request_late_transform`, `http_request_origin`, `http_request_redirect`, `http_request_sanitize`, `http_request_sbfm`, `http_request_transform`, `http_response_compression`, `http_response_firewall_managed`, `http_response_headers_transform`, `magic_transit`. +- `phase` (String) Point in the request/response lifecycle where the ruleset will be created. Available values: `ddos_l4`, `ddos_l7`, `http_config_settings`, `http_custom_errors`, `http_log_custom_fields`, `http_ratelimit`, `http_request_cache_settings`, `http_request_dynamic_redirect`, `http_request_firewall_custom`, `http_request_firewall_managed`, `http_request_late_transform`, `http_request_origin`, `http_request_redirect`, `http_request_sanitize`, `http_request_transform`, `http_response_compression`, `http_response_firewall_managed`, `http_response_headers_transform`, `magic_transit`. ### Optional @@ -515,7 +515,7 @@ Optional: - `origin_cache_control` (Boolean) Enable or disable the use of a more compliant Cache Control parsing mechanism, enabled by default for most zones. - `origin_error_page_passthru` (Boolean) Pass-through error page for origin. - `overrides` (Block List) List of override configurations to apply to the ruleset. (see [below for nested schema](#nestedblock--rules--action_parameters--overrides)) -- `phases` (Set of String) Point in the request/response lifecycle where the ruleset will be created. Available values: `ddos_l4`, `ddos_l7`, `http_config_settings`, `http_custom_errors`, `http_log_custom_fields`, `http_ratelimit`, `http_request_cache_settings`, `http_request_dynamic_redirect`, `http_request_firewall_custom`, `http_request_firewall_managed`, `http_request_late_transform`, `http_request_origin`, `http_request_redirect`, `http_request_sanitize`, `http_request_sbfm`, `http_request_transform`, `http_response_compression`, `http_response_firewall_managed`, `http_response_headers_transform`, `magic_transit`. +- `phases` (Set of String) Point in the request/response lifecycle where the ruleset will be created. Available values: `ddos_l4`, `ddos_l7`, `http_config_settings`, `http_custom_errors`, `http_log_custom_fields`, `http_ratelimit`, `http_request_cache_settings`, `http_request_dynamic_redirect`, `http_request_firewall_custom`, `http_request_firewall_managed`, `http_request_late_transform`, `http_request_origin`, `http_request_redirect`, `http_request_sanitize`, `http_request_transform`, `http_response_compression`, `http_response_firewall_managed`, `http_response_headers_transform`, `magic_transit`. - `polish` (String) Apply options from the Polish feature of the Cloudflare Speed app. - `products` (Set of String) Products to target with the actions. Available values: `bic`, `hot`, `ratelimit`, `securityLevel`, `uablock`, `waf`, `zonelockdown`. - `read_timeout` (Number) Specifies a maximum timeout for reading content from an origin server. diff --git a/internal/framework/service/rulesets/migrate.go b/internal/framework/service/rulesets/migrate.go index 0ca3ba0916..3149bf6a8d 100644 --- a/internal/framework/service/rulesets/migrate.go +++ b/internal/framework/service/rulesets/migrate.go @@ -167,7 +167,6 @@ func (r *RulesetResource) UpgradeState(ctx context.Context) map[int64]resource.S Required: true, Validators: []validator.String{ stringvalidator.OneOfCaseInsensitive(cfv1.RulesetPhaseValues()...), - sbfmDeprecationWarningValidator{}, }, PlanModifiers: []planmodifier.String{ stringplanmodifier.RequiresReplace(), diff --git a/internal/framework/service/rulesets/schema.go b/internal/framework/service/rulesets/schema.go index c430417a2b..331c04d576 100644 --- a/internal/framework/service/rulesets/schema.go +++ b/internal/framework/service/rulesets/schema.go @@ -90,7 +90,6 @@ func (r *RulesetResource) Schema(ctx context.Context, req resource.SchemaRequest Required: true, Validators: []validator.String{ stringvalidator.OneOfCaseInsensitive(cfv1.RulesetPhaseValues()...), - sbfmDeprecationWarningValidator{}, }, PlanModifiers: []planmodifier.String{ stringplanmodifier.RequiresReplace(), diff --git a/internal/framework/service/rulesets/validators.go b/internal/framework/service/rulesets/validators.go index f18ced0fd7..7795619a21 100644 --- a/internal/framework/service/rulesets/validators.go +++ b/internal/framework/service/rulesets/validators.go @@ -4,40 +4,10 @@ import ( "context" "fmt" - cfv1 "github.com/cloudflare/cloudflare-go" "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) -type sbfmDeprecationWarningValidator struct{} - -func (v sbfmDeprecationWarningValidator) Description(ctx context.Context) string { - return fmt.Sprintf("Cloudflare is going to change the way Super Bot Fight Mode managed rules are configured through Terraform and our API. No action is required at this time. " + - " Please follow updates to our documentation regarding this here: https://developers.cloudflare.com/bots/get-started/biz-and-ent/#ruleset-engine") -} - -func (v sbfmDeprecationWarningValidator) MarkdownDescription(ctx context.Context) string { - return fmt.Sprintf("Cloudflare is going to change the way Super Bot Fight Mode managed rules are configured through Terraform and our API. **No action is required at this time**. " + - " Please follow updates to our documentation regarding this [here](https://developers.cloudflare.com/bots/get-started/biz-and-ent/#ruleset-engine)") -} - -func (v sbfmDeprecationWarningValidator) ValidateString(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse) { - // If the value is unknown or null, there is nothing to validate. - if req.ConfigValue.IsUnknown() || req.ConfigValue.IsNull() { - return - } - - if req.ConfigValue.ValueString() == string(cfv1.RulesetPhaseHTTPRequestSBFM) { - resp.Diagnostics.AddAttributeWarning( - req.Path, - fmt.Sprintf(`%q phase will soon be deprecated in the "cloudflare_ruleset" resource`, string(cfv1.RulesetPhaseHTTPRequestSBFM)), - v.Description(ctx), - ) - - return - } -} - type RulesetActionParameterEdgeTTL struct { Mode basetypes.StringValue `tfsdk:"mode"` Default basetypes.Int64Value `tfsdk:"default"`