Hello, Can `ignoreChanges` resource option be use...
# general
c
Hello, Can
ignoreChanges
resource option be used to ignore provider changes on resource? I’ve tried to ignore ‘provider’ and ‘~provider’ - that did not work - thought i’ll ask here before I go into rabbit hope of digging it in core sources.
in particular - I am using that on github resource, but it still seems to be trying to replace resource, instead of ignore the custom provider passed.
l
To clarify: you don't mean that the provider is changing properties on your resource; you mean that you are changing the provider on your resource? And you want to leave the resource unchanged?
c
Hi Paul, yes, I’ve started passing
provider
to options and would like that not to impact on the history of resource.
actually, the reason why I started doing that is that I cannot use github.token from environment/configuration on my project for unrelated reasons, so I found needing to construct my github provider on the fly after initial resource was created.
l
This question has been asked quite a few times. I think someone came up with a way to do it without editing the stack, but I forget how. When I have done it, I've always edited the stack manually.
Create the new provider, ideally use it at least once. Export the stack. Update all resources that your want to change; they all have a provider property in their opts. Import the stack.
👍 1
Don't forget to make a backup of your stack 🙂
🤞 1
c
I see, thanks, I’ll dig history too, many thanks! In your experience, did it bubble up the chain when provider configuration changed? (just thinking if I go with manual stack edit for this case if I would need to change it every time my token changes or not)
l
No. The change on resources changes a pointer to the provider, not the values within the provider. You should be good to do in-provider work safely any time you need.