我正在嘗試創建一個基礎架構,以使用資料同步將 azure 資料庫與本地資料庫同步。
我的下一步是創建一個“資料同步組”,但我不知道該怎么做。
是否可以使用 Terraform 創建此基礎架構?
uj5u.com熱心網友回復:
目前,可以通過Portal 或 ARM 模板創建資料同步組。如果你想使用 Terraform,那么你可以使用如下:azurerm_resource_group_template_deployment
locals {
syncdatabaseId = "id"
}
resource "azurerm_resource_group_template_deployment" "example" {
name = "example-deploy"
resource_group_name = "example-group"
deployment_mode = "Incremental"
parameters_content = jsonencode({
"syncdatabaseId" = {
value = local.syncdatabaseId
}
})
template_content = <<TEMPLATE
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"syncdatabaseId": {
"type": "string",
"metadata": {
"description": "id of the database"
}
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.Sql/servers/databases/syncGroups",
"apiVersion": "2021-05-01-preview",
"name": "string",
"sku": {
"capacity": "int",
"family": "string",
"name": "string",
"size": "string",
"tier": "string"
},
"properties": {
"conflictLoggingRetentionInDays": "int",
"conflictResolutionPolicy": "string",
"enableConflictLogging": "bool",
"hubDatabasePassword": "string",
"hubDatabaseUserName": "string",
"interval": "int",
"schema": {
"masterSyncMemberName": "string",
"tables": [
{
"columns": [
{
"dataSize": "string",
"dataType": "string",
"quotedName": "string"
}
],
"quotedName": "string"
}
]
},
"syncDatabaseId": "[parameters('syncdatabaseId')]",
"usePrivateLinkConnection": "bool"
}
}
]
}
TEMPLATE
// NOTE: whilst we show an inline template here, we recommend
// sourcing this from a file for readability/editor support
}
參考:
ARM 模板 Data Sync Group和Data Sync Group Members
azurerm_resource_group_template_deployment | 資源 | hashicorp/azurerm | Terraform 注冊表
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/402134.html
標籤:天蓝色 地形 terraform-provider-azure
