John Delisle
John Delisle

Reputation: 103

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!

Upvotes: 2

Views: 3770

Answers (3)

James Bristow
James Bristow

Reputation: 51

Hashicorp's site doesn't make this setting clear. The setting description is present, but the expanded description of the possible values is not. Combining Hashicorp's site with Microsoft's, we get:

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

  • 'LicenseIncluded' if you need a license
  • 'BasePrice' if you have a license and are eligible for the Azure Hybrid Benefit

Sources:

Upvotes: 3

Josh Johanning
Josh Johanning

Reputation: 1245

Why does it seem LicenseIncluded = the "Save Money" box being unchecked. I would have thought LicenseIncluded would have add the box checked and BasePrice would be unchecked, but in practice it is the opposite.

Upvotes: 0

Alexey Auslender
Alexey Auslender

Reputation: 516

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

Upvotes: 1

Related Questions