Azure / Azure/bicep

Consider defaulting required 'location' to 'resourceGroup().location'

Open
#4,260 8 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 2h
Merged PRs (30d)
79

Description

In a lot of simpler deployment scenarios, customers would want to deploy resource groups and all the resources to be in the same location. It also creates friction for new customers that need to figure out why each resource needs to have its own location and what to set it to.

# Proposal

Default the required 'location' property of resources to 'resourceGroup().location'

# Before

```bicep
resource singleResource 'Microsoft.Storage/storageAccounts@2019-06-01' = {
name: '${name}single-resource-name'
location: resourceGroup().location
}
```

# After

```bicep
resource singleResource 'Microsoft.Storage/storageAccounts@2019-06-01' = {
name: '${name}single-resource-name'
}
```

# Analyzer

We can also add an analyzer that prompts users to remove the redundant qualification.

Happy to do the work if you decide this feature is something you are interested in.

Contributor guide

Open the contributing guide

Research direction

Start with the issue's Before and After Bicep examples and the analyzer proposal. Identify the existing entry points for required resource properties and analyzer diagnostics, then verify that omitting location defaults to resourceGroup().location while redundant explicit qualifications receive a prompt.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud, compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.