Autogenerating modules when target scope is not resource group
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
**Is your feature request related to a problem? Please describe.**
When I develop an end-2-end solution and use a resource group as a lifecycle boundary to keep all my resources in it, I use a single bicep to create one or more resource groups and resources within them. Subscription becomes my target scope.
Now, with subscription as a target scope, it is not possible to use 'resource'. (_Scope "subscription" is not valid for this resource type. Permitted scopes: "resourceGroup"_).
So I am forced to use modules even if the code won't be reused. This leads to the sprawling of unneeded files.
**Describe the solution you'd like**
I would like a way for bicep to not require me to create a module if I don't need it, and do this for me instead. Kind of autogenerating a module.
Ideally, the only additional param needed for a resource is the RG scope. So it could look something like this:
```
resource projectRG 'Microsoft.Resources/resourceGroups@2021-04-01' = {
...
}
resource storageaccount 'Microsoft.Storage/storageAccounts@2021-02-01' scope:projectRG = {
...
}
```
Contributor guide
Research direction
Start by reviewing how subscription target scopes, resource declarations, and modules are currently handled. Compare those entry points with the requested resource scope syntax, and consider what validation and tests would be needed for resources targeting a resource group without a manually created module. Done means the stated subscription-scoped example works without requiring an unneeded module.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100