Template interfaces (suggestion for modularity)
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 79
Description
**Is your feature request related to a problem? Please describe.**
With user defined types you currently define those in the Bicep template file. One of the cases of user defined types is to serve as schema for complex (and not so complex) input parameters. At the same time if you create Bicep parameters file you need to import the the Bicep template via using to get intellisense for the parameters. This kind of implementation does not seems very modular to me. As you have a template that you version the end user needs to download locally every version and reference it.
My proposal is to be able to define a file that can contain only parameters and types. In that file you will define the parameters and the types for your main.bicep template. In the main.bicep template you could be using 'using' or 'import' key word to import the the file that contains the parameters and the types. On the other hand when you have end user with Bicep parameters file they can just be referencing via using just the file that contains the parameters and the types. Additionally the bicep parameters file should allow using to point to file located on HTTP link along to just pointing locally. The benefits of this approach are:
- When using Bicep parameters file you do not have to store the whole Bicep template locally, you can either store only the parameters and types or just point to web url containing that file. When you switch between different versions of Bicep Template it is a lot easier.
- Easier maintaining of the parameters and types as they are in separate file.
- In case of having some incorrect description for parameter and you want to fix it, you do not have to release a new version of your Bicep template, you just fix that in the file containing the types and parameters and if you publish that file on public HTTP you just overwrite existing version.
For even greater flexibility you could allow a file containing parameters and types to be able to reference (using/import) another parameters and types file. This could be important if you are re-using types on different Bicep templates files for the same solution.
In summary, we can think of this parameters and types files as schema that you can modify along with your Bicep templates or separately - depending on the needs. Users who use the parameters file just reference the schema instead of referencing a Bicep solution which in many cases won't be just one file named main.bicep.
Contributor guide
Assessment
This issue has not been assessed yet.