[Extendable Param Files] Multiple Extends Statements
Add support for multiple extends statements in an extendable .bicepparam file
+1
Any hopes of this being added?
Design for Multiple extends statements in bicepparam files
TL;DR
bicepparam files can include multiple extends statements, allowing to inherit parameters from several base parameter files. Each extends statements specifies one bicepparam file, and parameters from all extended files are merged in order. Local parameters override inherited ones. If conflicting parameter values are found across extended files, the compiler will report an error to ensure explicit resolution. This feature enables flexible, modular, and reusable parameter configurations with minimal syntax changes.
Syntax
Two syntax options;
Multiple extends lines
One extends statement per base file.
Allow the bicepparam file to have multiple extends lines, each with exactly one file path:
extends 'base.bicepparam'
extends 'global.bicepparam'
param environment = 'dev'
param enableMonitoring = false
Single extends statement with array of base files
extends [ 'base.bicepparam', 'global.bicepparam' ]
param environment = 'dev'
param enableMonitoring = false
Semantic Resolution
For each extends statements:
- Load and recursively resolve its parameters and its own
extends. - Merge all extended parameter sets.
- Detect cycles across all extends to prevent infinite loops.
Parameter Merging and Conflict Handling
- Merge parameters from extended files in the order they are declared.
- Detect if the same parameter is defined in multiple extended files with different values.
- Conflict resolution options:
- Fail compilation with a clear error message asking the user to override explicitly.
- Optionally, allow a CLI flag to relax this to “last wins”.
Override Priority
- Local parameters defined in the entry point
bicepparamfile overrideallextended parameters.
Backward Compatibility
- Current users with one extends line continue to work without change.
- Multiple extends lines are additive.
Example
extends [ 'base.bicepparam' , 'security.bicepparam' ]
param environment = 'prod'
param enableMonitoring = true
- Parameters from base.bicepparam and security.bicepparam are merged (in that order).
- Local parameters override merged ones.
Benefits
- Minimal syntax change - very intuitive to users already familiar with single
extends. - Easy to add multiple bases without changing existing files.
- Explicit ordering of inheritance via multiple
extendslines.
One year since this suggestion was made so that means we're only 2 years away from this getting implemented, yay! Exciting!
Hey @mrkesu , can you share some scenarios/use-cases that you need multiple extends statements in bicepparam files?