-
I am looking to use a variable or parameter value to be used for an output name. Situation: Adding secrets to a key vault in another Resource group. I have a module to add the secret to a key Vault by passing in all the related parameters. The drawback of this module is that I can't control the name of the output. This module would be used multiple times in this deployment (AppInsights, Storage account) Without being able to parameterize the output variable name I must create a module for each resource. Is there some way I am missing for dynamically setting the output name? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
There is no way to set the name of the output dynamically. Would you be able to use an output of param myParam string
module myModule '...' = {
...
}
output myOtherOutput string = myModule.outputs[myParam]
|
Beta Was this translation helpful? Give feedback.
-
Thanks everyone for the feedback. Having a little time away from the issue and I realized I was needlessly complicating the problem. param env string
param location string
param secretName string
param secretValue string
resource keyVault 'Microsoft.KeyVault/vaults@2019-09-01' existing = {
name: 'kv-shared-${env}-${location}'
resource secret 'secrets' = {
name: secretName
properties: {
value: secretValue
}
}
}
output keyVaultSecretUri string = keyVault::secret.properties.secretUri all I need to do is name the module for the associated service secret being saved to the key vault. module appInsightSecret 'keyvaultSecret.bicep' = {...} |
Beta Was this translation helpful? Give feedback.
Thanks everyone for the feedback. Having a little time away from the issue and I realized I was needlessly complicating the problem.
having a generalized key Vault Secret module
all I need to do is name the module for the associated service secret being saved to the key vault.