This is a specialized Terraform provider for managing CockroachDB SQL objects (databases, roles, grants, etc.).
- Native CockroachDB Support: Tailored to align with the CockroachDB SQL dialect and behavior.
- Strict
CREATE ROLESyntax: Supports CockroachDB-specific role options and ignores unsupported role options. - DDL Stability: DDL operations are executed directly against the database connection to ensure reliability in CockroachDB's distributed environment.
- Native Default Privileges: Uses CockroachDB's native
SHOW DEFAULT PRIVILEGESfor accurate state management.
- Terraform 1.0+
- Go 1.25+ (to build the provider plugin)
- CockroachDB: v23.2.0+ (LTS) is the minimum supported version.
- Clone the repository:
git clone git@github.com:nellisauction/terraform-provider-cockroachsql.git
- Build the binary:
make build
To use this provider locally, you can use Terraform's dev_overrides feature. Create or edit your ~/.terraformrc file:
provider_installation {
dev_overrides {
"nellisauction/cockroachsql" = "/path/to/your/compiled/binary/directory"
}
direct {}
}In your Terraform configuration:
terraform {
required_providers {
cockroachsql = {
source = "nellisauction/cockroachsql"
}
}
}
provider "cockroachsql" {
host = "localhost"
port = 26257
username = "root"
database = "defaultdb"
sslmode = "disable"
}To use this provider with Pulumi, build the binary and then add it to your Pulumi project:
pulumi package add terraform-provider /path/to/terraform-provider-cockroachsqlTo run the full suite of Acceptance tests, run make testacc.
Note: Acceptance tests create real resources and require a running CockroachDB cluster.