Skip to content

Commit

Permalink
fix(database): license type should be managed by owner of existing li…
Browse files Browse the repository at this point in the history
…cense (#159)

Setting license type to `LicenseIncluded` would apply an existing license to this SQL database and enable the Azure Hybrid Benefit discount. This should only be configured by the owner of the existing license, e.g. the platform team.

BREAKING CHANGE: remove variable `license_type` for submodule `database`.
  • Loading branch information
hknutsen authored Nov 15, 2024
1 parent 4fc8a37 commit 9d38300
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 8 additions & 2 deletions modules/database/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ resource "azurerm_mssql_database" "this" {
enclave_type = var.enclave_type
maintenance_configuration_name = var.elastic_pool_id == null ? var.maintenance_configuration_name : null # Conflicts with elastic pool
ledger_enabled = var.ledger_enabled
license_type = var.license_type
max_size_gb = var.max_size_gb
sku_name = var.elastic_pool_id == null ? var.sku_name : "ElasticPool"
storage_account_type = var.storage_account_type

# Should be managed by owner of existing license, usually platform team.
license_type = null

tags = var.tags

short_term_retention_policy {
Expand Down Expand Up @@ -52,8 +54,12 @@ resource "azurerm_mssql_database" "this" {
lifecycle {
# Protect database from accidental deletion
prevent_destroy = true
}

ignore_changes = [
# Should be managed by owner of existing license, usually platform team.
license_type
]
}
}

resource "azurerm_monitor_diagnostic_setting" "this" {
Expand Down
6 changes: 0 additions & 6 deletions modules/database/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ variable "ledger_enabled" {
default = false
}

variable "license_type" {
description = "Specifies a license type for this SQL database."
type = string
default = null
}

variable "max_size_gb" {
description = "Sets a maximum possible size for this SQL database."
type = number
Expand Down

0 comments on commit 9d38300

Please sign in to comment.