正在为 azurerm_mariadb_virtual_network_rule 创建或更新 "Error waiting for Virtual Network Rule "“(服务器,rg)...”
Getting "Error waiting for Virtual Network Rule "" (server, rg) to be created or updated..." for azurerm_mariadb_virtual_network_rule
我正在为我的基础架构部署构建 Terraform 配置,并尝试根据 documentation 使用 azurerm_mariadb_virtual_network_rule 将 azurerm_mariadb_server 资源连接到 azurerm_subnet ].
vnet、子网、mariadb-server 等都已创建,但我在尝试创建 vnet_rule 时得到以下信息。
Error: Error waiting for MariaDb Virtual Network Rule "vnet-rule" (MariaDb Server: "server", Resource Group: "rg")
to be created or updated: couldn't find resource (21 retries)
on main.tf line 86, in resource "azurerm_mariadb_virtual_network_rule" "vnet_rule":
86: resource "azurerm_mariadb_virtual_network_rule" "mariadb_vnet_rule" {
我无法确定找不到哪个资源 - 根据 bash shell 输出和 Azure 门户,创建了除 azurerm_mariadb_virtual_network_rule 之外的所有资源。
我的配置如下 - 为简洁起见,省略了一些资源的详细信息。
provider "azurerm" {
version = "~> 2.27.0"
features {}
}
resource "azurerm_resource_group" "rg" {
name = "${var.resource_group_name}-rg"
location = var.location
}
resource "azurerm_virtual_network" "vnet" {
resource_group_name = azurerm_resource_group.rg.name
name = "${var.prefix}Vnet"
address_space = ["10.0.0.0/16"]
location = var.location
}
resource "azurerm_subnet" "backend" {
resource_group_name = azurerm_resource_group.rg.name
name = "${var.prefix}backendSubnet"
virtual_network_name = azurerm_virtual_network.vnet.name
address_prefixes = ["10.0.1.0/24"]
service_endpoints = ["Microsoft.Sql"]
}
resource "azurerm_mariadb_server" "server" {
# DB server name can contain lower-case letters, numbers and dashes, NOTHING ELSE
resource_group_name = azurerm_resource_group.rg.name
name = "${var.prefix}-mariadb-server"
location = var.location
sku_name = "B_Gen5_2"
version = "10.3"
ssl_enforcement_enabled = true
}
resource "azurerm_mariadb_database" "mariadb_database" {
resource_group_name = azurerm_resource_group.rg.name
name = "${var.prefix}_mariadb_database"
server_name = azurerm_mariadb_server.server.name
charset = "utf8"
collation = "utf8_general_ci"
}
## Network Service Endpoint (add DB to subnet)
resource "azurerm_mariadb_virtual_network_rule" "vnet_rule" {
resource_group_name = azurerm_resource_group.rg.name
name = "${var.prefix}-mariadb-vnet-rule"
server_name = azurerm_mariadb_server.server.name
subnet_id = azurerm_subnet.backend.id
}
问题似乎出现在 'func resourceArmMariaDbVirtualNetworkRuleCreateUpdate' 内,但我不了解 Go,因此无法确切了解导致问题的原因。
如果有人看到问题,或者知道如何解决这个问题,请告诉我!
此外,我无法通过门户执行此操作 - 第 3 步 here 显示了用于配置 VNET 规则的部分,我的 'Azure database for mariaDB server' 页面上没有该部分。我有全局管理员角色,所以我认为这与权限无关。
重点是
Support for VNet service endpoints is only for General Purpose and
Memory Optimized servers.
因此将代码 sku_name = "B_Gen5_2"
更改为 sku_name = "GP_Gen5_2"
或其他符合条件的 sku_name
。
sku_name - (Required) Specifies the SKU Name for this MariaDB Server.
The name of the SKU, follows the tier + family + cores pattern (e.g.
B_Gen4_1, GP_Gen5_8). For more information see the product
documentation.
部署需要几分钟。
我正在为我的基础架构部署构建 Terraform 配置,并尝试根据 documentation 使用 azurerm_mariadb_virtual_network_rule 将 azurerm_mariadb_server 资源连接到 azurerm_subnet ].
vnet、子网、mariadb-server 等都已创建,但我在尝试创建 vnet_rule 时得到以下信息。
Error: Error waiting for MariaDb Virtual Network Rule "vnet-rule" (MariaDb Server: "server", Resource Group: "rg")
to be created or updated: couldn't find resource (21 retries)
on main.tf line 86, in resource "azurerm_mariadb_virtual_network_rule" "vnet_rule":
86: resource "azurerm_mariadb_virtual_network_rule" "mariadb_vnet_rule" {
我无法确定找不到哪个资源 - 根据 bash shell 输出和 Azure 门户,创建了除 azurerm_mariadb_virtual_network_rule 之外的所有资源。
我的配置如下 - 为简洁起见,省略了一些资源的详细信息。
provider "azurerm" {
version = "~> 2.27.0"
features {}
}
resource "azurerm_resource_group" "rg" {
name = "${var.resource_group_name}-rg"
location = var.location
}
resource "azurerm_virtual_network" "vnet" {
resource_group_name = azurerm_resource_group.rg.name
name = "${var.prefix}Vnet"
address_space = ["10.0.0.0/16"]
location = var.location
}
resource "azurerm_subnet" "backend" {
resource_group_name = azurerm_resource_group.rg.name
name = "${var.prefix}backendSubnet"
virtual_network_name = azurerm_virtual_network.vnet.name
address_prefixes = ["10.0.1.0/24"]
service_endpoints = ["Microsoft.Sql"]
}
resource "azurerm_mariadb_server" "server" {
# DB server name can contain lower-case letters, numbers and dashes, NOTHING ELSE
resource_group_name = azurerm_resource_group.rg.name
name = "${var.prefix}-mariadb-server"
location = var.location
sku_name = "B_Gen5_2"
version = "10.3"
ssl_enforcement_enabled = true
}
resource "azurerm_mariadb_database" "mariadb_database" {
resource_group_name = azurerm_resource_group.rg.name
name = "${var.prefix}_mariadb_database"
server_name = azurerm_mariadb_server.server.name
charset = "utf8"
collation = "utf8_general_ci"
}
## Network Service Endpoint (add DB to subnet)
resource "azurerm_mariadb_virtual_network_rule" "vnet_rule" {
resource_group_name = azurerm_resource_group.rg.name
name = "${var.prefix}-mariadb-vnet-rule"
server_name = azurerm_mariadb_server.server.name
subnet_id = azurerm_subnet.backend.id
}
问题似乎出现在 'func resourceArmMariaDbVirtualNetworkRuleCreateUpdate' 内,但我不了解 Go,因此无法确切了解导致问题的原因。 如果有人看到问题,或者知道如何解决这个问题,请告诉我!
此外,我无法通过门户执行此操作 - 第 3 步 here 显示了用于配置 VNET 规则的部分,我的 'Azure database for mariaDB server' 页面上没有该部分。我有全局管理员角色,所以我认为这与权限无关。
重点是
Support for VNet service endpoints is only for General Purpose and Memory Optimized servers.
因此将代码 sku_name = "B_Gen5_2"
更改为 sku_name = "GP_Gen5_2"
或其他符合条件的 sku_name
。
sku_name - (Required) Specifies the SKU Name for this MariaDB Server. The name of the SKU, follows the tier + family + cores pattern (e.g. B_Gen4_1, GP_Gen5_8). For more information see the product documentation.
部署需要几分钟。