azure-sql-databaseterraform-provider-azureazure-elasticpool

Setting LicenseType property of Azure SQL Database to enable Azure Hybrid Use Benefit (AHUB) using Terraform?


Using Terraform, how do I set the Azure SQL Database (and Azure Elastic Pool) LicenseType property to enable Azure Hybrid Use Benefit (aka AHUB, aka AHB)?

Here's an example using Powershell:

# Azure SQL Database:
Set-AzSqlDatabase -DatabaseName $sqlDb.DatabaseName -ResourceGroupName $sqlDb.ResourceGroupName -ServerName $sqlDb.ServerName -LicenseType "BasePrice"

# Azure SQL Database Elastic Pool:
Set-AzSqlElasticPool -ElasticPoolName $elasticPool.elasticPoolName -ResourceGroupName $elasticPool.ResourceGroupName -ServerName $elasticPool.ServerName -LicenseType "BasePrice"

The property is easily set using Az CLI too.

This is a very important property (from a cost perspective) and I cannot find mention of it anywhere in the context of Terraform.

Thanks!


Solution

  • From Terraform documentation

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

    Here is the link https://www.terraform.io/docs/providers/azurerm/r/mssql_elasticpool.html#license_type