Is it possible to use AutoTag (<https://github.com...
# aws
c
Is it possible to use AutoTag (https://github.com/joeduffy/aws-tags-example) with custom
Name
tags without causing Pulumi to treat the tags as changes?
I've got three tags created with
aws.ec2.Tag
for a VPC and 2 subnets A preview/apply shows 3 changes even when there are none
l
Is the change happening in a stack transformation or inside an
apply()
?
I see that you're using `aws.ec2.Tag`; if you're using the StackTransformation only for tags, then you could remove that and use the AWS provider's defaultTags opt instead.
Auto-tagging was so popular, they built it into the provider.
c
oh, nice
i'm using pulumi automation and calling autotag as a class within an inline function
Where's the documentation for the auto-tagging for the provider?
l
I don't grok "call as a class within an inline function" but it doesn't sound right. Joe's autotagging is a StackTransformation implementation. You register it, you don't call it... The AWS classic provider is documented in Registry. Here's a direct link to the defaultTags property.: https://www.pulumi.com/registry/packages/aws/api-docs/provider/#defaulttags_nodejs
c
your link drops me to nowhere
l
If you're using the default AWS provider (that is, if you're not instantiating an instance of this class), then you can use
aws:defaultTags
in your Pulumi stack config file.
Ouch. That's the link I copied from the page! I'll get a new one...
All the links in that page are borked. They work if you're on the page, they don't if you just paste them into the browser...
Just search for defaultTags 🙂
Actually the page in general is borked..
c
Thanks. I searched it. I'm just not sure how to set the provider config with pulumi automation
l
Inside your Pulumi program (not the automation program), you can construct an instance of the provider and pass it as an opt to your resource constructors.
Or if you're using the default provider, you can configure it using your Pulumi.<stack>.yaml.
Using something like
Copy code
aws:defaultTags:
    tags:
      stack: dev
      createBy: Pulumi
Or something like that. That code is untested... maybe someone else is using defaultTags through the config file and can provide a better example?