Hi all, does anyone have an azure(-native) equival...
# azure
p
Hi all, does anyone have an azure(-native) equivalent of this aws taggable resources list? https://github.com/joeduffy/aws-tags-example/blob/master/autotag-ts/taggable.ts
p
I just check for the the prefix:
"azure-native:"
and did not have any issues so far.. something like this:
Copy code
/**
 * 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;
  });
}
🙌 1