Azurerm 2.0+: Create subnet at the same time as route table association

Hi folks.

The company I work for has a policy in place where all subnets must have a route table attached (controlled via an Azure Policy). This will also cause subnet creation to fail if we don’t specify a route table.

Currently, we’re stuck on using version 1.45 of the azurerm provider so that we can specify route_table_id in the azurerm_subnetresource. We can’t currently use the 2.0+ provider since this linkage option has been removed in favour of azurerm_subnet_route_table_association. This forces an order of operations on us that won’t work with our current policy (subnet would need to exist before the association can happen).

Has anyone else found a way to workaround this issue? Currently we’ve been manually creating the subnets when needing to use the 2.0 provider for other resources and then importing the subnet as both anazurerm_subnet and azurerm_subnet_route_table_association.

Thanks!