-
Notifications
You must be signed in to change notification settings - Fork 762
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
Difficult/impossible to conditionally deploy resource with different discriminator value #1408
Comments
This is because the
I'll caveat that this is a bit awkward because you would end up with two different symbolic names for the resources (there's also a separate bug (#1410) that I just found that requires the actual names to be different). Ideally, if we implement if/else (#1171) syntax this gets easier.
This one I am not sure I'm following, but might also relate to the above issue. If I hardcode the value of createMode, intellisense & validation are working as expected: If I set it to a Once we have constant folding (#444), this should be resolved right @majastrz / @anthony-c-martin ? |
You are right that you can fill in the value into a variable. If/else would indeed help to persuade the DRY principle. On a sidenote: compute/virtualmachine has the same issue with certain properties. |
Yeah this discriminator pattern leads to some interesting API design questions. I think we'll revisit this issue when we have if/else, but unfortunately I'm not sure what we could do to make this easier in the meantime other than the Postgres team revisiting their API design. |
Is your feature request related to a problem? Please describe.
The PostGreSQL ARM template has a serverpropertiesforcreate object that also requests for an additional set of keys depending what purpose your server has (create, restore, georestore or replica).
The issue I'm having at the moment is that the extra keys are not and extra object in the ServerPropertiesForCreate object.
Which limits a more dynamic setup for a bicep module (E.G.: use of variables).
Another issue is that the createmode key does not accept a string if you want this to be a parameter in bicep. It needs to be on of the following values: ( Default | GeRestore | PointInTimeRestore | Replica) (screenshot)
Describe the solution you'd like
A possible solution would be to add and extra object under properties (createProfile) which would then use the keys of the object it needs:
This however will need an API change.
example of the solution in bicep:
The text was updated successfully, but these errors were encountered: