Azure / terraform-azurerm-avm-ptn-virtualwan

MIT License
5 stars 11 forks source link

Bug: Resource Group and VWAN creation results in race condition #4

Closed OmnipotentOwl closed 7 months ago

OmnipotentOwl commented 11 months ago

Summary

When attempting to use the module and deploy with it there are cases where Terraform will attempt to deploy the virtual wan before the resource group is created inside the module. This can result in unexpected runtime errors that fail the deployment.

Reproduction

run basic example

Remediation

The proposed solution is to set a depends_on statement for the resource group

resource "azurerm_virtual_wan" "virtual_wan" {
  name                              = var.virtual_wan_name
  location                          = var.location
  resource_group_name               = var.resource_group_name
  disable_vpn_encryption            = var.disable_vpn_encryption ? false : true
  allow_branch_to_branch_traffic    = try(var.allow_branch_to_branch_traffic, true)
  office365_local_breakout_category = try(var.office365_local_breakout_category, "None")
  type                              = var.type
  tags                              = merge(var.tags, var.virtual_wan_tags)

  depends_on = [ 
    azurerm_resource_group.rg 
  ]
}
khushal08 commented 9 months ago

WIP

khushal08 commented 9 months ago

@OmnipotentOwl PR is getting reviewed. Thanks for the feedback.

khushal08 commented 7 months ago

Fixed