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

Remove http_request_sbfm phase from ruleset documentation #4860

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once the phase is removed from the cloudflare-go lib, this should automatically generate the new values for you from the schema.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood, I will create the PR for cloudflare-go first

- `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{},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should leave this one in place for now as it was a part of a migrate.

},
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()...),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'll need to remove the value from https://github.com/cloudflare/cloudflare-go/blob/master/rulesets.go#L38 as that is where the available values come from today.

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
Loading