sparse-intern-71089
06/04/2021, 6:01 PMprehistoric-nail-50687
06/07/2021, 8:45 AM"azure-native:"
and did not have any issues so far..
something like this:
/**
* Registers a global stack transformation that merges a set
* of tags with whatever was also explicitly added to the resource definition.
*
* The current implementation checks whether the type starts with "azure-native:",
* if so it will blindly add the 'tags'.
*
* The basic idea was taken from <https://github.com/joeduffy/aws-tags-example/tree/master/autotag-ts>
*/
export function registerAutoTags(autoTags: Record<string, string>): void {
pulumi.runtime.registerStackTransformation((args: pulumi.ResourceTransformationArgs) => {
if (args.type.startsWith("azure-native:")) {
args.props["tags"] = {
...args.props["tags"],
...autoTags,
};
return {
props: args.props,
opts: args.opts,
};
}
return undefined;
});
}