On serverless.yml access to array item as a self variable

Hi,

How I can access to a array item using the self variable syntax, for example if I have the following YAML:

custom:
sns: ${self:functions.nameFunc.events[0].sns}
functions:
nameFunc:
events:
- sns: topicName

I try to access to the defined topic name.

Typically people do it the other way around which removes the problem:

custom:
  sns: topicName
functions:
  nameFunc:
    events:
      - sns: ${self:custom.sns}

Yes I know but I want to not have the custom variable, and for example on the IAM roles use directly the reference to the function item

In case someone need this the syntax is:
self:resources.Resources.transactions.Properties.GlobalSecondaryIndexes.0.IndexName

2 Likes