gpt4 book ai didi

azure - azurerm_mariadb_virtual_network_rule 获取 "Error waiting for Virtual Network Rule "“要创建或更新(服务器,rg)...”

转载 作者:行者123 更新时间:2023-12-03 05:33:33 24 4
gpt4 key购买 nike

我正在为基础架构部署构建 Terraform 配置,并尝试使用 azurerm_mariadb_virtual_network_rule 将 azurerm_mariadb_server 资源连接到 azurerm_subnet,按照 documentation .

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 规则的部分,该部分不存在于我的“用于 mariaDB 服务器的 Azure 数据库”页面上。我具有全局管理员角色,因此我认为这与权限无关。

最佳答案

来自creating and manage Azure Database for MariaDB VNet service endpoints and VNet rules by using the Azure portal

关键是

Support for VNet service endpoints is only for General Purpose andMemory 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 productdocumentation.

部署需要几分钟时间。

enter image description here

关于azure - azurerm_mariadb_virtual_network_rule 获取 "Error waiting for Virtual Network Rule "“要创建或更新(服务器,rg)...”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64011682/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com