CloudNationHQ / terraform-azure-vnet

Terraform module which creates virtual network resources used by workloads and accelerators.
https://library.tf/modules/CloudNationHQ/vnet/azure/latest
MIT License
1 stars 1 forks source link

length changed from 1 to 3 during apply #9

Closed dkooll closed 7 months ago

dkooll commented 7 months ago

In the below scenario i have a public ip address linked in the ruleset

module "network" {
  source  = "cloudnationhq/vnet/azure"
  version = "~> 0.1"

  naming = local.naming

  vnet = {
    name          = module.naming.virtual_network.name
    cidr          = ["10.18.0.0/16"]
    location      = module.rg.groups.demo.location
    resourcegroup = module.rg.groups.demo.name

    subnets = {
      sn1 = {
        subnet_name = "sn-demo-testme-01"
        nsg_name    = "nsg-demo-testme-01"
        cidr        = ["10.18.1.0/24"]
        nsg = {
          name = "nsg-demo-testme-01"
          rules = [
          {
              name                       = "myhttps"
              priority                   = 100
              direction                  = "Inbound"
              access                     = "Allow"
              protocol                   = "Tcp"
              source_port_range          = "*"
              destination_port_range     = "443"
              source_address_prefix      = "10.151.1.0/24"
              destination_address_prefix = "*"
          },
          {
              name                       = "mysql"
              priority                   = 200
              direction                  = "Inbound"
              access                     = "Allow"
              protocol                   = "Tcp"
              source_port_range          = "*"
              destination_port_range     = "3306"
              source_address_prefix      = "10.0.0.0/24"
              destination_address_prefix = azurerm_public_ip.appgw.ip_address
            }
          ]
        }
      }
    }
  }
}

resource "azurerm_public_ip" "appgw" {
  name                = module.naming.public_ip.name
  resource_group_name = module.rg.groups.demo.name
  location            = module.rg.groups.demo.location
  allocation_method   = "Static"
}

During a apply i get the below error

When expanding the plan for module.network.azurerm_network_security_group.nsg["appgw"] to include new values learned so far during apply, provider "[registry.terraform.io/hashicorp/azurerm](http://registry.terraform.io/hashicorp/azurerm)" produced an invalid new value for .security_rule: length changed from 1 to 3.