-
Notifications
You must be signed in to change notification settings - Fork 771
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
[SYNTAX PROPOSAL] Referencing nested child resources #1564
Comments
2B |
2A followed by 2B (do I get a vote?) |
2B |
1 similar comment
2B |
2B Can we please also use this for modules? (as discussed in #923)
|
1A |
1B would be my first choice for clarity. |
Preferably 2B, if not than 2A. Option 1 is too verbose. |
2B And I agree with @SimonWahlin on this:
|
2B |
2B followed by 2A |
Also want to point out I've added a somewhat related proposal here (allowing resources to be passed as inputs/outputs): #1170 |
Edit: After considering @mbsnl comment, 2A seems more reasonable now. |
1A feels by far the most natural to me. The dot-notation is used everywhere else inside bicep, why use something different here? |
With 1A you will be mixing properties received from REST api with bicep's names - that might be confusing without IDE support. |
Would a user care about that? I expect bicep handle that for me. In the same way that I don't care if an expression that I write in bicep is handled by the bicep compiler or the underlying ARM deployment |
2A. It would stand out as a Bicep specific implementation. 2C/2D is also an option, but 2C/2D look less attractive. Specifically not 2B, because 2B, could suggest it's reflecting ARM Specifications, while it is not, people would wonder why not to use "vnetname/subnets/subnetname.id". And yes, this example is wrong, but just trying to point out a 2B implementation would get some users in the wrong think-pattern. |
You are right that we are mixing things, and if you understand how ARM works at a lower level this could be a bit surprising. In practice though, to @sebader's point, I'd expect most users wouldn't care. In theory, it's possible there could be an ambiguity if a resource had a real property called |
2B with intellisense support when |
We will have language server/IDE support for all of these options btw. This includes completions, validation, etc. |
2A or 2B - torn between both actually with probably a leaning towards 2A as it is explicit/new and specific to bicep(imho). 2B looks too similar to other syntax uses. 2C & 2D hurt my eyes. |
1A followed by 2B. The Syntax 1A is also the most natural to me. |
I just realised, that 2A fits with the proposal I made for declaring child resources in a non nested way here #127 (comment)
|
1A seems most natural to. Followed by 2C |
Especially since we can benefit from Intellisense to distinguish the relatively few resources with internal resources, I vote for 1A, then 2B. While I agree that if users leap into Bicep right off the bat and work with these nested resources, it may be confusing why 2B syntax is used for some resources and not others, but I think In general, the dot notation makes sense and the IDE/Intellisense can lead them down the right road to differentiate between the relatively few special resources that would use this syntax. |
just adding why I don't want 1A - too much typing and with 2A basically word |
2A seems to make the most sense. 2B looks pretty and is familiar, but I believe that familiarity might cause issues during the migration/relearning process. |
From a simplicity standpoint 1A is the winner for me. |
2A (followed by 2B) |
Syntax 1A certainly feels the most natural. 2B would also be acceptable, but probably a little confusing ( is subnet in vnet/subnet a property of vnet or a resource)? And what happens if you have a sub-resource that is the same name as a property? Certainly perfectly valid bicep and ARM, but now you've got a really confusing syntax. |
2B without a shed of doubt. Not only familiarity, but naturality. Not sure what others thought, but reading through the first paragraph I was hoping you'd have the option of |
Option 2B |
1A, keep things consistent wth .properties being "special", this isn't something that needs a new operator. |
1A makes the most sense to me, as we currently use However in lieu of this, option 2B looks familiar considering current usage within ARM templates. |
I really like 1A and think that's the most natural and feels the most 'Bicep-ish'. 1B is my next preference after that, but the |
Current vote tally:
Combining 1A+1B vs 2A+2B:
We're going to start with a variant of option 2 since it seems to be the more popular choice. It will be checked into main to start to give folks an opportunity to play with it in the nightly build and share their thoughts before it gets officially released. We are going to go with 2A for now, because the implementation is cleaner. It turns out |
1A (if its not too late to vote :)) |
Closing since this has been implemented as Docs are here: |
With #1516, we are introducing a new syntax for child resources that will allow them to be declared inside of their parent resource. For example:
Problem
We need a syntax to reference the symbolic name of the child resource
subnet
symbolic name. We cannot use justsubnet
because it would be ambiguous if the vnet was created as part of a loop since there is no way to distinguish between thesubnet
resource forvnet[0]
vsvnet[1]
Requirements
resources
from a module. We should be able to use the same/similar syntax in this contextProposed syntax change
We have two options that we like.
Option 1
Add a dedicated top-level property -
resources
or$resources
- to any resource with child resources declared:1A -
resources
1B -
$resources
The
$
would help distinguish this property from a "normal" property:Option 2
Instead of a dedicated property, we would have a different access character for child resources. This would be a terser syntax. So far we like the following:
2A -
:
2B -
/
We have historically used
/
to separate segments for child resources, so this has some nice familiarity.2C -
..
2D -
>
ASK
Please share your feedback by simply commenting with your favorite option (
1A
,1B
,2A
,2B
,2C
,2D
) or provide an alternative with some context as to why that is your favorite.The text was updated successfully, but these errors were encountered: