Issue:
The MySQL database cannot be found. I am trying to update my threat detection policy on a MySQL database within a server. I am using Terraform to deploy and update this resource. This error only occurs when the last three lines on the threat detection policy code is commented in.
'retention_days = 7
storage_account_access_key = var.storage_account_access_key
storage_endpoint = data.azurerm_storage_account.sta.primary_blob_endpoint`
The sample from my Terraform code is below. See Terraform documentation for more details.
Code:
resource "azurerm_mysql_server" "mysql" {
name = "azmsql${var.location_code}${var.mysqlname}${var.resource_count}"
location = var.location
resource_group_name = var.resource_group_name
sku_name = var.sku_name
administrator_login = var.administrator_login
administrator_login_password = random_password.admin_password.result
version = "8.0"
ssl_enforcement_enabled = true
infrastructure_encryption_enabled = true
auto_grow_enabled = true
storage_mb = 5120
backup_retention_days = 7
geo_redundant_backup_enabled = false
threat_detection_policy {
enabled = true
email_account_admins = true
email_addresses = [var.threat_protection_email]
retention_days = 7
storage_account_access_key = var.storage_account_access_key
storage_endpoint = data.azurerm_storage_account.sta.primary_blob_endpoint
}
}
Error Log:
https://gist.github.com/jmeadowcroft/7944fdcab9870b2eacbc5d0113913a40
Error in Azure:
In the Portal, the failed task of updating the threat detection policy says:
"statusMessage": "{"status":"Failed","error":{"code":"ResourceOperationFailure","message":"The resource operation completed with terminal provisioning state 'Failed'.","details":[{"code":"InternalServerError","message":"An unexpected error occured while processing the request. Tracking ID: '661fa012-c37a-452c-8e82-92efe9ea7827'"}]}}"
Error in on the CLI using Terrraform:
Error: error waiting for creation/update of mysql server security alert policy (server "azmsqlwu2db4001", resource group "Test01"): Code="InternalServerError" Message="An unexpected error occured while processing the request. Tracking ID: '0e302d66-3ff7-49ff-b35a-806afe701423'"
on ....\mysql\mysql.tf line 10, in resource "azurerm_mysql_server" "mysql":
10: resource "azurerm_mysql_server" "mysql"
Let me know if there is any information I can give you about this problem. Thank you for your time.