0

I'm currently trying to manually convert an existing ARM template to bicep because the automated decompile method fails.

The existing template contains the following variables:

"environmentSize": {
        "dev": "small",
        "msdn": "small",
        "int": "small",
        "act": "large",
        "prod": "large"
    },
    "size": "[variables('environmentSize')[parameters('environment')]]",

What would be the equivalent with Bicep?

I've tried the following but it's clearly wrong as I get a red squiggly below the $:

var environmentSize = {
  dev:'small'
  msdn:'small'
  int:'small'
  act:'large'
  prod:'large'
}
var size = environmentSize.${environment}
Thomas
  • 24,234
  • 6
  • 81
  • 125
Rob Bowman
  • 7,632
  • 22
  • 93
  • 200

1 Answers1

2

Using brackets notation should work.

param environment string = 'dev'

var environmentSize = {
  dev:'small'
  msdn:'small'
  int:'small'
  act:'large'
  prod:'large'
}

output size string = environmentSize[environment]

Thomas
  • 24,234
  • 6
  • 81
  • 125