Config Mapping in Bicep – cool stuff!
Recently I was looking at ways to create config for different environments whilst using Bicep and a friend sent me is code which solves the exact issue I was trying to consider a good solution for.
I want to highlight this, as I feel this is probably not that well known and people will find this useful.
Shout out to https://twitter.com/ElYusubov for showing me how to do this – chekout out his Bicep content as its been a great help.
Problem statement:
How do I create config for dev,test,acceptance, prod in a bicep file and make it reusable, so that I dont need paramater json files and other types of solutions etc.
Consider that you want to create an App Service plan and you need different settings per environment.
We could create the App Service Plan for each environment and create some config in the Bicep file, and all would be good.
This will work but there is a better way so let me show you Ely’s example for this exact scenario.
The following image shows you how to create such config.
The code for this can be found here.

Now we need to create the App Service plan and make this re-usable for different environments (we dont want to create content seperately for each environment if we can help it).
The following is the code for creating the actual App Service plan itself

Again this code is available here -> Learn-Bicep/main.bicep at main · ElYusubov/Learn-Bicep (github.com)
Don’t forget to subscribe to my YouTube Channel.
[…] Config Mapping in Bicep – cool stuff! (Gregor Suttie) […]