Azure / Azure/bicep

Bicep linting issue for cosmosDB api version Microsoft.DocumentDB/databaseAccounts@2021-07-01-preview: The specified "object" declaration is missing the following required properties: "createMode".

Open
#5,265 5 comments 0 reactions 0 assignees View on GitHub
provider bug types: swagger inaccuracy
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

**Bicep version**
Bicep CLI version 0.4.1 (e2387595c9)
Bicep Visual Studio Code Plugin: v0.4.1008 Preview

**Describe the bug**
Bicep linting warning in Visual Studio Code:
_The specified "object" declaration is missing the following required properties: "createMode".BCP035_

**To Reproduce**
Create a cosmosDB object in Visual Studio Code using api version Microsoft.DocumentDB/databaseAccounts@2021-07-01-preview without the createMode property:

```
resource cosmosDbRes 'Microsoft.DocumentDB/databaseAccounts@2021-07-01-preview' = {
name: cosmosDb.name
location: resourceGroup().location
tags: union(tags, apiTypeMappings.tags[toLower(cosmosDb.apiType)])
kind: apiTypeMappings.kind[toLower(cosmosDb.apiType)]
properties: {
consistencyPolicy: {
defaultConsistencyLevel: cosmosDb.consistencyPolicy.defaultConsistencyLevel
maxStalenessPrefix: consistencyPolicyMapping[cosmosDb.consistencyPolicy.defaultConsistencyLevel].maxStalenessPrefix
maxIntervalInSeconds: consistencyPolicyMapping[cosmosDb.consistencyPolicy.defaultConsistencyLevel].maxIntervalInSeconds
}
locations: union(locations, defaultLocation)
databaseAccountOfferType: 'Standard'
isVirtualNetworkFilterEnabled: !empty(cosmosDb.virtualNetworkRules)
enableAutomaticFailover: cosmosDb.enableAutomaticFailover
capabilities: apiTypeMappings.capabilities[toLower(cosmosDb.apiType)]
enableMultipleWriteLocations: cosmosDb.enableMultipleWriteLocations
enableCassandraConnector: cosmosDb.apiType =~ 'Cassandra' && cosmosDb.enableCassandraConnector
connectorOffer: 'Small'
disableKeyBasedMetadataWriteAccess: cosmosDb.disableKeyBasedMetadataWriteAccess
keyVaultKeyUri: cosmosDb.keyVaultKeyUri
publicNetworkAccess: cosmosDb.publicNetworkAccess
enableFreeTier: cosmosDb.enableFreeTier
apiProperties: cosmosDb.apiType =~ 'MongoDB' && !empty(cosmosDb.serverVersion) ? {
'serverVersion': cosmosDb.serverVersion
} : {}
enableAnalyticalStorage: cosmosDb.enableAnalyticalStorage
backupPolicy: backupPolicy[toLower(cosmosDb.backupPolicy.type)]
cors: cosmosDb.apiType =~ 'SQL' && !empty(cosmosDb.corsAllowedOrigins) ? [
{
'allowedOrigins': cosmosDb.corsAllowedOrigins
}
] : []
ipRules: [for ipRange in (!empty(cosmosDb.ipRangeFilter) ? split(cosmosDb.ipRangeFilter, ',') : []) : {
ipAddressOrRange: ipRange
}]
virtualNetworkRules: [for (virtualNetworkRule, i) in cosmosDb.virtualNetworkRules: {
id: subnets[i].id
ignoreMissingVNetServiceEndpoint: true
}]
}
}
```

**To workaround**
add the property: createMode: 'Default'
OR
use api version Microsoft.DocumentDB/databaseAccounts@2021-06-15 for the same cosmosDB object.

Contributor guide

Open the contributing guide

Research direction

Reproduce the warning with Bicep CLI 0.4.1 and the Visual Studio Code plugin using the supplied databaseAccounts@2021-07-01-preview declaration. Compare the linting behavior with the 2021-06-15 API version and the createMode workaround. Done means a valid declaration without createMode no longer receives the incorrect BCP035 warning for the preview API version.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.