Using Bicep as IaC tool to handle external infrastructure changes

221 Views Asked by At

We have infrastructure as code (IaC) using Bicep, which is as we understood, without state management.

One of the resources we have is the virtual network resource.

The issue here is that the virtual network peerings are handled outside of IaC. And we will have a lot of peerings between this and other virtual networks in another subscription within the same tenant. They are added on demand (triggered by the user, but automated/scripted) when needed.

The plan is to have the deployment workflow/action running on schedule. The deployment mode is incremental.

Is there a smart way to handle the peering? So that they are not removed (due to a mismatch between code and actual resources) when the deployment runs? We would not like to have the peerings in IaC if not necessary.

The 'existing' keyword will cause the deployment to fail if the workflow is triggered to set up the whole infrastructure from a clean state.

Maybe it can be handled by using some kind of a state/JSON file with all the network peering information? And somehow from the deployment workflow, grab the information from this extra file? But then we would like to have another workflow to keep this file updated.

Thanks in advance.

0

There are 0 best solutions below