I'd like to define a set of tags that are applied ...
# golang
s
I'd like to define a set of tags that are applied to all resources, but still have additional tags that are defined per-resource. What's the best way to do that in Go?
b
I've had some success here with mergo https://github.com/imdario/mergo
i last used it for kubernetes labels, but the same thing should apply, something like this
Copy code
tags := pulumi.StringMap{
  "app": pulumi.String(name),
}

additionalTags := pulumi.StringMap{
  "owner": pulumi.String(owner)
}

if err := mergo.Merge(&tags, additionalTags, mergo.WithOverride); err != nil {
  if err != nil {
    return nil, err
  }
}
l
Have you seen this article on tagging with transformations? https://www.pulumi.com/blog/automatically-enforcing-aws-resource-tagging-policies/
s
I have, thanks. It's a bit of overkill for my use case (single user, not a team of folks), I think.