使用Terraform创建Service Fabric集群

时间:2018-09-18 15:24:03

标签: terraform azure-service-fabric terraform-provider-azure

我正在尝试使用Terraform脚本在Azure中创建Service Fabric群集。 Terraform中的Azure service provider已发布“服务结构群集”(azurerm_service_fabric_cluster)资源。该资源仅创建服务结构管理部分,即不创建虚拟机规模集或网络资源。

如何通过Terraform创建有效的SF集群?

1 个答案:

答案 0 :(得分:1)

Terraform azurerm_service_fabric_cluster 资源仅提供管理。要配置节点,请使用配置 SF 节点的服务结构扩展部署 VMSS。

参考官方提供者 GitHub 上的示例以获取信息。

https://github.com/terraform-providers/terraform-provider-azurerm/tree/master/examples/service-fabric/windows-vmss-self-signed-certs

extension {
    name                       = "${var.prefix}ServiceFabricNode"
    publisher                  = "Microsoft.Azure.ServiceFabric"
    type                       = "ServiceFabricNode"
    type_handler_version       = "1.1"
    auto_upgrade_minor_version = false

    settings = jsonencode({
      "clusterEndpoint"    = azurerm_service_fabric_cluster.example.cluster_endpoint
      "nodeTypeRef"        = azurerm_service_fabric_cluster.example.node_type[0].name
      "durabilityLevel"    = "bronze"
      "nicPrefixOverride"  = azurerm_subnet.example.address_prefixes[0]
      "enableParallelJobs" = true
      "certificate" = {
        "commonNames" = [
          "${var.prefix}servicefabric.${var.location}.cloudapp.azure.com",
        ]
        "x509StoreName" = "My"
      }
    })

    protected_settings = jsonencode({
      "StorageAccountKey1" = azurerm_storage_account.example.primary_access_key
      "StorageAccountKey2" = azurerm_storage_account.example.secondary_access_key
    })
  }
相关问题