Skip to content

Commit

Permalink
Remove http_request_sbfm phase from ruleset documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
gcloudflare committed Jan 9, 2025
1 parent 7448437 commit 73a19b3
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 35 deletions.
2 changes: 1 addition & 1 deletion docs/data-sources/rulesets.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.


Expand Down
4 changes: 2 additions & 2 deletions docs/resources/ruleset.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion internal/framework/service/rulesets/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
1 change: 0 additions & 1 deletion internal/framework/service/rulesets/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
30 changes: 0 additions & 30 deletions internal/framework/service/rulesets/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit 73a19b3

Please sign in to comment.