Azure / terraform-azurerm-lz-vending

Terraform module to deploy landing zone subscriptions (and much more) in Azure
https://registry.terraform.io/modules/Azure/lz-vending/azurerm
MIT License
149 stars 65 forks source link

bug: virtual_network_enabled = false #378

Open Romiko opened 1 month ago

Romiko commented 1 month ago

Community Note

Versions

Please paste the output of terraform version command from within the initialized directory:

Terraform v1.5.6
on linux_arm64

Please enter the module version that you are using:

module "lz_vending_
  source  = "Azure/
  version = "4.1.0"

Description

When I have virtual_network_enabled = false and have a vnets section initalised in tfvars, it still cause terraform add/remove

The expected behaviour is to ignore

Resource groups work as expected.

Steps to Reproduce

  1. Define tfvars with vnets
  2. virtual_network_enabled = false
  3. Terraform plan will still want to do the following:

` -/+ destroy and then create replacement

Terraform will perform the following actions:

module.lz_vending_subscriptions["sandbox"].azapi_resource.telemetry_root[0] must be replaced

-/+ resource "azapi_resource" "telemetry_root" { ~ id = "/subscriptions/blahblahblah/providers/Microsoft.Resources/deployments/pid-50a8a460-d517-4b11-b86c-6de447806b67_4.1.0_00000007" -> (known after apply) ~ name = "pid-50a8a460-d517-4b11-b86c-6de447806b67_4.1.0_00000007" -> "pid-50a8a460-d517-4b11-b86c-6de447806b67_4.1.0_00000807" # forces replacement ~ output = jsonencode({}) -> (known after apply)

(8 unchanged attributes hidden)

}

`

Romiko commented 1 month ago

Workaround:

virtual_network_enabled = each.value.virtual_network_enabled virtual_networks = each.value.virtual_network_enabled ? each.value.vnets : {}

matt-FFFFFF commented 3 weeks ago

Hi this is a bug in the telemetry logic, thanks for reporting.