-
Notifications
You must be signed in to change notification settings - Fork 817
Description
Describe the bug
Build params was not evaluating variables declared in base .bicepparam files when using extends, which led to missing/incorrect values in derived parameter files. This change adds evaluation of variables and parameter assignments across the extends chain and adds integration tests for simple and complex base variables to ensure merged params produce the expected values.
To Reproduce
// consts.bicep
@export()
var regions = {
primary: {
envType: {
nonprod: 'foo'
prod: 'foo'
}
}
secondary: {
envType: {
prod: 'bar'
}
}
}
// nonprod.bicepparam
import * as consts from './consts.bicep'
using none
param environmentType = 'nonprod'
param serviceDomain = 'search'
param singletonRegion = consts.regions.primary.envType.nonprod
param tenant = 'foo'
var resourceSuffix = '${serviceDomain}-${tenant}-${environmentType}'
param keyVaultName = 'kv-${resourceSuffix}'
param sharedGroupName = 'rg-${resourceSuffix}'
// main.bicepparam
import * as consts from './consts.bicep'
extends './nonprod.bicepparam'
using 'main.bicep'
param azureSearchParams = {
name: 'srch-search-pme-nonprod'
properties: {
partitionCount: 1
replicaCount: 1
}
}
param serviceTag = 'XboxSupportSearchNonProd'
param vnetConfigs = [
{
region: consts.regions.primary.envType.nonprod
subnetInfo: [
{
name: 'dev-frontend'
ipIndex: 0
serviceEndpoints: []
}
{
name: 'nonprod-autosuggest'
ipIndex: 1
serviceEndpoints: []
}
{
name: 'int-frontend'
ipIndex: 2
serviceEndpoints: []
}
]
}
]
// main.bicep
type AzureSearchParams = {
name: string
properties: {
partitionCount: int
replicaCount: int
}
}
type EnvironmentType = 'nonprod' | 'prod'
type AzureRegion = 'cus'
| 'eus'
| 'eus2'
| 'ncus'
| 'scus'
| 'wcus'
| 'wus'
| 'wus2'
| 'wus3'
| 'euwe'
| 'euno'
| 'ukso'
| 'ukwe'
type Tenant = 'foo' | 'bar' | 'baz'
param azureSearchParams AzureSearchParams
param environmentType EnvironmentType
param keyVaultName string
param sharedGroupName string
param singletonRegion AzureRegion
param serviceDomain string
param serviceTag string
param tenant Tenant
Metadata
Metadata
Assignees
Type
Projects
Status
Done