Skip to content

How to properly use the resources: [] element? #2838

Discussion options

You must be logged in to vote

We have a slightly different syntax for expressing child resources, which is what the resources property is for in ARM JSON. Instead of using this property, you declare the resource just like a top level resource. In this case:

resource psql 'Microsoft.DBForPostgreSQL/servers@2017-12-01' = {
  // ...
  
  resources db 'databases' = {
      name: 'mydatabase'
      properties: {
        charset: 'UTF8'
        collation: 'English_United States.1252'
      }
    }
}

Notice we inherit the parent type and apiVersion. You can override the apiVersion if you need to (i.e. 'databases@2021-01-01')

More info here: https://github.com/Azure/bicep/blob/main/docs/spec/resources.md#resource-nesting

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by matthiasguentert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants