Terraform 使用虚拟机规模集部署服务结构

Terraform 使用虚拟机规模集部署服务结构,terraform,azure-service-fabric,terraform-provider-azure,Terraform,Azure Service Fabric,Terraform Provider Azure,我已经成功地部署了我的服务结构,但很难让它与虚拟机规模集通信。所有节点都已部署,但它们未与服务结构通信 我已经尝试向我的资源中添加更多参数,但不幸的是,我收到了一条毫无意义的错误消息 resource "azurerm_service_fabric_cluster" "brcgs-ngd-dev" { name = "BRCGS-NGD-${var.environment}-SF" resourc

我已经成功地部署了我的服务结构,但很难让它与虚拟机规模集通信。所有节点都已部署,但它们未与服务结构通信

我已经尝试向我的资源中添加更多参数,但不幸的是,我收到了一条毫无意义的错误消息

resource "azurerm_service_fabric_cluster" "brcgs-ngd-dev" {
  name                 = "BRCGS-NGD-${var.environment}-SF"
  resource_group_name  = var.resource_group_name
  location             = var.location
  reliability_level    = "Bronze"
  upgrade_mode         = "Automatic"
  vm_image             = "Windows"
  management_endpoint  = "https://example.com/Explorer"

    node_type { 
      name = "sfNodes"
      instance_count = 3
      is_primary = true
      client_endpoint_port = "19000"
      http_endpoint_port = "19080"
    }
  fabric_settings {
    name = "Security"
    parameters = {
      "ClusterProtectionLevel" = "EncryptAndSign"
    }
  }
  certificate {
      thumbprint = "example"
      thumbprint_secondary = "example"
      x509_store_name = "my"
  }
}
resource "azurerm_virtual_machine_scale_set" "sf-nodes" {
  name                = "sfNodes"
  location            = var.location
  resource_group_name = var.resource_group_name
  upgrade_policy_mode  = "automatic"

   sku {
    name     = "Standard_D1_V2"
    tier     = "Standard"
    capacity = 3
  }
  storage_profile_image_reference {
    publisher = "MicrosoftWindowsServer"
    offer     = "WindowsServerSemiAnnual"
    sku       = "Datacenter-Core-1803-with-Containers-smalldisk"
    version   = "latest"
  }
  storage_profile_os_disk {
    os_type = "Windows"
    caching           = "ReadOnly"
    create_option     = "FromImage"
    managed_disk_type = "Standard_LRS"
  }
  os_profile {
    computer_name_prefix = "sfNodes"
    admin_username       = "brcgsdev"
    admin_password  = var.adminpassword
  }
  os_profile_secrets = [
    {
      source_vault_id = "/subscriptions/exampleid/resourceGroups/rg-ngd-mig-inf-01/providers/Microsoft.KeyVault/vaults/kv-ngd-mig-infra"
      vault_certificates = [
        {
          certificate_url = "https://example/certificates/cert/c5326f869a624079a0f1f48afe525331"
          certificate_store = "My"
        }
      ]
    }
  ]
  network_profile {
     name = "NIC-brcgs-ngd-${var.environment}-sf-0"
     primary = "true"

    ip_configuration { 
      primary = "true"
      name = "NIC-brcgs-ngd-${var.environment}-sf-0"
      subnet_id = var.subnet_id
      load_balancer_backend_address_pool_ids = [var.backendlb]
   }
  }
  extension { # This extension connects vms to the cluster.
    name                 = "ServiceFabricNodeVMscalesets"
    publisher            = "Microsoft.Azure.ServiceFabric"
    type                 = "ServiceFabricNode"
    type_handler_version = "1.0"
    settings             = "{  \"certificate\": { \"thumbprint\": \"example\", \"x509StoreName\": \"My\" } , \"clusterEndpoint\": \"example.uksouth.cloudapp.azure.com:19000\", \"nodeTypeRef\": \"sfNodes\", \"dataPath\": \"D:\\\\SvcFab\",\"durabilityLevel\": \"Bronze\",\"nicPrefixOverride\": \"******\"}"
  }
}
我收到的错误消息是

Error: Unsupported argument

  on servicefabric\main.tf line 57, in resource "azurerm_virtual_machine_scale_set" "sf-nodes":
  57:   os_profile_secrets = [

An argument named "os_profile_secrets" is not expected here. Did you mean to
define a block of type "os_profile_secrets"?
正如您所看到的,错误消息根本没有什么帮助

有人能帮我吗


谢谢

Terraform模板的语法与ARM模板有点类似。对于错误消息,您可以通过删除“
=
”将
os\u profile\u secrets
定义为一个块。看起来是这样的:

  os_profile_secrets  {
      source_vault_id = "/subscriptions/exampleid/resourceGroups/rg-ngd-mig-inf-01/providers/Microsoft.KeyVault/vaults/kv-ngd-mig-infra"
      vault_certificates  {
          certificate_url = "https://example/certificates/cert/c5326f869a624079a0f1f48afe525331"
          certificate_store = "My"
        }
      
    }
  

要使用Terraform部署Service Fabric和实例,请举一个部署Linux节点的示例,以供参考。

此问题是否已修复?