Q:

Cloudformation template parameter to pass tags to resource

I've been racking my brain but cant see how it can be done which seems limited, but I would like to be able to have a template parameter that can be used to pass arbitrary tags to a supported resource in my template, for example:
EC2Tags:
  Description: Tags to add to the EC2 Instance
  Type: CommaDelimitedList
  Default: "CreatedBy=JohnDoe,Name=NewEC2,OtherTag=OtherValue"

 ....

but later on the resource requires something like:
Type: "AWS::EC2::Instance"
Properties:
  Tags: 
    - 
     Key: "keyname1"
     Value: "value1"
    - 
     Key: "keyname2"
     Value: "value2" 

  ....

Is there anyway to achieve this goal?

A:

I wanted a generic solution that didn't assume number of tags, order of tags or tag names, and after much trial and error I have managed to solve this using the custom resource solution proposed by @laurent-jalbert-simard.
Here is the gist if anyone else might find useful:
https://gist.github.com/ispyinternet/97b434a2a58aea5d496ecd87b29e64e9

