Simplify `auto_tag`
Hi,
I would like to propose to simplify the auto_tag function to this:
def auto_tag(args, auto_tags):
""" Applies the given tags to the resource properties if applicable. """
if hasattr(args.resource, "tags"):
args.props["tags"] = {**(args.props["tags"] or {}), **auto_tags}
return pulumi.ResourceTransformationResult(args.props, args.opts)
in order to remove the dependency on taggable.py and all the static definition of taggable resources.
I have tested using Azure, so it would be great if someone can test it on AWS.
Thanks
In Go I went this way instead of the isTaggable function and so far that works - granted not tested all resource types
if !val.FieldByName("Tags").CanSet() {
...
}
@yellowhat this is perfect, works and using on AWS!!! 🎉
The only problem I have run into so far in AWS with python is with: https://www.pulumi.com/registry/packages/aws/api-docs/autoscaling/group/#tags_python
The tag property for the autoscaling group wants Sequence[GroupTagArgs] which causes this to method to fail.
This is awesome and works on AWS with Python for us! Haven't run into any issues so far. 🙂
how to merge it with existing tags, for example Name tags
It should work as it merges existing tags.