From fc5f56c4a531c747b8eb1fa88f6179f0413c5758 Mon Sep 17 00:00:00 2001 From: Stephen Dowsland Date: Mon, 24 Feb 2020 21:13:55 +0000 Subject: [PATCH] Add network interface and security group association --- examples/virtual-machines/linux/public-ip/main.tf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/virtual-machines/linux/public-ip/main.tf b/examples/virtual-machines/linux/public-ip/main.tf index 02371d8526cb..a93700ea2665 100644 --- a/examples/virtual-machines/linux/public-ip/main.tf +++ b/examples/virtual-machines/linux/public-ip/main.tf @@ -45,7 +45,6 @@ resource "azurerm_network_interface" "internal" { name = "${var.prefix}-nic2" resource_group_name = azurerm_resource_group.main.name location = azurerm_resource_group.main.location - network_security_group_id = azurerm_network_security_group.webserver.id ip_configuration { name = "internal" @@ -71,6 +70,11 @@ resource "azurerm_network_security_group" "webserver" { } } +resource "azurerm_network_interface_security_group_association" "main" { + network_interface_id = azurerm_network_interface.internal.id + network_security_group_id = azurerm_network_security_group.webserver.id +} + resource "azurerm_linux_virtual_machine" "main" { name = "${var.prefix}-vm" resource_group_name = azurerm_resource_group.main.name