Recommended methods for handling API keys with CloudQuery

What is the recommended way to handle API keys? Should they be set as environment variables, and then inserted into the config file’s spec for source and destination? If so, how do I insert them?

Hi @creative-iguana :wave:

Do you mean CloudQuery API keys? Or API keys for the underlying plugins?

If you mean the CloudQuery API key, you can follow the instructions here to generate one and then do:

export CLOUDQUERY_API_KEY=<your-api-key>

before running:

cloudquery sync

This should be all you need.

If you mean for the underlying plugins, then yes, you should export them and then you can use environment variable expansion in the config to insert them: Environment Variable Substitution.

Thanks, that’s what I was looking for—how to expand environment variables in config, necessary for accessing source APIs.

Hm, I am trying to use this method, but it keeps telling me it can’t find the file, and I have tried many different variations. Where should the relative path to the file start from? The location of the plugin directory, or the CloudQuery binary, or?

I think the issue might be related to the working directory from which the CloudQuery binary is executed. Could you try using an absolute path and see if that resolves the problem?

That is correct, thanks. It’s working now.