Skip to content
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

Generate and validate default parameter file #4761

Closed
WhitWaldo opened this issue Oct 7, 2021 · 5 comments
Closed

Generate and validate default parameter file #4761

WhitWaldo opened this issue Oct 7, 2021 · 5 comments
Labels
enhancement New feature or request Needs: Triage 🔍

Comments

@WhitWaldo
Copy link

Is your feature request related to a problem? Please describe.
I found it odd that for software that generates whole ARM templates, the documentation indicates I have to write my own parameter file by hand and that there's no built-in validator (given that Bicep contains all the metadata used for parameter field validation.

Describe the solution you'd like
I'd like to request a flag that generates a basic parameter file for the build complete with the default values for each parameter and a validation tool that lets me provide a template parameter file at build that Bicep can validate the values of.

@WhitWaldo WhitWaldo added the enhancement New feature or request label Oct 7, 2021
@ghost ghost added the Needs: Triage 🔍 label Oct 7, 2021
@brwilkinson
Copy link
Collaborator

you can install the ARM VSCode extension.

image

select file type as
image

Then use snippets.

image

it will provide this...

image

Then you can continue with snippets to create individual params

Switch the param file back to JSON language (e.g. F1, language, select)

image

image

There could be an easier way...

related to this: #3381

There is a thread on having the ability to have native Bicep param file format, I will link it if I find it.

@brwilkinson
Copy link
Collaborator

found it: #399

@matsest
Copy link
Contributor

matsest commented Oct 7, 2021

Would be nice to have #3381 solved to have this natively in the extension, but to add on @brwilkinson's comment it's also possible to use the following workaround to avoid manually entering the values

  1. Build Bicep File (with cli or vs code)
  2. Right click on generated template json file and choose Generate ARM template parameter file
  3. Delete the generated template json file

If you're a Powershell user I would also recommend the New-BicepParameterFile cmdlet from the PSBicep module that does something similar in one command.

New-BicepParameterFile [-Path] <String> [-Parameters <String>] [[-OutputDirectory] <String>] [-WhatIf]
 [-Confirm] [<CommonParameters>]

@WhitWaldo
Copy link
Author

WhitWaldo commented Oct 7, 2021

I'd like to see exactly the functionality described by @matsest in the Bicep CLI and included as another output of the build step (though ideally it wouldn't be a blanket overwrite so much as:

  • If new parameters exist in the output, they're added to the parameter file
  • If parameters have been removed, they're either removed from the parameter file or commented out (maybe put this on a flag to more easily consume in CI/CD vs local manual deployments)
  • If the type of a parameter has changed, comment out the older value and insert the new type shape (again, flaggable, for easier downstream usage)

Especially from a CI/CD standpoint, having a generated parameters file with the names, types and default values would simplify automatically populating the file as opposed to building it outright and having to read the template to extract out these values itself.

@alex-frankel
Copy link
Collaborator

Closing as dup of #512. It would be a great community contribution if anyone has time for it ;)

@ghost ghost locked as resolved and limited conversation to collaborators May 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request Needs: Triage 🔍
Projects
None yet
Development

No branches or pull requests

4 participants