0

我在故障转移组配置中有两个 Azure SQL DB。主要位于美国中部,次要位于美国东部 2。我正在尝试将两个数据库的 SKU 从标准层 S3 升级到 vCore 购买模型“业务关键”Gen5_2 我有两个代码块,一个用于主要 SQL 数据库另一个用于辅助 SQL 数据库。辅助 SQL 数据库是作为故障转移组的一部分从主数据库创建的

resource "azurerm_mssql_database" "primary" {
  server_id                   = azurerm_mssql_server.primary.id
  name                        = module.names-mssql-server-database.results
  tags                        = data.azurerm_resource_group.default.tags
  zone_redundant              = false
  create_mode                 = "Default"
  creation_source_database_id = null
  license_type                = "LicenseIncluded"
  collation                   = "SQL_Latin1_General_CP1_CI_AS"
  sku_name                    = "BC_Gen5_2"
  max_size_gb                 = 50
  extended_auditing_policy {
    storage_endpoint  = module.storage.storage_account.self.primary_blob_endpoint
    storage_account_access_key = module.storage.storage_account.self.primary_access_key
    storage_account_access_key_is_secondary = false
    retention_in_days = 30
  }
  threat_detection_policy {
    state                      = "Enabled"
    storage_endpoint           = module.storage.storage_account.self.primary_blob_endpoint
    storage_account_access_key = module.storage.storage_account.self.primary_access_key
    email_account_admins       = "Enabled"
    email_addresses            = ["tech@contoso.com"]
    use_server_default         = "Disabled"
    retention_days             = 30
  }
  long_term_retention_policy {
    yearly_retention  = "P10Y"
    monthly_retention = "P12M"
    weekly_retention  = "P6W"
    week_of_year      = "16"
  }
  lifecycle {
    ignore_changes = [license_type]
  }
}


resource "azurerm_mssql_database" "secondary" {
  name                        = azurerm_mssql_database.primary.name
  server_id                   = azurerm_mssql_server.secondary.id
  create_mode                 = "Secondary"
  creation_source_database_id = azurerm_mssql_database.primary.id
  sku_name                    = "BC_Gen5_2"
}

如果我尝试更改我的数据库层,我得到的错误是:

等待创建 MsSql 数据库“sqldb-qb2-productionstatistics-qa-001”(MsSql 服务器名称“sql-qb2-qa-cus-001”/资源组“rg-qb2-qa-cus-001”):代码= "SourceDatabaseEditionCouldNotBeUpgraded" Message="源数据库 'sql-qb2-qa-cus-001.sqldb-qb2-qa-001' 的版本不能高于目标数据库 'sql-qb2-secondary-qa-cus-061a.sqldb -qb2-qa-001'。在升级源之前升级目标上的版本。

我尝试将新 SKU 放在辅助设备上,就像上面错误中提到的那样,但是如果我这样做,它会抛出这个错误:

Error: could not configure auditing policies on SQL Database "sqldb-qb2-dev-001" (Resource Group "rg-qb2-dev-cus-001", Server "sql-qb2-secondary-dev-cus-83bc") in secondary create mode
│ 
│   with azurerm_mssql_database.secondary,
│   on resources.sql.tf line 139, in resource "azurerm_mssql_database" "secondary":
│  139: resource "azurerm_mssql_database" "secondary" {
4

0 回答 0