-
Notifications
You must be signed in to change notification settings - Fork 756
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
Resource reference in a resource #565
Comments
Is that |
Yes it is needed as far as I know. We use it the same way. There are even strange cases like virtual wan where you have Microsoft.Network/vpnGateways where you have connections which should be empty upon first deployment but filled on next deployments when you have vpn connections. This leads you to do workarounds like checking if the VPN gateway is already deployed or not and if it has vpn connections created or not. If the VPN Gateway exists and have vpn connection you have to take the value of connections from it via reference and deploy it with that value. You cannot fill that value on your own as you basically upon every deployment you need to know which VPN connections are already deployed and which are yet to deployed. You can get the current ones only via reference to the resources itself. Just ordinary problems with RPs :) |
To unblock you in the meantime, you can use the
Not ideal, but it should work. Let us know if you have any questions. |
I came across the same issue with FrontDoor (another Microsoft.Network RP...)
|
It's quite a niche case, but I do think it would be safe to skip the cycle detection logic for a deploy-time constant self-reference (e.g. res.id, res.type, res.name & res.apiVersion) |
of course, what I would really like to be able to do - and I'm not sure if this would be even remotely possible with Bicep:
:) |
+1! |
+1 as well. |
Application Gateway in particular has a lot of cross references to child items. These child items are all arrays. Solving this issue along with #1853 would be great. Could you directly reference other properties (that are in included in bicep document and therefore deploy-time constant)? What would be really nice is if instead of ...
you could have:
|
Also worth mentioning that we could potentially simplify this in conjunction with #2245 - to use the above example, I'd imagine something like (assuming we have a
|
This bicep for an App Gateway(specifically the gatewayIPConfigurations) has only the name property (and not the id). This is how it should be done. The 'id' is automatically generated for you. However, if you accidentally supply the id (instead of the name), but leave an invalid id, it fails with InvalidRequestFormat, "Cannot parse the request." This is troublesome since VS Code doesn't complain in name is missing and doesn't tell you that the id is not properly formatted. I think the 'id' just needs to be removed from the bicep interpretation of the schema since it is generated when you deploy. The schema format is just ambiguous since it makes no distinction between generated properties and properties that need to be supplied. It seems like either name or id should be required. The schema is here, and contains both 'id' and 'name': Here is the specific documentation on the gatewayIPConfigurations. Note that neither 'name' nor 'id' is required (according to the docs). |
Hi guys, I think I have a similar problem ]
Microsoft.Network/virtualNetworks@2020-11-01 |
Closing this as a dup of #1852 |
Is your feature request related to a problem? Please describe.
Some resource such as Load Balancer or Application Gateway have circular reference in a resource
but it's not possible to use this form in bicep
The text was updated successfully, but these errors were encountered: