-
-
Save ThomasPe/4d0ca0fba238a9399342340d11fa4d34 to your computer and use it in GitHub Desktop.
Azure Bicep elseif
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param stage string = 'prod' | |
var isProd = stage == 'prod' | |
var isTest = stage == 'test' | |
var isDev = stage == 'dev' | |
resource saProd 'Microsoft.Storage/storageAccounts@2022-09-01' existing = if (isProd) { | |
name: 'prodstorageaccounttp' | |
} | |
resource saTest 'Microsoft.Storage/storageAccounts@2022-09-01' existing = if (isTest) { | |
name: 'teststorageaccounttp' | |
} | |
resource saDev 'Microsoft.Storage/storageAccounts@2022-09-01' existing = if (isDev) { | |
name: 'devstorageaccounttp' | |
} | |
// supports multi-line and multiple conditions | |
output saName string = isProd ? saProd.name | |
: isTest ? saTest.name | |
: isDev ? saDev.name | |
: 'unknown' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment