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

add enabled_origin_commands field to waiting_room #3805

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
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
3 changes: 3 additions & 0 deletions .changelog/3805.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/cloudflare_waiting_room: Add enabled_origin_commands field.
```
2 changes: 2 additions & 0 deletions examples/resources/cloudflare_waiting_room/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ resource "cloudflare_waiting_room" "example" {
}

queueing_status_code = 200

enabled_origin_commands = ["revoke"]
}
2 changes: 2 additions & 0 deletions internal/sdkv2provider/resource_cloudflare_waiting_room.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func buildWaitingRoom(d *schema.ResourceData) cloudflare.WaitingRoom {
CookieSuffix: d.Get("cookie_suffix").(string),
AdditionalRoutes: additional_routes,
QueueingStatusCode: d.Get("queueing_status_code").(int),
EnabledOriginCommands: d.Get("enabled_origin_commands").([]string),
jacobbednarz marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down Expand Up @@ -119,6 +120,7 @@ func resourceCloudflareWaitingRoomRead(ctx context.Context, d *schema.ResourceDa
d.Set("cookie_suffix", waitingRoom.CookieSuffix)
d.Set("additional_routes", flattenWaitingRoomAdditionalRoutes(waitingRoom.AdditionalRoutes))
d.Set("queueing_status_code", waitingRoom.QueueingStatusCode)
d.Set("enabled_origin_commands", waitingRoom.EnabledOriginCommands)
return nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func TestAccCloudflareWaitingRoom_Create(t *testing.T) {
resource.TestCheckResourceAttr(name, "additional_routes.1.host", "shop2."+domain),
resource.TestCheckResourceAttr(name, "additional_routes.1.path", "/"),
resource.TestCheckResourceAttr(name, "queueing_status_code", "200"),
resource.TestCheckResourceAttr(name, "enabled_origin_commands.0", "revoke"),
),
},
},
Expand Down Expand Up @@ -149,6 +150,8 @@ resource "cloudflare_waiting_room" "%[1]s" {

queueing_status_code = 200

enabled_origin_commands = ["revoke"]

depends_on = [cloudflare_record.%[1]s-shop-1, cloudflare_record.%[1]s-shop-2]
}
`, resourceName, waitingRoomName, zoneID, domain, path)
Expand Down
14 changes: 14 additions & 0 deletions internal/sdkv2provider/schema_cloudflare_waiting_room.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ var waitingRoomQueueingMethod = []string{
"reject",
}

var waitingRoomOriginCommands = []string{
"revoke",
}

func resourceCloudflareWaitingRoomSchema() map[string]*schema.Schema {
return map[string]*schema.Schema{
consts.ZoneIDSchemaKey: {
Expand Down Expand Up @@ -177,5 +181,15 @@ func resourceCloudflareWaitingRoomSchema() map[string]*schema.Schema {
Optional: true,
Default: 200,
},

"enabled_origin_commands": {
Description: fmt.Sprintf("The list of enabled origin commands for the waiting room. %s", renderAvailableDocumentationValuesStringSlice(waitingRoomOriginCommands)),
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validation.StringInSlice(waitingRoomOriginCommands, false),
},
},
}
}
Loading