Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a Service Fabric cluster with Terraform

I'm trying to create a Service Fabric cluster in Azure with a Terraform script. The Azure service provider in Terraform has released a "Service Fabric Cluster" (azurerm_service_fabric_cluster) resource. That resource only creates the service fabric management part, ie not the vm scale sets, or networking resources.

How do I create a working SF cluster via Terraform?

like image 460
Tvo Avatar asked Nov 07 '22 02:11

Tvo


1 Answers

Terraform azurerm_service_fabric_cluster resource only provisions the Management. To provision the nodes, Deploy the VMSS with service fabric extension which configures the SF Nodes.

Refer the example on the official provider GitHub for information.

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
    })
  }
like image 184
user13657649 Avatar answered Nov 15 '22 08:11

user13657649