Hi, I’m trying to follow this. <link> on applying ...
# golang
a
Hi, I’m trying to follow this. link on applying auto-tags for golang, but when I copy the sample, for the main function, I’m getting a compile time error
Copy code
./main.go:42:3: undefined: RegisterAutoTags
I’ve imported
Copy code
"<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi|github.com/pulumi/pulumi/sdk/v3/go/pulumi>"
"<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi/config|github.com/pulumi/pulumi/sdk/v3/go/pulumi/config>"
and have ran go mod tidy before running go build. Any suggestions?
e
oh there's a typo on that blog where it uses
RegisterAutoTags
in one part and
registerAutoTags
in another. Just be sure to use the same casing in both.
a
Doh, trying…
What package am I supposed to pull
isTaggable
function from?
Copy code
./autotag.go:14:7: undefined: isTaggable
e
That's not exported from anywhere, but theres some examples around of what it could look like. Normally just a list contains check: https://github.com/joeduffy/aws-tags-example/blob/master/autotag-py/taggable.py There's some thinking about finding a way to do this using the resource schemas rather than a hard coded list, but that's not ready to go yet.
a
Thanks, @echoing-dinner-19531, is this the only way via the stack registration? I appreciate the sample, but that list has not been updated for 5 years and I can see that managing it locally would be a pain for any resource additions/updates. Would you be able to tell if that list needs updating? I’m aware there’s the other option of defining the tags in the stack config file but we are exploring the stack transformation option.
e
This is currently the only way. As above we're looking into seeing if we can expose resource schemas to user programs so your function could instead ask "does this type token have a tags field defined"
🙌 1
a
Great, thank you! For option 2 using the stack config and adding the cloud provider default tags… Does that need the taggable list as well?
e
If by that you mean the DefaultTags option on the aws provider, then no that does the tagging internally in the aws provider so it has the list set as part of the provider build
👍 1