Azure / Azure/bicep

Linter rule suggestion - Nested resource uses the same API version as the parent

Open
#8,005 3 comments 0 reactions 0 assignees View on GitHub
devdiv enhancement story: linter rules
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

We could potentially lint for situations like the following:

```bicep
resource storageAccount 'Microsoft.Storage/storageAccounts@2021-02-01' = {
// ...

resource blobService 'blobServices@2021-02-01' = {
name: 'default'

resource container 'containers@2021-02-01' = {
name: 'my-container'
}
}
}
```

In this example, the `blobServices` and `containers` resources doesn't need to declare an API version - if they doesn't, the API version is inherited from the parent resource.

I think it shouldn't be a linter warning to explicitly override the API version of the parent resource, though - there might be some edge case scenarios where the parent resource must be deployed using one API version and a child must be deployed using a different API version.

Contributor guide

Open the contributing guide

Research direction

Use the nested-resource example in the issue as the starting case and review how the project's linter rules and diagnostics are tested. Confirm the behavior for inherited same-version API declarations versus explicitly different child versions; done means the intended warning boundary is covered by tests.

Written by the indexing model from the issue text.

Assessment

Domain
cloud, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.