Browse Source

fix example

tags/1.1.0
ravi 2 months ago
parent
commit
1e3cda1ba1
2 changed files with 15 additions and 24 deletions
  1. +12
    -21
      examples/x-vms-x-disks-x-netint/deploy.tf
  2. +3
    -3
      main.tf

+ 12
- 21
examples/x-vms-x-disks-x-netint/deploy.tf View File

@@ -75,17 +75,16 @@ module "example" {
env = "test"
}

availability_set_enabled = true
availability_set_name = "tftest${random_string.this.result}"
availability_set_name = "tftest${random_string.this.result}"
availability_set_tags = {
test = "tftest${random_string.this.result}"
}

network_interface_enabled = true
network_interface_count = 2
network_interface_names = ["tftest${random_string.this.result}"]
network_interface_internal_dns_name_labels = ["tftest${random_string.this.result}-first", "tftest${random_string.this.result}-second", "tftest${random_string.this.result}-third", "tftest${random_string.this.result}-1first", "tftest${random_string.this.result}-2second", "tftest${random_string.this.result}-3third"]
network_interface_ip_configuration_names = ["tftest${random_string.this.result}", "tftest${random_string.this.result}2", "tftest${random_string.this.result}3", "tftest${random_string.this.result}4", "tftest${random_string.this.result}5", "tftest${random_string.this.result}6"]
network_interface_count = 1
network_interface_names = ["tftest${random_string.this.result}", "tftest${random_string.this.result}1"]
network_interface_internal_dns_name_labels = ["tftest${random_string.this.result}-first", "tftest${random_string.this.result}-second"]
network_interface_ip_configuration_names = ["tftest${random_string.this.result}", "tftest${random_string.this.result}2"]
network_interface_ip_configuration_subnet_ids = [azurerm_subnet.example.id]
network_interface_tags = {
test = "tftest${random_string.this.result}"
@@ -99,7 +98,7 @@ module "example" {
},
]

network_interface_application_security_group_count = 6
network_interface_application_security_group_count = 2
network_interface_application_security_group_ids = [
{
network_interface_index = 0
@@ -116,19 +115,11 @@ module "example" {
{
network_interface_index = 1
application_security_group_id = azurerm_application_security_group.example2.id
},
{
network_interface_index = 2
application_security_group_id = azurerm_application_security_group.example1.id
},
{
network_interface_index = 2
application_security_group_id = azurerm_application_security_group.example2.id
},
}
]

vm_count = 3
vm_names = ["tftest${random_string.this.result}", "tftest${random_string.this.result}1", "tftest${random_string.this.result}2"]
vm_count = 2
vm_names = ["tftest${random_string.this.result}", "tftest${random_string.this.result}1"]
vm_size = "Standard_F2"
windows_vm_enabled = true
admin_username = "testadmin"
@@ -148,10 +139,10 @@ module "example" {
windows_enable_automatic_updates = true

managed_disk_count = 1
managed_disk_names = ["tftest1${random_string.this.result}ext", "tftest2${random_string.this.result}ext", "tftest3${random_string.this.result}ext"]
managed_disk_names = ["tftest1${random_string.this.result}ext", "tftest2${random_string.this.result}ext"]
managed_disk_storage_account_types = ["Standard_LRS"]
managed_disk_size_gbs = [5, 10, 15]
managed_disk_create_options = ["Empty", "Empty", "Empty"]
managed_disk_size_gbs = [5]
managed_disk_create_options = ["Empty"]
managed_data_disk_cachings = ["ReadWrite"]
managed_data_disk_write_accelerator_enableds = [false]
}

+ 3
- 3
main.tf View File

@@ -426,8 +426,8 @@ resource "azurerm_managed_disk" "this" {
resource "azurerm_virtual_machine_data_disk_attachment" "this" {
count = var.enabled && var.vm_count > 0 ? var.managed_disk_count * var.vm_count : 0

managed_disk_id = element(azurerm_managed_disk.this.*.id, count.index)
virtual_machine_id = var.vm_type == "Windows" ? element(concat(azurerm_windows_virtual_machine.this.*.id, [""]), count.index % var.vm_count) : element(concat(azurerm_linux_virtual_machine.this.*.id, [""]), count.index % var.vm_count)
managed_disk_id = azurerm_managed_disk.this.*.id[count.index]
virtual_machine_id = var.vm_type == "Windows" ? azurerm_windows_virtual_machine.this.*.id[count.index % var.vm_count] : azurerm_linux_virtual_machine.this.*.id[count.index % var.vm_count]

lun = count.index
caching = element(var.managed_data_disk_cachings, floor(count.index / var.vm_count) % var.managed_disk_count)
@@ -447,7 +447,7 @@ resource "azurerm_virtual_machine_extension" "this_extension" {
settings = element(var.vm_extension_settings, floor(count.index / var.vm_count) % var.vm_extension_count)
publisher = element(var.vm_extension_publishers, floor(count.index / var.vm_count) % var.vm_extension_count)
protected_settings = element(var.vm_extension_protected_settings, floor(count.index / var.vm_count) % var.vm_extension_count)
virtual_machine_id = var.vm_type == "Windows" ? element(concat(azurerm_windows_virtual_machine.this.*.id, [""]), count.index % var.vm_count) : element(concat(azurerm_linux_virtual_machine.this.*.id, [""]), count.index % var.vm_count)
virtual_machine_id = var.vm_type == "Windows" ? azurerm_windows_virtual_machine.this.*.id[count.index % var.vm_count] : azurerm_linux_virtual_machine.this.*.id[count.index % var.vm_count]
type_handler_version = element(var.vm_extension_type_handler_versions, floor(count.index / var.vm_count) % var.vm_extension_count)
auto_upgrade_minor_version = element(var.vm_extension_auto_upgarde_minor_version, floor(count.index / var.vm_count) % var.vm_extension_count)



Loading…
Cancel
Save