From 96cd33dea48d4c8bbbecba79671f7e2fdb0fe395 Mon Sep 17 00:00:00 2001 From: zjhe Date: Sat, 5 Oct 2024 08:50:32 +0800 Subject: [PATCH] fix 301-hub-spoke --- quickstart/301-hub-spoke/hub-nva.tf | 172 +++++++++++++------------- quickstart/301-hub-spoke/hub-vnet.tf | 158 +++++++++++------------ quickstart/301-hub-spoke/main.tf | 11 +- quickstart/301-hub-spoke/on-prem.tf | 164 ++++++++++++------------ quickstart/301-hub-spoke/spoke1.tf | 118 +++++++++--------- quickstart/301-hub-spoke/spoke2.tf | 122 +++++++++--------- quickstart/301-hub-spoke/variables.tf | 16 +-- 7 files changed, 386 insertions(+), 375 deletions(-) diff --git a/quickstart/301-hub-spoke/hub-nva.tf b/quickstart/301-hub-spoke/hub-nva.tf index 31c8ff30..dfbe00ca 100644 --- a/quickstart/301-hub-spoke/hub-nva.tf +++ b/quickstart/301-hub-spoke/hub-nva.tf @@ -1,81 +1,81 @@ locals { - prefix-hub-nva = "hub-nva" - hub-nva-location = "eastus" - hub-nva-resource-group = "hub-nva-rg" + prefix-hub-nva = "hub-nva" + hub-nva-location = "eastus" + hub-nva-resource-group = "hub-nva-rg" } resource "azurerm_resource_group" "hub-nva-rg" { - name = "${local.prefix-hub-nva}-rg" - location = local.hub-nva-location + name = "${local.prefix-hub-nva}-rg" + location = local.hub-nva-location - tags = { + tags = { environment = local.prefix-hub-nva - } + } } resource "azurerm_network_interface" "hub-nva-nic" { - name = "${local.prefix-hub-nva}-nic" - location = azurerm_resource_group.hub-nva-rg.location - resource_group_name = azurerm_resource_group.hub-nva-rg.name - enable_ip_forwarding = true + name = "${local.prefix-hub-nva}-nic" + location = azurerm_resource_group.hub-nva-rg.location + resource_group_name = azurerm_resource_group.hub-nva-rg.name + enable_ip_forwarding = true - ip_configuration { + ip_configuration { name = local.prefix-hub-nva subnet_id = azurerm_subnet.hub-dmz.id private_ip_address_allocation = "Static" private_ip_address = "10.0.0.36" - } + } - tags = { + tags = { environment = local.prefix-hub-nva - } + } } resource "azurerm_virtual_machine" "hub-nva-vm" { - name = "${local.prefix-hub-nva}-vm" - location = azurerm_resource_group.hub-nva-rg.location - resource_group_name = azurerm_resource_group.hub-nva-rg.name - network_interface_ids = [azurerm_network_interface.hub-nva-nic.id] - vm_size = var.vmsize + name = "${local.prefix-hub-nva}-vm" + location = azurerm_resource_group.hub-nva-rg.location + resource_group_name = azurerm_resource_group.hub-nva-rg.name + network_interface_ids = [azurerm_network_interface.hub-nva-nic.id] + vm_size = var.vmsize - storage_image_reference { + storage_image_reference { publisher = "Canonical" offer = "UbuntuServer" sku = "16.04-LTS" version = "latest" - } + } - storage_os_disk { + storage_os_disk { name = "myosdisk1" caching = "ReadWrite" create_option = "FromImage" managed_disk_type = "Standard_LRS" - } + } - os_profile { + os_profile { computer_name = "${local.prefix-hub-nva}-vm" admin_username = var.username - admin_password = var.password - } + admin_password = local.password + } - os_profile_linux_config { + os_profile_linux_config { disable_password_authentication = false - } + } - tags = { + tags = { environment = local.prefix-hub-nva - } + } } resource "azurerm_virtual_machine_extension" "enable-routes" { - name = "enable-iptables-routes" - virtual_machine_id = azurerm_virtual_machine.hub-nva-vm.id - publisher = "Microsoft.Azure.Extensions" - type = "CustomScript" - type_handler_version = "2.0" + name = "enable-iptables-routes" + virtual_machine_id = azurerm_virtual_machine.hub-nva-vm.id + publisher = "Microsoft.Azure.Extensions" + type = "CustomScript" + type_handler_version = "2.0" - settings = <