From cc718a77e2b2c87c253bd8cfbd2f51e42458498c Mon Sep 17 00:00:00 2001 From: "Xiaxin Yi (from Dev Box)" Date: Thu, 11 Apr 2024 16:59:09 +0800 Subject: [PATCH 1/2] adding premium p2 to signalR service and web pubsub service --- .../signalr/signalr_service_resource.go | 8 ++- .../signalr/signalr_service_resource_test.go | 35 +++++++++-- .../services/signalr/web_pubsub_resource.go | 11 ++-- .../signalr/web_pubsub_resource_test.go | 58 +++++++++++++++++++ website/docs/r/signalr_service.html.markdown | 6 +- website/docs/r/web_pubsub.html.markdown | 6 +- 6 files changed, 106 insertions(+), 18 deletions(-) diff --git a/internal/services/signalr/signalr_service_resource.go b/internal/services/signalr/signalr_service_resource.go index 69e936afe983..055e7f8607d1 100644 --- a/internal/services/signalr/signalr_service_resource.go +++ b/internal/services/signalr/signalr_service_resource.go @@ -828,13 +828,15 @@ func resourceArmSignalRServiceSchema() map[string]*pluginsdk.Schema { "Free_F1", "Standard_S1", "Premium_P1", + "Premium_P2", }, false), }, "capacity": { - Type: pluginsdk.TypeInt, - Required: true, - ValidateFunc: validation.IntInSlice([]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}), + Type: pluginsdk.TypeInt, + Required: true, + ValidateFunc: validation.IntInSlice([]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, + 300, 400, 500, 600, 700, 800, 900, 1000}), }, }, }, diff --git a/internal/services/signalr/signalr_service_resource_test.go b/internal/services/signalr/signalr_service_resource_test.go index 36636cfa46af..d2214b2dcdb4 100644 --- a/internal/services/signalr/signalr_service_resource_test.go +++ b/internal/services/signalr/signalr_service_resource_test.go @@ -108,13 +108,36 @@ func TestAccSignalRService_identity(t *testing.T) { }) } -func TestAccSignalRService_premium(t *testing.T) { +func TestAccSignalRService_premiumP1(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_signalr_service", "test") r := SignalRServiceResource{} data.ResourceTest(t, r, []acceptance.TestStep{ { - Config: r.premium(data), + Config: r.premium(data, "Premium_P1", 1), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("hostname").Exists(), + check.That(data.ResourceName).Key("ip_address").Exists(), + check.That(data.ResourceName).Key("public_port").Exists(), + check.That(data.ResourceName).Key("server_port").Exists(), + check.That(data.ResourceName).Key("primary_access_key").Exists(), + check.That(data.ResourceName).Key("primary_connection_string").Exists(), + check.That(data.ResourceName).Key("secondary_access_key").Exists(), + check.That(data.ResourceName).Key("secondary_connection_string").Exists(), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSignalRService_premiumP2(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_signalr_service", "test") + r := SignalRServiceResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.premium(data, "Premium_P2", 100), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("hostname").Exists(), @@ -690,7 +713,7 @@ resource "azurerm_signalr_service" "test" { `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } -func (r SignalRServiceResource) premium(data acceptance.TestData) string { +func (r SignalRServiceResource) premium(data acceptance.TestData, planSku string, capacity int) string { return fmt.Sprintf(` provider "azurerm" { features {} @@ -707,11 +730,11 @@ resource "azurerm_signalr_service" "test" { resource_group_name = azurerm_resource_group.test.name sku { - name = "Premium_P1" - capacity = 1 + name = "%s" + capacity = %d } } -`, data.RandomInteger, data.Locations.Primary, data.RandomInteger) +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, planSku, capacity) } func (r SignalRServiceResource) requiresImport(data acceptance.TestData) string { diff --git a/internal/services/signalr/web_pubsub_resource.go b/internal/services/signalr/web_pubsub_resource.go index 05b36a3a30e8..3eebcc7c263a 100644 --- a/internal/services/signalr/web_pubsub_resource.go +++ b/internal/services/signalr/web_pubsub_resource.go @@ -70,17 +70,18 @@ func resourceWebPubSub() *pluginsdk.Resource { Required: true, ValidateFunc: validation.StringInSlice([]string{ "Premium_P1", + "Premium_P2", "Standard_S1", "Free_F1", }, false), }, "capacity": { - Type: pluginsdk.TypeInt, - Optional: true, - Default: 1, - ValidateFunc: validation.IntInSlice([]int{1, 2, 5, 10, 20, 50, 100}), - }, + Type: pluginsdk.TypeInt, + Optional: true, + Default: 1, + ValidateFunc: validation.IntInSlice([]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, + 300, 400, 500, 600, 700, 800, 900, 1000})}, "live_trace": { Type: pluginsdk.TypeList, diff --git a/internal/services/signalr/web_pubsub_resource_test.go b/internal/services/signalr/web_pubsub_resource_test.go index cc986e644ff7..e1cfdd22fd56 100644 --- a/internal/services/signalr/web_pubsub_resource_test.go +++ b/internal/services/signalr/web_pubsub_resource_test.go @@ -41,6 +41,50 @@ func TestAccWebPubsub_basic(t *testing.T) { }) } +func TestAccWebPubsub_premiumP1(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_web_pubsub", "test") + r := WebPubsubResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.premium(data, "Premium_P1", 1), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("hostname").Exists(), + check.That(data.ResourceName).Key("public_port").Exists(), + check.That(data.ResourceName).Key("server_port").Exists(), + check.That(data.ResourceName).Key("primary_access_key").Exists(), + check.That(data.ResourceName).Key("primary_connection_string").Exists(), + check.That(data.ResourceName).Key("secondary_access_key").Exists(), + check.That(data.ResourceName).Key("secondary_connection_string").Exists(), + ), + }, + data.ImportStep(), + }) +} + +func TestAccWebPubsub_premiumP2(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_web_pubsub", "test") + r := WebPubsubResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.premium(data, "Premium_P2", 100), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("hostname").Exists(), + check.That(data.ResourceName).Key("public_port").Exists(), + check.That(data.ResourceName).Key("server_port").Exists(), + check.That(data.ResourceName).Key("primary_access_key").Exists(), + check.That(data.ResourceName).Key("primary_connection_string").Exists(), + check.That(data.ResourceName).Key("secondary_access_key").Exists(), + check.That(data.ResourceName).Key("secondary_connection_string").Exists(), + ), + }, + data.ImportStep(), + }) +} + func TestAccWebPubsub_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_web_pubsub", "test") r := WebPubsubResource{} @@ -264,6 +308,20 @@ resource "azurerm_web_pubsub" "test" { `, r.template(data), data.RandomInteger) } +func (r WebPubsubResource) premium(data acceptance.TestData, sku string, capacity int) string { + return fmt.Sprintf(` +%s + +resource "azurerm_web_pubsub" "test" { + name = "acctestWebPubsub-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku = "%s" + capacity = %d +} +`, r.template(data), data.RandomInteger, sku, capacity) +} + func (r WebPubsubResource) complete(data acceptance.TestData) string { return fmt.Sprintf(` %s diff --git a/website/docs/r/signalr_service.html.markdown b/website/docs/r/signalr_service.html.markdown index f2e1549d43c5..963898a6a572 100644 --- a/website/docs/r/signalr_service.html.markdown +++ b/website/docs/r/signalr_service.html.markdown @@ -129,9 +129,11 @@ A `live_trace` block supports the following: A `sku` block supports the following: -* `name` - (Required) Specifies which tier to use. Valid values are `Free_F1`, `Standard_S1` and `Premium_P1`. +* `name` - (Required) Specifies which tier to use. Valid values are `Free_F1`, `Standard_S1`, `Premium_P1` and `Premium_P2`. -* `capacity` - (Required) Specifies the number of units associated with this SignalR service. Valid values are `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `20`, `30`, `40`, `50`, `60`, `70`, `80`, `90` and `100`. +* `capacity` - (Required) Specifies the number of units associated with this SignalR service. Valid values are `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `20`, `30`, `40`, `50`, `60`, `70`, `80`, `90`, `100`, `200`, `300`, `400`, `500`, `600`, `700`, `800`, `900` and `1000`. + +~> **NOTE:** The valid unit range for sku `Free_F1` is `1`, for sku `Premium_P2` is from `100` to `1000`, and from `1` to `100` for `Standard_S1` and `Premium_P1` . --- diff --git a/website/docs/r/web_pubsub.html.markdown b/website/docs/r/web_pubsub.html.markdown index 7ebef29d015e..252bf172a3c9 100644 --- a/website/docs/r/web_pubsub.html.markdown +++ b/website/docs/r/web_pubsub.html.markdown @@ -50,9 +50,11 @@ The following arguments are supported: * `location` - (Required) Specifies the supported Azure location where the Web PubSub service exists. Changing this forces a new resource to be created. -* `sku` - (Required) Specifies which SKU to use. Possible values are `Free_F1`, `Standard_S1`, and `Premium_P1`. +* `sku` - (Required) Specifies which SKU to use. Possible values are `Free_F1`, `Standard_S1`, `Premium_P1` and `Premium_P2`. -* `capacity` - (Optional) Specifies the number of units associated with this Web PubSub resource. Valid values are: Free: `1`, Standard: `1`, `2`, `5`, `10`, `20`, `50`, `100`. +* `capacity` - (Optional) Specifies the number of units associated with this Web PubSub resource. Valid values are `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `20`, `30`, `40`, `50`, `60`, `70`, `80`, `90`, `100`, `200`, `300`, `400`, `500`, `600`, `700`, `800`, `900` and `1000`. + +~> **NOTE:** The valid capacity range for sku `Free_F1` is `1`, for sku `Premium_P2` is from `100` to `1000`, and from `1` to `100` for `Standard_S1` and `Premium_P1` . * `public_network_access_enabled` - (Optional) Whether to enable public network access? Defaults to `true`. From 69e70d89cfffe92792b20cefa466a41d245f499c Mon Sep 17 00:00:00 2001 From: "Xiaxin Yi (from Dev Box)" Date: Thu, 11 Apr 2024 17:14:51 +0800 Subject: [PATCH 2/2] update docs --- website/docs/r/signalr_service.html.markdown | 2 +- website/docs/r/web_pubsub.html.markdown | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/r/signalr_service.html.markdown b/website/docs/r/signalr_service.html.markdown index 963898a6a572..ea6e5aa12e11 100644 --- a/website/docs/r/signalr_service.html.markdown +++ b/website/docs/r/signalr_service.html.markdown @@ -133,7 +133,7 @@ A `sku` block supports the following: * `capacity` - (Required) Specifies the number of units associated with this SignalR service. Valid values are `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `20`, `30`, `40`, `50`, `60`, `70`, `80`, `90`, `100`, `200`, `300`, `400`, `500`, `600`, `700`, `800`, `900` and `1000`. -~> **NOTE:** The valid unit range for sku `Free_F1` is `1`, for sku `Premium_P2` is from `100` to `1000`, and from `1` to `100` for `Standard_S1` and `Premium_P1` . +~> **NOTE:** The valid capacity range for sku `Free_F1` is `1`, for sku `Premium_P2` is from `100` to `1000`, and from `1` to `100` for sku `Standard_S1` and `Premium_P1`. --- diff --git a/website/docs/r/web_pubsub.html.markdown b/website/docs/r/web_pubsub.html.markdown index 252bf172a3c9..58c69b7076c3 100644 --- a/website/docs/r/web_pubsub.html.markdown +++ b/website/docs/r/web_pubsub.html.markdown @@ -54,7 +54,7 @@ The following arguments are supported: * `capacity` - (Optional) Specifies the number of units associated with this Web PubSub resource. Valid values are `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `20`, `30`, `40`, `50`, `60`, `70`, `80`, `90`, `100`, `200`, `300`, `400`, `500`, `600`, `700`, `800`, `900` and `1000`. -~> **NOTE:** The valid capacity range for sku `Free_F1` is `1`, for sku `Premium_P2` is from `100` to `1000`, and from `1` to `100` for `Standard_S1` and `Premium_P1` . +~> **NOTE:** The valid capacity range for sku `Free_F1` is `1`, for sku `Premium_P2` is from `100` to `1000`, and from `1` to `100` for sku `Standard_S1` and `Premium_P1`. * `public_network_access_enabled` - (Optional) Whether to enable public network access? Defaults to `true`.