Scope's to work with Dynamic Resources
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
This will likely get solved as part of #2246
However my use case is that I want to dynamically assign a `resource reference` to the `scope` of a tag deployment. This would enable **any resource type** to be leveraged in the scope assignment.
eg
```bicep
resource default 'Microsoft.Resources/tags@2021-04-01' = {
name: 'default'
scope: reference(extensionResourceId(resourceId, 'Microsoft.Resources/tags', 'default'), '2021-04-01')
properties: {
tags: mergedTags
}
}
```
When attempting this I receive;
> The property "scope" expected a value of type "resource | tenant" but the provided value is of type "object".bicep(BCP036)
This makes sense, but the resource in my use case could be any azure resource time that a tag could be applied to.
> This expression is being used in an assignment to the "scope" property of the "Microsoft.Resources/tags" type, which requires a value that can be calculated at the start of the deployment.bicep(BCP120)
The dynamic limitation is what is limiting here.
Contributor guide
Research direction
Review issue #2246 first, then trace the scope type-checking and deployment-time diagnostic paths for BCP036 and BCP120. Done means a resource reference can dynamically supply the tag deployment's scope for any taggable Azure resource, with coverage for the reported example.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100