Copyright (c) 2024-2025 CoreWeave, Inc.
There are various ways to build and run the provider for development. Building the provider is simple: make build.
To run the provider with a dev build, invoke the script ./devtf to invoke your local terraform binary against a dev build from the current working copy, passing terraform env and args as normal. For example:
./devtf apply -compact-warnings -var a=1Debugging the provider can be a bit complicated. To do so, we must run the provider itself as a server, and then configure our terraform CLI to use the provider server, instead of invoking it directly. The debugger will then step through the code, as it's invoked by the terraform CLI. This means that the terraform process will continue running (and waiting for the provider to finish its work, even if it's waiting on a breakpoint), while we operate. The terraform CLI and the provider's processes are fully decoupled in this mode. Keep this in mind when using it.
You will need to install delve (dlv) or use the built-in VSCode delve version.
You must create a debug env file, touch __debug.env. Because the provider server runs as a process separate from terraform itself, it is unable to inherit environment variables from the terraform process. This is useful for injecting environment variables to the provider, to configure credentials or provider settings.
Invoke the debugger by selecting "Debug Terraform Provider Server" in the "run and debug" menu. The debug console will open, and include a line that starts with TF_REATTACH_PROVIDERS. Copy this line into your shell, and export it, like TF_REATTACH_PROVIDERS=.... terraform calls from this shell will now use the delve session.
The following is a good starting point to run the debugger:
make debugThe output will include a line that starts with TF_REATTACH_PROVIDERS. Copy this line into the shell you wish to run terraform from, and export it, like TF_REATTACH_PROVIDERS=.... terraform calls from this shell will now use the delve session.
Note: When finished, you may need to kill dlv's PID.
Clone repository to: $GOPATH/src/github.com/coreweave/terraform-provider-coreweave
$ mkdir -p $GOPATH/src/github.com/coreweave; cd $GOPATH/src/github.com/coreweave
$ git clone [email protected]:coreweave/terraform-provider-coreweaveEnter the provider directory and build the provider
$ cd $GOPATH/src/github.com/coreweave/terraform-provider-coreweave
$ make buildSee the CoreWeave Provider documentation to get started using the CoreWeave provider.
MIT Licensed. See LICENSE for full details.