The enclosing array expected an item of type \"module[] | (resource | module) | resource[]\", but the provided item was of type \"Microsoft.DocumentDB/databaseAccounts@2021-10-15 | Microsoft.DocumentDB/databaseAccounts@2023-04-15\".",
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
**Bicep version**
Bicep CLI version 0.22.6
**Describe the bug**
I have a resource (e.g. resourceA) that I need to deploy Depending on either or (e.g. resourceX or resourceY ),
```bicep
resource varKeyVaultName_cosmosDBConnectionString 'Microsoft.KeyVault/vaults/secrets@2022-11-01' = {
parent: varKeyVault
name: 'cosmosDBConnectionString'
properties: {
contentType: 'text/plain'
value: listConnectionStrings(resourceId('Microsoft.DocumentDB/databaseAccounts', ((isProvisionedCosmos == 0) ? varServerlessCosmosAccountName : varProvisionedCosmosAccountName)), '2019-12-12').connectionStrings[0].connectionString
}
dependsOn: [
/* Works: but this means it will need both of the below */
varServerlessCosmosAccount
varProvisionedCosmosAccount
/* but I need to make an either-or condition */
((isProvisionedCosmos == 0) ? varServerlessCosmosAccount : varProvisionedCosmosAccount)
]
}
```
Contributor guide
Research direction
Reproduce the report with Bicep CLI 0.22.6 using the shown Key Vault secret resource and conditional dependsOn expression. Start by tracing how the compiler types conditional resource expressions in dependsOn; done means the either-or dependency is accepted or the diagnostic clearly reflects the supported behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100