diff --git a/.changelog/3805.txt b/.changelog/3805.txt new file mode 100644 index 0000000000..75f11c4ba1 --- /dev/null +++ b/.changelog/3805.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/cloudflare_waiting_room: Add enabled_origin_commands field. +``` \ No newline at end of file diff --git a/examples/resources/cloudflare_waiting_room/resource.tf b/examples/resources/cloudflare_waiting_room/resource.tf index 4df04df5ef..f2c87dc46d 100644 --- a/examples/resources/cloudflare_waiting_room/resource.tf +++ b/examples/resources/cloudflare_waiting_room/resource.tf @@ -18,4 +18,6 @@ resource "cloudflare_waiting_room" "example" { } queueing_status_code = 200 + + enabled_origin_commands = ["revoke"] } diff --git a/internal/sdkv2provider/resource_cloudflare_waiting_room.go b/internal/sdkv2provider/resource_cloudflare_waiting_room.go index b05402a631..849b48afe6 100644 --- a/internal/sdkv2provider/resource_cloudflare_waiting_room.go +++ b/internal/sdkv2provider/resource_cloudflare_waiting_room.go @@ -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: expandInterfaceToStringList(d.Get("enabled_origin_commands").([]interface{})), } } @@ -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 } diff --git a/internal/sdkv2provider/resource_cloudflare_waiting_room_test.go b/internal/sdkv2provider/resource_cloudflare_waiting_room_test.go index 2f66d939ed..dc411a816f 100644 --- a/internal/sdkv2provider/resource_cloudflare_waiting_room_test.go +++ b/internal/sdkv2provider/resource_cloudflare_waiting_room_test.go @@ -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"), ), }, }, @@ -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) diff --git a/internal/sdkv2provider/schema_cloudflare_waiting_room.go b/internal/sdkv2provider/schema_cloudflare_waiting_room.go index 5cf4b6a6b4..e7111c67b0 100644 --- a/internal/sdkv2provider/schema_cloudflare_waiting_room.go +++ b/internal/sdkv2provider/schema_cloudflare_waiting_room.go @@ -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: { @@ -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), + }, + }, } }