The tagging structure that SAM tends to use ({my_key: my_value}) is significantly less flexible than the format than the format that many CloudFormation templates use ([{ Key: my_key, Value: my_value }]), and it would be great if SAM allowed for using the older, more verbose format as well.
I understand and appreciate that SAM generally tries to simplify the deployment of many complex resources, and allows for writing less code in many cases. In this case, though, since tagging in inherently a function designed for user-defined customization, the lack of choice to use the more verbose structure conflicts with that design intent of tagging.
As an example of where this creates an issue, there are times where I create templates and I want some tag key and tag value to be user-defined through stack parameters. Using the verbose structure of tagging, this very easy to achieve ([{ Key: !Ref TagKey Value: !Ref TagValue }]. Using the more compact structure, there's no way to use Ref to define the tag key.
It's certainly possible in these cases to replace all SAM resources with their CloudFormation counterparts, but it's strange to have to give up all the benefits and time savings associated with SAM, just to achieve something so basic with tagging.
Given that, in nearly all cases, SAM has to translate from the compact structure to the verbose structure to create the underlying resources during transformation, it would be great if it could identify when the Tags property is an array rather than a map, and simply pass the tags along without transforming them in that case.
The tagging structure that SAM tends to use (
{my_key: my_value}) is significantly less flexible than the format than the format that many CloudFormation templates use ([{ Key: my_key, Value: my_value }]), and it would be great if SAM allowed for using the older, more verbose format as well.I understand and appreciate that SAM generally tries to simplify the deployment of many complex resources, and allows for writing less code in many cases. In this case, though, since tagging in inherently a function designed for user-defined customization, the lack of choice to use the more verbose structure conflicts with that design intent of tagging.
As an example of where this creates an issue, there are times where I create templates and I want some tag key and tag value to be user-defined through stack parameters. Using the verbose structure of tagging, this very easy to achieve (
[{ Key: !Ref TagKey Value: !Ref TagValue }]. Using the more compact structure, there's no way to useRefto define the tag key.It's certainly possible in these cases to replace all SAM resources with their CloudFormation counterparts, but it's strange to have to give up all the benefits and time savings associated with SAM, just to achieve something so basic with tagging.
Given that, in nearly all cases, SAM has to translate from the compact structure to the verbose structure to create the underlying resources during transformation, it would be great if it could identify when the
Tagsproperty is an array rather than a map, and simply pass the tags along without transforming them in that case.