diff --git a/modules/mssql-server/src/main.tf b/modules/mssql-server/src/main.tf index e13045d..c85fca7 100644 --- a/modules/mssql-server/src/main.tf +++ b/modules/mssql-server/src/main.tf @@ -5,17 +5,17 @@ resource "azurerm_mssql_server" "main" { minimum_tls_version = var.minimum_tls_version version = var.sql_server_version - administrator_login = var.azuread_authentication_only ? null : var.administrator_login - administrator_login_password = var.azuread_authentication_only ? null : var.administrator_password + administrator_login = var.administrator_login + administrator_login_password = var.administrator_password identity { type = "SystemAssigned" } dynamic "azuread_administrator" { - for_each = var.azuread_authentication_only ? [{}] : [] + for_each = var.azuread_administrator != null ? [{}] : [] content { - azuread_authentication_only = var.azuread_authentication_only + azuread_authentication_only = var.azuread_administrator.azuread_authentication_only login_username = var.azuread_administrator.login_username object_id = var.azuread_administrator.object_id } diff --git a/modules/mssql-server/src/variables.tf b/modules/mssql-server/src/variables.tf index b2f38d5..0b4d707 100644 --- a/modules/mssql-server/src/variables.tf +++ b/modules/mssql-server/src/variables.tf @@ -5,23 +5,16 @@ variable "administrator_password" { variable "administrator_login" { type = string - default = "sqladmin" -} - -variable "azuread_authentication_only" { - type = bool - default = true + default = null } variable "azuread_administrator" { type = object({ - login_username = string - object_id = string + azuread_authentication_only = bool + login_username = string + object_id = string }) - default = { - login_username = null - object_id = null - } + default = null } variable "environment" {