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

azurerm_mssql_elasticpool : fix Hyperscale tier license_type error #23256

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
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