-
Notifications
You must be signed in to change notification settings - Fork 747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shortcut for referencing "this" resource when setting dependency IDs #724
Comments
I like the idea overall. Anything to reduce typing is great! A couple of thoughts...
|
1, I'd agree that there's often a need to access the immediate relative parent as well as the outermost parent, but I would separate those out to two separate symbols for clarity. I'm in the camp that self-documenting code is nice for those scenarios when you type something up and don't come back to it for a while, so having nested syntax may be less clear than not. That said, rich Intellisense can assist here if it can show what level is currently referenced. So if you stuck with symbols then, I'd propose that a suitable symbol be used for the outermost parent (originally proposed as
That said, it would eliminate having to learn special symbolic syntax in the first place to use text, so if you went this route, might I propose something like (to use the same earlier examples) Putting the keyword in brackets could eliminate any need to have reserved keywords and.. you might have a compiler option to warn about possible unintended use if you saw "parent" or "root" used without the brackets. |
Another thought as I sit here jamming through load balancers in my file.. the availability of such a syntax (symbolic or not) would be hugely beneficial in the upcoming looping functionality. Otherwise, I'd run into issues figuring out how to reference the parent resource IDs within the loop to reference the children (rendering loops far less useful). |
Related to #565 |
Just +1-ing a word + symbol instead of just symbol. Maybe just one leading character instead of wrapping characters though:
|
Just to play devil's advocate a bit here:
|
We'd like to see if there are other concrete examples of this issue manifesting in other RPs besides |
For those coming here, there is an available workaround using |
Closing and tracking with #1470. I think we are going to allow you to reference compile-time properties like |
Is your feature request related to a problem? Please describe.
Several resources in ARM have all sorts of children defined in the properties that each reference one anothers' IDs. Take the following ARM template when filling out properties for a LoadBalancer (many parts omitted for brevity):
Notably, I'm having to specify the probe, and in another variable, I'm setting up the resource ID for the parent load balancer just so I can dig right back into a child resource within the same object.
I think it'd be handy to have an option like that available in SASS or SCSS that essentially symbolizes 'this' as a single ampersand and a delimiting mark so the resource ID can be calculated out at build time instead of dealt with through the use of several variables
Describe the solution you'd like
Here's an example of what I have in mind written in Bicep to yield the above result using this symbol:
Note the use of the & at
loadBalancer.properties.loadBalancingRules.properties.probe.id
- ideally, & would point directly to the outer-most resource currently being defined so its ID could be inferred and utilized there, but also support implicit pathing within it along with string interpolation so variables and parameters could be referenced as well.This change would serve to eliminate some typing (always a plus in ARM template), eliminate a source for resource ID errors and cut down on the number of variables that exist for no other reason than to simplify this referencing.
Thank you for your consideration.
The text was updated successfully, but these errors were encountered: