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 - Prevent license_type from being configured in specific scenarios #19586

Merged
merged 1 commit into from
Dec 7, 2022
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
8 changes: 8 additions & 0 deletions internal/services/mssql/mssql_elasticpool_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/mssql_elasticpool.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down