Skip to main content


Running the provider in debug mode#

Debugging CQ providers is a fairly straightforward process:

First, we must run the provider in debug mode. To do this, set the environment variable CQ_PROVIDER_DEBUG=1 in our IDE or terminal and execute the provider.

The following message will appear when executing the plugin binary.

Provider started, to attach Cloudquery set the CQ_REATTACH_PROVIDERS env var:        export CQ_REATTACH_PROVIDERS=/cq-my-provider/.cq_reattach

Once we set up CQ_REATTACH_PROVIDERS, we will be able to execute any command from our CQ binary and it will use the debugged plugin instead of the latest version.


We can now execute our provider from our favourite IDE in debug mode and put in breakpoints to test and debug our provider.


In the following example, we will download an existing provider, compile it, and execute it in debug mode.

git clone build -o cq-provider-awsexport CQ_PROVIDER_DEBUG=1 ./cq-provider-aws // Execute the provider binary// Provider started, to attach Cloudquery set the CQ_REATTACH_PROVIDERS env var://        export CQ_REATTACH_PROVIDERS=/<path_to_your_provider>/.cq_reattach

After executing the provider, we will get a message about how to reattach our provider when we execute the main CQ binary.

// Path where we executed our aws providerexport CQ_REATTACH_PROVIDERS=/providers/cq-provider-aws/.cq_reattach./cloudquery fetch --dsn "host=localhost user=postgres password=pass port=5432"

The same example can be run from the IDE to add breakpoints.