Skip to content

Commit

Permalink
add waiting_room queueing_method
Browse files Browse the repository at this point in the history
  • Loading branch information
broswen committed Jul 7, 2022
1 parent 4e4d26b commit c9569dd
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/unknown.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/cloudflare_waiting_room: Add queueing_method field.
```
4 changes: 2 additions & 2 deletions docs/resources/ruleset.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ resource "cloudflare_ruleset" "redirect_from_list_example" {

- `kind` (String) Type of Ruleset to create. Available values: `custom`, `managed`, `root`, `schema`, `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_log_custom_fields`, `http_request_cache_settings`, `http_request_firewall_custom`, `http_request_firewall_managed`, `http_request_late_transform`, `http_request_late_transform_managed`, `http_request_main`, `http_request_origin`, `http_request_redirect`, `http_request_sanitize`, `http_request_transform`, `http_response_firewall_managed`, `http_response_headers_transform`, `magic_transit`, `http_ratelimit`, `http_request_sbfm`.
- `phase` (String) Point in the request/response lifecycle where the ruleset will be created. Available values: `ddos_l4`, `ddos_l7`, `http_log_custom_fields`, `http_request_cache_settings`, `http_request_firewall_custom`, `http_request_firewall_managed`, `http_request_late_transform`, `http_request_late_transform_managed`, `http_request_main`, `http_request_origin`, `http_request_redirect`, `http_request_sanitize`, `http_request_transform`, `http_response_firewall_managed`, `http_response_headers_transform`, `http_response_headers_transform_managed`, `magic_transit`, `http_ratelimit`, `http_request_sbfm`.

### Optional

Expand Down Expand Up @@ -418,7 +418,7 @@ Optional:
- `origin` (Block List, Max: 1) List of properties to change request origin. (see [below for nested schema](#nestedblock--rules--action_parameters--origin))
- `origin_error_page_passthru` (Boolean) Pass-through error page for origin.
- `overrides` (Block List, Max: 1) 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_log_custom_fields`, `http_request_cache_settings`, `http_request_firewall_custom`, `http_request_firewall_managed`, `http_request_late_transform`, `http_request_late_transform_managed`, `http_request_main`, `http_request_origin`, `http_request_redirect`, `http_request_sanitize`, `http_request_transform`, `http_response_firewall_managed`, `http_response_headers_transform`, `magic_transit`, `http_ratelimit`, `http_request_sbfm`.
- `phases` (Set of String) Point in the request/response lifecycle where the ruleset will be created. Available values: `ddos_l4`, `ddos_l7`, `http_log_custom_fields`, `http_request_cache_settings`, `http_request_firewall_custom`, `http_request_firewall_managed`, `http_request_late_transform`, `http_request_late_transform_managed`, `http_request_main`, `http_request_origin`, `http_request_redirect`, `http_request_sanitize`, `http_request_transform`, `http_response_firewall_managed`, `http_response_headers_transform`, `http_response_headers_transform_managed`, `magic_transit`, `http_ratelimit`, `http_request_sbfm`.
- `products` (Set of String) Products to target with the actions. Available values: `bic`, `hot`, `ratelimit`, `securityLevel`, `uablock`, `waf`, `zonelockdown`.
- `request_fields` (Set of String) List of request headers to include as part of custom fields logging, in lowercase.
- `respect_strong_etags` (Boolean) Respect strong ETags.
Expand Down
1 change: 1 addition & 0 deletions docs/resources/waiting_room.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ resource "cloudflare_waiting_room" "example" {
- `json_response_enabled` (Boolean) If true, requests to the waiting room with the header `Accept: application/json` will receive a JSON response object.
- `path` (String) The path within the host to enable the waiting room on.
- `queue_all` (Boolean) If queue_all is true, then all traffic will be sent to the waiting room.
- `queueing_method` (String) The queueing method used by the waiting room. Available values: `fifo`, `random`, `passthrough`, `reject`. Defaults to `fifo`.
- `session_duration` (Number) Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to the origin.
- `suspended` (Boolean) Suspends the waiting room.
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
Expand Down
2 changes: 2 additions & 0 deletions internal/provider/resource_cloudflare_waiting_room.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func buildWaitingRoom(d *schema.ResourceData) cloudflare.WaitingRoom {
TotalActiveUsers: d.Get("total_active_users").(int),
NewUsersPerMinute: d.Get("new_users_per_minute").(int),
CustomPageHTML: d.Get("custom_page_html").(string),
QueueingMethod: d.Get("queueing_method").(string),
DefaultTemplateLanguage: d.Get("default_template_language").(string),
SessionDuration: d.Get("session_duration").(int),
JsonResponseEnabled: d.Get("json_response_enabled").(bool),
Expand Down Expand Up @@ -93,6 +94,7 @@ func resourceCloudflareWaitingRoomRead(ctx context.Context, d *schema.ResourceDa
d.Set("total_active_users", waitingRoom.TotalActiveUsers)
d.Set("session_duration", waitingRoom.SessionDuration)
d.Set("disable_session_renewal", waitingRoom.DisableSessionRenewal)
d.Set("queueing_method", waitingRoom.QueueingMethod)
d.Set("custom_page_html", waitingRoom.CustomPageHTML)
d.Set("default_template_language", waitingRoom.DefaultTemplateLanguage)
d.Set("json_response_enabled", waitingRoom.JsonResponseEnabled)
Expand Down
2 changes: 2 additions & 0 deletions internal/provider/resource_cloudflare_waiting_room_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func TestAccCloudflareWaitingRoom_Create(t *testing.T) {
resource.TestCheckResourceAttr(name, "zone_id", zoneID),
resource.TestCheckResourceAttr(name, "name", waitingRoomName),
resource.TestCheckResourceAttr(name, "description", "my desc"),
resource.TestCheckResourceAttr(name, "queueing_method", "fifo"),
resource.TestCheckResourceAttr(name, "custom_page_html", "foobar"),
resource.TestCheckResourceAttr(name, "default_template_language", "en-US"),
resource.TestCheckResourceAttr(name, "disable_session_renewal", "true"),
Expand Down Expand Up @@ -72,6 +73,7 @@ resource "cloudflare_waiting_room" "%[1]s" {
total_active_users = 405
path = "%[5]s"
session_duration = 10
queueing_method = "fifo"
custom_page_html = "foobar"
default_template_language = "en-US"
description = "my desc"
Expand Down
8 changes: 8 additions & 0 deletions internal/provider/schema_cloudflare_waiting_room.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ func resourceCloudflareWaitingRoomSchema() map[string]*schema.Schema {
Optional: true,
},

"queueing_method": {
Description: fmt.Sprintf("The queueing method used by the waiting room. %s", renderAvailableDocumentationValuesStringSlice(waitingRoomQueueingMethod)),
Type: schema.TypeString,
Default: "fifo",
Optional: true,
ValidateFunc: validation.StringInSlice(waitingRoomQueueingMethod, false),
},

"default_template_language": {
Description: fmt.Sprintf("The language to use for the default waiting room page. %s", renderAvailableDocumentationValuesStringSlice(defaultTemplateLanguages)),
Type: schema.TypeString,
Expand Down

0 comments on commit c9569dd

Please sign in to comment.