azure - 创建Sql同步组可以吗?

标签 azure terraform terraform-provider-azure

我正在尝试创建一个基础架构,以使用数据同步将 Azure 数据库与本地数据库同步。

我的下一步是创建一个“数据同步组”,但我不知道该怎么做。

是否可以使用 Terraform 创建此基础设施?

最佳答案

目前, Data Sync Group 可以通过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 | Resources | hashicorp/azurerm | Terraform Registry

关于azure - 创建Sql同步组可以吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70540997/

相关文章:

azure-devops - 目录/home/vsts/work/1/s 不包含 Terraform 配置文件。在 Azure Devops 中尝试创建 Azure 资源

azure - 登台与生产插槽 - Azure Web 应用程序部署

node.js - 应用程序洞察 : CorrelationIdManager error in node js

variables - 如何将 Terraform 配置器 "local-exec"输出存储在本地变量中并使用 "remote-exec"中的变量值

terraform - 如何在 terraform 中加密密码或敏感数据?

amazon-web-services - 如何使用 terraform 在亚马逊 S3 存储桶中创建文件夹

azure - 如何使用服务托管标识通过 Terraform 在 Azure 中配置资源

sql-server - 是否可以使用 Azure DevOps 构建任务将 SQL 脚本部署到多个数据库?

azure - 为什么 Oozie 会抛出 "access denied org.apache.derby.security.SystemPermission( "engine", "usederbyinternals")"?

yaml - 如何在 Terraform 中使用 yaml 文件?