我已经成功部署了Service Fabric,但仍在努力使其与虚拟机规模集进行通信。所有节点均已部署,但未与Service Fabric通信。
我尝试向资源中添加更多参数,但是不幸的是,我收到了非常la脚的错误消息,这没有任何意义。
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"?
您可以看到错误消息根本不是很有帮助。
有人可以帮我吗?
谢谢
答案 0 :(得分:0)
Terraform模板与ARM模板的语法有点相似。对于错误消息,您可以通过删除“ os_profile_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和实例,here是部署Linux节点的示例,供您参考。