Split ENV Variable on comma and combine with preceding key

Assuming we have an environment that is a delimited list of Kafka topics (e.g. KAFKA_TOPICS=dev.etl,stg,etl), I’d like to be able to specify the event triggers for each one of the topics. Each event trigger has to be preceeded by a '- trigger: ’ though because of the serverless-kubeless plugin.

How would I go about doing that with the templating language?

For example:

# serverless.yaml
service: some-service

provider:
  name: kubeless
  runtime: nodejs12
  timeout: 180

plugins:
  - serverless-kubeless

functions:
  translate:
    handler: handler.translate
    events:
      "Fn::Split":
        - ","
        - ${env:KAFKA_TOPICS}
      # - trigger: 'dev.etl' # need them expanded like so
      # - trigger: 'stg.etl'
    namespace: mynamespace