{"id":28763635,"url":"https://github.com/cockroachdb/terraform-provider-cockroach","last_synced_at":"2025-06-17T09:10:02.580Z","repository":{"id":59197810,"uuid":"467960240","full_name":"cockroachdb/terraform-provider-cockroach","owner":"cockroachdb","description":"Terraform provider for CockroachDB Cloud","archived":false,"fork":false,"pushed_at":"2025-06-13T12:43:50.000Z","size":11066,"stargazers_count":58,"open_issues_count":14,"forks_count":14,"subscribers_count":47,"default_branch":"main","last_synced_at":"2025-06-13T14:02:36.364Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cockroachdb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-03-09T14:26:40.000Z","updated_at":"2025-06-13T12:43:52.000Z","dependencies_parsed_at":"2024-03-10T04:31:40.556Z","dependency_job_id":"701eb3e5-963b-497f-959e-31e2f84dc2b1","html_url":"https://github.com/cockroachdb/terraform-provider-cockroach","commit_stats":{"total_commits":188,"total_committers":27,"mean_commits":6.962962962962963,"dds":0.6648936170212766,"last_synced_commit":"2d22e37aef01f6791e8078e0dc1c9f948f31b716"},"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"purl":"pkg:github/cockroachdb/terraform-provider-cockroach","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cockroachdb%2Fterraform-provider-cockroach","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cockroachdb%2Fterraform-provider-cockroach/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cockroachdb%2Fterraform-provider-cockroach/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cockroachdb%2Fterraform-provider-cockroach/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cockroachdb","download_url":"https://codeload.github.com/cockroachdb/terraform-provider-cockroach/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cockroachdb%2Fterraform-provider-cockroach/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260326793,"owners_count":22992388,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-17T09:10:00.640Z","updated_at":"2025-06-17T09:10:02.569Z","avatar_url":"https://github.com/cockroachdb.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terraform provider for CockroachDB Cloud\n\n[`terraform-provider-cockroach`](https://registry.terraform.io/providers/cockroachdb/cockroach/latest) is the [Terraform provider](https://learn.hashicorp.com/collections/terraform/providers) for the CockroachDB Cloud API [[reference](https://www.cockroachlabs.com/docs/api/cloud/v1), [getting started](https://www.cockroachlabs.com/docs/cockroachcloud/cloud-api)].\n\n- [Provision a CockroachDB Cloud Cluster with Terraform](https://www.cockroachlabs.com/docs/cockroachcloud/provision-a-cluster-with-terraform.html)\n- [More information about CockroachDB](https://www.cockroachlabs.com/)\n- [More information about Terraform](https://terraform.io)\n\nFor information on developing `terraform-provider-cockroach` see [DEVELOPMENT.md](DEVELOPMENT.md).\n\n## Get Started\n\n### _Warning_: Use of *private endpoints* requires \u003e=v1.7.6\nIf you intend to use this provider to provision [private endpoints](https://github.com/cockroachdb/terraform-provider-cockroach/blob/main/docs/resources/private_endpoint_connection.md):\n- [AWS PrivateLink](https://www.cockroachlabs.com/docs/cockroachcloud/aws-privatelink)\n- [GCP Private Service Connect](https://www.cockroachlabs.com/docs/cockroachcloud/connect-to-your-cluster#gcp-private-service-connect)\n- [Azure Private Link](https://www.cockroachlabs.com/docs/cockroachcloud/cockroachdb-dedicated-on-azure)\n\nYou must install/upgrade to [version 1.7.6](https://github.com/cockroachdb/terraform-provider-cockroach/releases/tag/v1.7.6) or [later](https://registry.terraform.io/providers/cockroachdb/cockroach/latest).\n\n### Prerequisites\n\nBefore you use `terraform-provider-cockroach` you must [install Terraform](https://learn.hashicorp.com/tutorials/terraform/install-cli) and [`git`](https://git-scm.com/downloads) on your local machine.\n\n## Run the Serverless Example\n\n1. In a terminal clone the `terraform-provider-cockroach` repository:\n\n    ~~~ shell\n    git clone https://github.com/cockroachdb/terraform-provider-cockroach.git\n    ~~~\n\n1. Go to the `examples/workflows/cockroach_serverless_cluster` directory.\n\n    ~~~ shell\n    cd examples/workflows/cockroach_serverless_cluster\n    ~~~\n\n1. The provider requires an API key set in an environment variable named `COCKROACH_API_KEY`. Copy the [API key](https://www.cockroachlabs.com/docs/cockroachcloud/console-access-management.html#api-access) from the CockroachDB Cloud console and create the `COCKROACH_API_KEY` environment variable.\n\n    ~~~ shell\n    export COCKROACH_API_KEY=\u003cYOUR_API_KEY\u003e\n    ~~~\n\n    Where `\u003cyour API key\u003e` is the API key you copied from the CockroachDB Cloud Console.\n\n1. In a text editor create a new file `terraform.tfvars` in `cockroach_serverless_cluster` with the following settings.\n\n    ~~~\n    cluster_name = \"\u003ccluster name\u003e\"\n    sql_user_name = \"\u003cSQL user name\u003e\"\n    sql_user_password = \"\u003cSQL user password\u003e\"\n    ~~~\n\n    Where:  \n        - `\u003ccluster name\u003e` is the name of the cluster you want to create.  \n        - `\u003cSQL user name\u003e` is the name of the SQL user you want to create.  \n        - `\u003cSQL user password\u003e` is the password for the SQL user you want to create.  \n\n1. Initialize the provider.\n\n    ~~~ shell\n    terraform init\n    ~~~\n\n    This reads the `main.tf` configuration file, which contains the information on how the provider will create the Serverless cluster. The `terraform.tfvars` file sets the cluster name, SQL user name, and SQL user password.\n\n1. Create the Terraform plan. This shows the actions the provider will take, but won't perform them.\n\n    ~~~ shell\n    terraform plan\n    ~~~\n\n1. Create the cluster.\n\n    ~~~ shell\n    terraform apply\n    ~~~\n\n    Enter `yes` when prompted to apply the plan and create the cluster.\n\n1. (optional) Delete the cluster when you are done.\n\n    ~~~ shell\n    terraform destroy\n    ~~~\n\n    Enter `yes` when prompted to delete the cluster.\n\n## Run the Dedicated Example\n\n\u003e Running this example will incur charges to your CockroachDB account.\n\u003e It defaults to a minimal hardware spec, but please remember to run\n\u003e `terraform destroy` when you're done if you don't need to keep your cluster.\n\n1. In a terminal clone the `terraform-provider-cockroach` repository:\n\n    ~~~ shell\n    git clone https://github.com/cockroachdb/terraform-provider-cockroach.git\n    ~~~\n\n1. In a terminal go to the `examples/workflows/cockroach_dedicated_cluster` directory.\n\n    ~~~ shell\n    cd examples/workflows/cockroach_dedicated_cluster\n    ~~~\n\n1. The provider requires an API key set in an environment variable named `COCKROACH_API_KEY`. Copy the [API key](https://www.cockroachlabs.com/docs/cockroachcloud/console-access-management.html#api-access) from the CockroachDB Cloud console and create the `COCKROACH_API_KEY` environment variable.\n\n    ~~~ shell\n    export COCKROACH_API_KEY=\u003cYOUR_API_KEY\u003e\n    ~~~\n\n    Where `\u003cyour API key\u003e` is the API key you copied from the CockroachDB Cloud Console.\n\n1. In a text editor create a new file `terraform.tfvars` in `cockroach_dedicated_cluster` with the following settings.\n\n    ~~~\n    cluster_name = \"\u003ccluster name\u003e\"\n    database = \"\u003cdatabase name\u003e\"\n    sql_user_name = \"\u003cSQL user name\u003e\"\n    sql_user_password = \"\u003cSQL user password\u003e\"\n    cloud_provider = \"\u003ccloud provider\u003e\"\n    cloud_provider_regions = [\"\u003ccloud provider region\u003e\"]\n    cluster_node_count = \u003cnumber of nodes\u003e\n    num_virtual_cpus = \u003cnumber of VCPUs per node\u003e\n    storage_gib = \u003cstorage in GiB\u003e\n    allow_list_name = \"\u003callow list name\u003e\"\n    cidr_ip = \"\u003callow list CIDR IP\u003e\"\n    cidr_prefix_length = \u003callow list CIDR prefix length\u003e\n    os = \"\u003cOS name\u003e\"\n    ~~~\n\n    Where:  \n        - `\u003ccluster name\u003e` is the name of the cluster you want to create.  \n        - `\u003cdatabase name\u003e` is the name that will be used for the database created within the cluster. This database is in addition to defaultdb which is created by default.  \n        - `\u003cSQL user name\u003e` is the name of the SQL user you want to create.  \n        - `\u003cSQL user password\u003e` is the password for the SQL user you want to create.  \n        - `\u003ccloud provider\u003e` is the cloud infrastructure provider. Possible values are `GCP` or `AWS` or `AZURE`.  \n        - `\u003ccloud provider region\u003e` is the region code or codes for the cloud infrastructure provider. For multi-region clusters, separate each region with a comma.  \n        - `\u003cnumber of nodes\u003e` is the number of nodes in each region. Cockroach Labs recommends at least 3 nodes per region, and the same number of nodes in each region for multi-region clusters.  \n        - `\u003cnumber of VCPUs per node\u003e` is the number of virtual CPUS assigned to each node.  This number will dictate which machine type is used for your cluster nodes. Recommendations for choosing this value can be found [here](https://www.cockroachlabs.com/docs/cockroachcloud/create-your-cluster#step-5-configure-cluster-capacity).  \n        - `\u003cstorage in GiB\u003e` is the amount of storage specified in GiB.  \n        - `\u003callow list name\u003e` is the name for the IP allow list. Use a descriptive name to identify the IP allow list. (i.e. \"allow all\" or \"home network\")  \n        - `\u003callow list CIDR IP\u003e` is the Classless Inter-Domain Routing (CIDR) IP address base. (i.e. 123.123.123.123)  \n        - `\u003callow list CIDR prefix length\u003e` is the CIDR prefix length. This should be a number from 0 to 32. Use 32 to only allow the single IP Address passed in cidr_ip.  \n        - `\u003cOS name\u003e` is the name of the OS that will be used to connect from for connection string output. Possible values are ('WINDOWS', 'MAC', and 'LINUX').  \n\n1. Initialize the provider.\n\n    ~~~ shell\n    terraform init\n    ~~~\n\n    This reads the `main.tf` configuration file, which contains the information on how the provider will create the Serverless cluster. The `terraform.tfvars` file sets the cluster name, SQL user name, and SQL user password.\n\n1. Create the Terraform plan. This shows the actions the provider will take, but won't perform them.\n\n    ~~~ shell\n    terraform plan\n    ~~~\n\n1. Create the cluster.\n\n    ~~~ shell\n    terraform apply\n    ~~~\n\n    Enter `yes` when prompted to apply the plan and create the cluster.\n\n1. (optional) Delete the cluster when you are done.\n\n    ~~~ shell\n    terraform destroy\n    ~~~\n\n    Enter `yes` when prompted to delete the cluster.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcockroachdb%2Fterraform-provider-cockroach","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcockroachdb%2Fterraform-provider-cockroach","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcockroachdb%2Fterraform-provider-cockroach/lists"}