Hi there. I’d like to ask for some advice on handling provider config in a custom provider.
I have a custom TF provider that works with some internal APIs. I’m trying to add provider config so that people who use this provider can control which API endpoints are used if they need to. I’ve done that so far by adding a config schema to the provider, and using a ConfigureFunc that reads that config data and returns it in a custom type so that it’s passed in as the ‘meta’ argument in resource CRUD functions, and in CustomDiff functions. However, I haven’t yet been able to figure out how to access that same data in a DiffSuppress function, which is a problem because for various (not-that-interesting) reasons I need to make an API call to check whether a proposed TF state change actually represents a change in resource state. So I need to get that API endpoint from the provider config during a diff suppress function. What’s the best way to do that?
If there’s no way to access the provider config directly from this function, then is it safe for me to copy this provider config to a global variable and then read it from there? I’m guessing that the provider is only instantiated once per process but I’d like to be sure.
Thanks in advance for any suggestions.
Harry