Allow for placeholder variables in IoT Edge deployment templates
I am looking to have a configured deployment for Azure IoT Edge that automatically gets applied, based on the configured tags for a new IoT Edge device.
That works perfectly (modules are being set, routes are defined, module twins are configured)
However, I’d like to leverage a concept like ‘placeholder values’ that I can override on edge device level.
For example: I might have 5 different devices, all using the same deployment, but inside one of their module, I need to set a specific Environment Variable, or update a value in their desired properties (of the module twin). Once creating a new edge device, I'd like to have those placeholder variables to be overwritten by the value I can set (in the device twin?)
As far as I see, this is not yet possible? Can someone confirm this, or come with an alternative solution ?
We see the value in the feature; however there is no easy way to do this at the moment.
+1 on this feature request. I submitted this also on Github https://github.com/Azure/iotedgedev/issues/464 . To summarize this ticket states:
I understand how to add tags to an edge device in IoT Hub and then how to do a deployment and use those tags to select some subset of my edge devices.
The IoT Module that I am deploying has an environment variable called ACCESS_KEY. I get this ACCESS_KEY from a 3rd party service and each module that is deployed has to have a unique ACCESS_KEY. If I deploy these modules 1 at a time, this is easy to do because I add the module to my device, click on the module, go to environment variables, and type in that unique ACCESS_KEY.
If I want to do this at scale, I need a way in the deployment to pass a unique ACCESS_KEY to the module that is going to be deployed for each gateway. Let's say in my deployment I state tags.location.floor = '1' and that pulls in two devices for this module to be pushed down. Each module has to have a unique ACCESS_KEY environment variable value. If it uses the same ACCESS_KEY for both devices then it won't work.
My suggestion on a way to get around this, and again I am open to better ways, is to allow me to specify on my Edge Device in IoT Hub a tag that can then be dynamically referenced in the module on deployment. For example, I would create a device tag like so, tags.access_key and each Edge Device in IoT Hub would have a unique value there. Then in the deployment when I select my IoT Module, and then I click to configure it, and go to Environment Variables, I could then enter something like %%tags.access_key%% for the environment variable of ACCESS_KEY and on deployment to each device, it would fill in the correct value of the access key for each module from the IoT Edge tag access key.
Davy Meybos commented
How would you advice to setup automatic deployment to devices, but with one or more custom settings per device?
If it would be possible to set them on device level without having them being overwritten by the automatic deployments, it would already be great.