https://pulumi.com logo
#general
Title
# general
t

thankful-planet-44055

08/02/2023, 12:06 AM
Is there a way to ignore changes to resourceName? When I create instance templates, I want the name to have a timestamp in it. But that triggers an update. This does not work:
opts=ResourceOptions(ignore_changes=["resourceName"])
Wonder if setting the “name” would be a better approach?
g

green-stone-37839

08/02/2023, 12:08 AM
I'm not entirely sure what you're after, but by
resourceName
do you mean
Copy code
new SomeResource("this part?")
t

thankful-planet-44055

08/02/2023, 12:09 AM
Yes.
g

green-stone-37839

08/02/2023, 12:09 AM
ignoreChanges doesn't work here as you've found. You could use
aliases
for this purpose, but backing up a bit, what is the reasoning behind putting a timestamp in your resource name?
t

thankful-planet-44055

08/02/2023, 12:20 AM
Aliases I don’t work as that won’t prevent a new resource from being created if only the resourceName changes. Also that keeps the old resource around and then list of aliases will get long and be dynamic. My use care is when a new resource needs to be made, it get’s the name with the timestamp, I don’t care what Pulumi calls it, but I care what I see in the cloud console. If I set “name”, could I ignore that?
I want the timestamp so it’s blatantly obvious if an instance is using an old one.
Looks like setting name (not resourceName) works! I also append a random element at the end for uniqueness (which Pulumi would do otherwise).
opts=ResourceOptions(ignore_changes=["name"]),  # Avoid changes due to datestamp and random
With a bit more testing, this looks to not be a great solution.
g

green-stone-37839

08/02/2023, 1:30 PM
ignore_changes simply tells Pulumi to ignore any changes to a particular field or set of fields. If you only want to track creation date,
name
is probably a decent approach, but it sounds like you want to track when a template was created and updated. And any time you update
name
you'll force a replacement. Tags are probably the only logical vehicle for what you're trying to get after, although not as visible as something like name.
t

thankful-planet-44055

08/02/2023, 9:10 PM
Yup, neither name or resource_name work well. Rather than a tag, i can just look at the template and look at the creation date.
2 Views