Skip to content

Commit faba4b0

Browse files
committed
module update
1 parent 654dfd8 commit faba4b0

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

main.tf

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,29 @@ resource "azurerm_sql_server" "primary" {
6363
administrator_login_password = random_password.main.result
6464
tags = merge({ "Name" = format("%s-primary", var.sqlserver_name) }, var.tags, )
6565

66-
dynamic "extended_auditing_policy" {
66+
/* dynamic "extended_auditing_policy" {
6767
for_each = local.if_extended_auditing_policy_enabled
6868
content {
6969
storage_account_access_key = azurerm_storage_account.storeacc.0.primary_access_key
7070
storage_endpoint = azurerm_storage_account.storeacc.0.primary_blob_endpoint
7171
retention_in_days = var.log_retention_days
7272
}
73+
} */
74+
}
75+
76+
resource "azurerm_mssql_server_extended_auditing_policy" "main" {
77+
for_each = local.if_extended_auditing_policy_enabled
78+
content {
79+
server_id = var.enable_failover_group == true ? [azurerm_sql_server.primary.id, azurerm_sql_server.secondary.id] : [azurerm_sql_server.primary.id]
80+
storage_endpoint = azurerm_storage_account.storeacc.0.primary_blob_endpoint
81+
storage_account_access_key = azurerm_storage_account.storeacc.0.primary_access_key
82+
storage_account_access_key_is_secondary = false
83+
retention_days = var.log_retention_days
7384
}
85+
7486
}
7587

88+
7689
resource "azurerm_sql_server" "secondary" {
7790
count = var.enable_failover_group ? 1 : 0
7891
name = format("%s-secondary", var.sqlserver_name)

0 commit comments

Comments
 (0)