2017-12-12 9 views
-2

Terraformを使用して、複数のBastionサーバー+ Azureに設定された可用性を設定することができれば、不思議です。私は与えられた可用性セット内の要塞ノードを列挙したいが、ロードバランサを使いたくない。どの例を共有してもいいですか?Azure + TerraformとMultiple Bastion Instances

ありがとうございます!

+1

おそらくスタックオーバーフローはコード作成サービスではありません。あなたは何を試しましたか?何ができませんか? – 4c74356b41

+0

あなたの質問はトピック外です。 https://stackoverflow.com/help/on-topicをご覧ください。 –

答えて

0

私の質問に答える:

はい、それは公共のIPアドレスを持つ複数の砦ノードを持つことが可能です。

設定例:

ファイル:nic.tf

resource "azurerm_network_interface" "bastion_nic" { name   
= "bastionnic${count.index + 1}" location     = "${azurerm_resource_group.rg.location}" resource_group_name  = "${azurerm_resource_group.rg.name}" network_security_group_id = "${azurerm_network_security_group.broker_nsg.id}" count    
= "${var.bastion_instance_count}" 

    ip_configuration { 
    name       = "bastionip${count.index + 1}" 
    subnet_id      = "${azurerm_subnet.broker_subnet.id}" 
    private_ip_address_allocation = "Dynamic" 
    public_ip_address_id   = "${element(azurerm_public_ip.bastion_pip.*.id, count.index + 1)}" } } 

ファイル:ファイル

resource "azurerm_public_ip" "bastion_pip" { 
    name       = "bastionpip${ count.index + 1}" 
    resource_group_name   = "${azurerm_resource_group.rg.name}" 
    location      = "${azurerm_resource_group.rg.location}" 
    public_ip_address_allocation = "Static" 
    domain_name_label   = "${var.kafka_cluster_prefix}-bastion${ count.index + 1}" 
    count       = "${var.bastion_instance_count}" 
} 

ip.tf:bastion.tf

resource "azurerm_virtual_machine" "bastion" { 
    name        = "bastion${count.index + 1}" 
    count       = "${var.bastion_instance_count}" 
    location       = "${azurerm_resource_group.rg.location}" 
    availability_set_id    = "${azurerm_availability_set.bastion.id}" 
    resource_group_name    = "${azurerm_resource_group.rg.name}" 
    network_interface_ids   = ["${element(azurerm_network_interface.bastion_nic.*.id, count.index + 1)}"] 
    vm_size       = "${var.bastion_vm_size}" 
    delete_os_disk_on_termination = true 
    delete_data_disks_on_termination = true 
} 

ファイル:

resource "azurerm_availability_set" "bastion" { 
    name    = "bastionavailabilityset" 
    managed    = "true" 
    resource_group_name = "${azurerm_resource_group.rg.name}" 
    location   = "${azurerm_resource_group.rg.location}" 
} 

availability.tfあなたが例に従うならば、あなたは可用性のセットでのパブリックIPアドレスを持つ複数の砦・ノードを展開することができます。あなたのvariables.tf

乾杯で

変数 "bastion_instance_count":あなたは、次の内容を定義する必要があります。助けが必要な場合は私にpingしてください。

関連する問題