PSArm icon indicating copy to clipboard operation
PSArm copied to clipboard

Variables definitions are made available to root template

Open rdbartram opened this issue 3 years ago • 2 comments

If you define an [ArmParameter] and it has no default value, it will be created in the nested template but since it isn't in the root template there is no way to set the param and the deployment will always fail.

Also, if the param does have a default value then it just disappears and is added as a static value to the generated template json. I expect a parameter to be defined in all cases so users could override at a later stage

rdbartram avatar Apr 01 '21 22:04 rdbartram

This is good to know. The default value calculation is actually more complicated than that (if the default value is an ARM expression rather than a static value, the parameter is added), but easy to change.

Could you elaborate on parameters in nested vs parent templates?

  • Do parameters in child templates always need to be exposed in the parent
  • Do those parameters need to then not be expressed in the child

Also tagging @anthony-c-martin in case you're able to share your expertise on this, since it's not something I understand the semantics of currently.

rjmholt avatar Apr 01 '21 22:04 rjmholt

Right now there is no way to define parameters at the root level. This is the core problem, I don’t necessarily think they should be automatically exposed to the parent template, although this would be cool. I would accept though being able to define resources in the root template I.e parameters and outputs

rdbartram avatar Apr 01 '21 22:04 rdbartram