HomecareHomebase / azure-bake

An Open Source Deployment Management Framework for DevOps and Developers
MIT License
9 stars 14 forks source link

rgOverride Doesn't Support Expressions #93

Closed bdschaap closed 5 years ago

bdschaap commented 5 years ago

The Bake schema documentation indicates that expressions are supported for rgOverride. However, I'm receiving the error message below when specifying the following expression for an event hub recipe. Specifically, I am trying to deploy an event hub within an event hub namespace defined in a different recipe. Note that event hubs must be created in the same resource group as the event hub namespace in Azure. Would appreciate any suggested workarounds as well.

rgOverride: "[coreutils.resource_group('product')]"

[Tue, 02 Jul 2019 19:54:28 GMT] Downloading ingredients... [Tue, 02 Jul 2019 19:54:28 GMT] - @azbake/ingredient-event-hub [Tue, 02 Jul 2019 19:54:30 GMT] Ingredients loaded [Tue, 02 Jul 2019 19:54:30 GMT] logging into azure... RangeError

bdschaap commented 5 years ago

I came up with a temporary workaround where I give the event hub's recipe the same short name as the event hub namespace's recipe. Not ideal but it works for now. Example -

shortName: myeventhubnamespace
version: 0.0.1
ingredients:
  - "@azbake/ingredient-event-hub"
parallelRegions: true
resourceGroup: false
recipe:
  eh-deploy: 
    properties:
      #Specify the Bake ingredient above
      type: "@azbake/ingredient-event-hub"
      source: ""
      parameters:        
        eventHubName: "[eventhub.create_resource_name('myeventhub')]"        
        eventHubNamespaceName: "[coreutils.get_event_hub_namespace_name('myeventhubnamespace')]"
        messageRetentionInDays: "1"
        partitionCount: "2"
        policyName: "defaultPolicy"
whilke commented 5 years ago

You're creating a stack overflow since coreutils.resource_group tries to eval rgOveride..which loops until it dies. There is a new rgOverride pattern you can use to solve this.