Skip to content

Commit

Permalink
Merge pull request #23256 from sinbai/mssql/fix_issue_23187
Browse files Browse the repository at this point in the history
`azurerm_mssql_elasticpool` : fix `Hyperscale` tier `license_type` error
  • Loading branch information
tombuildsstuff authored Sep 13, 2023
2 parents 39d98c8 + b0dee75 commit 48e74ca
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions internal/services/mssql/mssql_elasticpool_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,10 @@ func resourceMsSqlElasticPoolCreateUpdate(d *pluginsdk.ResourceData, meta interf
}

if _, ok := d.GetOk("license_type"); ok {
if sku.Tier != nil && (*sku.Tier == "GeneralPurpose" || *sku.Tier == "BusinessCritical") {
if sku.Tier != nil && (*sku.Tier == "GeneralPurpose" || *sku.Tier == "BusinessCritical" || *sku.Tier == "Hyperscale") {
elasticPool.ElasticPoolProperties.LicenseType = sql.ElasticPoolLicenseType(d.Get("license_type").(string))
} else {
return fmt.Errorf("`license_type` can only be configured when `sku.0.tier` is set to `GeneralPurpose` or `BusinessCritical`")
return fmt.Errorf("`license_type` can only be configured when `sku.0.tier` is set to `GeneralPurpose`, `Hyperscale` or `BusinessCritical`")
}
}

Expand Down
26 changes: 17 additions & 9 deletions internal/services/mssql/mssql_elasticpool_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,13 @@ func TestAccMsSqlElasticPool_hyperScale(t *testing.T) {
),
},
data.ImportStep("max_size_gb"),
{
Config: r.hyperScaleUpdate(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep("max_size_gb"),
})
}

Expand Down Expand Up @@ -376,13 +383,12 @@ resource "azurerm_mssql_server" "test" {
}
resource "azurerm_mssql_elasticpool" "test" {
name = "acctest-pool-dtu-%[1]d"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
server_name = azurerm_mssql_server.test.name
max_size_gb = %.7[6]f
zone_redundant = %[9]t
name = "acctest-pool-dtu-%[1]d"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
server_name = azurerm_mssql_server.test.name
max_size_gb = %.7[6]f
zone_redundant = %[9]t
maintenance_configuration_name = "%[10]s"
sku {
Expand Down Expand Up @@ -425,7 +431,6 @@ resource "azurerm_mssql_elasticpool" "test" {
location = azurerm_resource_group.test.location
server_name = azurerm_mssql_server.test.name
max_size_gb = 5
sku {
name = "%[3]s"
tier = "%[4]s"
Expand Down Expand Up @@ -508,7 +513,6 @@ resource "azurerm_mssql_elasticpool" "test" {
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
server_name = azurerm_mssql_server.test.name
sku {
name = "%[3]s"
tier = "%[4]s"
Expand Down Expand Up @@ -572,3 +576,7 @@ resource "azurerm_mssql_elasticpool" "test" {
func (r MsSqlElasticPoolResource) hyperScale(data acceptance.TestData) string {
return r.templateHyperScale(data, "HS_Gen5", "Hyperscale", 4, "Gen5", 0.25, 4)
}

func (r MsSqlElasticPoolResource) hyperScaleUpdate(data acceptance.TestData) string {
return r.templateHyperScale(data, "HS_Gen5", "Hyperscale", 4, "Gen5", 0, 4)
}
2 changes: 1 addition & 1 deletion website/docs/r/mssql_elasticpool.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ The following arguments are supported:

* `license_type` - (Optional) Specifies the license type applied to this database. Possible values are `LicenseIncluded` and `BasePrice`.

-> **Note:** `license_type` can only be configured when `sku.0.tier` is set to `GeneralPurpose` or `BusinessCritical`
-> **Note:** `license_type` can only be configured when `sku.0.tier` is set to `GeneralPurpose`, `Hyperscale` or `BusinessCritical`

---

Expand Down

0 comments on commit 48e74ca

Please sign in to comment.