AWS Step Function Map -- Broadening State

217 Views Asked by At

I've got a pretty sweet step function cooking, and I am using Map to iterate through an array in state. Ideally, I want to be able to reference values from outside that iterator state and I'm struggling to do so.

const forkDeliveryStream = new sfn.Map(this, 'ForkDeliveryStream', {
      maxConcurrency: 3, // may want to increase if audience grows
      itemsPath: '$.audience.L',
      // what to put here to let me access values from outside the `itemsPath`?
      // parameters: {
      //   Audience: '$$.Map.Item.S',
      //   Notification: '$$.Execution.Notification',
      // },
    });
    forkDeliveryStream.iterator(new DeliveryStream(this, 'DeliveryStream'));
1

There are 1 best solutions below

0
On

Check out the example on https://states-language.net/#map-state with the text "Suppose that the "ship-val" function also needs access to the shipment’s courier, which would be the same in each iteration."

$$.Map.Item refers to each item being iterated over, $ refers to the state input.