Environment Variables in deployment.template.json
See original GitHub issueExpected Behavior
"modules": {
"MODULE-NAME": {
"version": "1.0",
"type": "docker",
"status": "running",
"restartPolicy": "always",
"env": {
"VAR": {
"value": "$VAR"
},
"VAR_ONE": {
"value": "${VAR}"
},
"VAR_TWO": {
"value": "$(VAR)"
}
},
"settings": {
"image": "some-image",
"createOptions": {
"Env": [
"VAR=$VAR",
"VAR_ONE=${VAR}",
"VAR_TWO=$(VAR)"
]
}
}
}
}
The expected behaviour is that the deployment template can pick environmental variables when they are requested from either the env
for the iot module OR from Env
in the create options for the docker container. However, neither of these options work.
Current Behavior
References to environment variables are treated as string values
Steps to Reproduce
Use the sample module template referenced in the Expected Behavior
section
Context (Environment)
IoT Edge Simulator running on VSCode
Device (Host) Operating System
MacOSX
Container Operating System
node:lts-alpine
Runtime Versions
Version - 1.0.8.1.24554792
iotedged
Version - 1.0.8.1.24554792
Edge Agent
1.0.0
Edge Hub
1.0.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Variables in azure iot edge deployment template
In Azure Iot edge deployment template json, I see a variables named MODULES.SampleModule or MODULES.SampleModule.json . An example is at this ...
Read more >Variables in templates - Azure Resource Manager
This article describes how to define and use variables in your Azure Resource Manager template (ARM template). You use variables to simplify ...
Read more >Template functions - deployment - Azure Resource Manager
You can use deployment() to link to another template based on the URI of the parent template. JSON Copy. "variables": { ...
Read more >Adding Environment Variables to an ARM template for Azure ...
Environment variables can be created at the same time as the app service by adding another resource to the ARM template. I like...
Read more >Using environment variables in ARM templates to deploy IaC
There are many of ways to deploy IaC environments from a single source code. This Quick Tip combines parameters and variables in ARM...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Is there not a feature request here @arsing / @DoychinDoychev ?
I’m authoring a deployment.template.json file, and wanting to make use of variables in the .env file as described in this issue, and as already implemented for the CONTAINER_REGISTRY_USERNAME and CONTAINER_REGISTRY_PASSWORD variables in the .env file. The ability to make use of the existing templating build when “Generate IoT Edge Deployment Manifest” would be great, rather than the suggestion of using another templating engine for the new variables.
@Gordonby, now when you mention feature requests, it would be helpful that one could use environment variables with some kind of simple logic so that one could at least combine strings, lets say VAR1=foo VAR2=bar and in the process of converting “${VAR1+VAR2}” from the template to the config file it would yield “foobar”. Similarly that many .js templates do.
Where one could discuss such a request? Thanks a lot with any guidance!