From 4a371c1fc4595d0c861e19e07d4865ca97a62b71 Mon Sep 17 00:00:00 2001 From: Matthew Date: Tue, 6 Dec 2022 17:09:01 -0800 Subject: [PATCH] Prevent license_type from being configured in specific scenarios --- internal/services/mssql/mssql_elasticpool_resource.go | 8 ++++++++ website/docs/r/mssql_elasticpool.html.markdown | 2 ++ 2 files changed, 10 insertions(+) diff --git a/internal/services/mssql/mssql_elasticpool_resource.go b/internal/services/mssql/mssql_elasticpool_resource.go index 6b56fbfd88a8..fdfbd85890dd 100644 --- a/internal/services/mssql/mssql_elasticpool_resource.go +++ b/internal/services/mssql/mssql_elasticpool_resource.go @@ -229,6 +229,14 @@ func resourceMsSqlElasticPoolCreateUpdate(d *pluginsdk.ResourceData, meta interf }, } + if _, ok := d.GetOk("license_type"); ok { + if sku.Tier != nil && (*sku.Tier == "GeneralPurpose" || *sku.Tier == "BusinessCritical") { + 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`") + } + } + if d.HasChange("max_size_gb") { if v, ok := d.GetOk("max_size_gb"); ok { maxSizeBytes := v.(float64) * 1073741824 diff --git a/website/docs/r/mssql_elasticpool.html.markdown b/website/docs/r/mssql_elasticpool.html.markdown index 6339d7611cd7..4d6cf8f763de 100644 --- a/website/docs/r/mssql_elasticpool.html.markdown +++ b/website/docs/r/mssql_elasticpool.html.markdown @@ -79,6 +79,8 @@ 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` + --- `sku` supports the following: