As we continue to strengthen our partnership with HashiCorp, we’re excited to announce the first release of a Verified Terraform Provider for Couchbase Capella. Terraform is widely recognized as the leading provider of infrastructure as code tool that enables you to build, change, and version cloud resources safely and efficiently. Customers can now easily automate the provisioning of Capella resources as code by using HashiCorp Terraform.

How to Use the Couchbase Capella Provider 


The Couchbase Capella Provider allows you to interact with Projects, Clusters, Buckets and Database Users within your Couchbase Capella tenant. Before it can be used, the provider needs to be configured with the proper credentials. To set up authentication with the Couchbase Capella Provider a programmatic API key must be generated.

Couchbase Capella Public API uses a Bearer token mechanism for authentication, so each call to the Public API can be authenticated. To use the Bearer token mechanism with the Couchbase Capella Public API, it is first necessary to obtain Access and Secret keys — this is done within Couchbase Capella UI. These keys are specific to your account in Couchbase Capella and also control authorization for API operations.

Setup and Authentication

You will need to provide your credentials for authentication via the environment variables, CBC_ACCESS_KEY and CBC_SECRET_KEY, for your access and secret API Key Pair respectively.

Example Usage

Create a Terraform configuration file with the .tf file extension. Below is an example configuration file that will deploy a new Project and an AWS Hosted Cluster in Couchbase Capella. 

To deploy the resources configured in your Terraform configuration file, follow the steps below:

1. Initialize the Terraform provider

Execute the following command to initialize the Terraform provider. This step is only required when first interacting with the provider:

terraform init

2. Review the Terraform plan

Execute the following command to review the resources that will be deployed:

terraform plan

3. Execute the Terraform apply

Execute the plan to deploy the Couchbase Capella resources.

terraform apply

4. Destroy the resources

Execute the following command to destroy the resources so you avoid unnecessary charges:

terraform destroy



Version 0.1 of the Couchbase Capella provider supports the management of the following Couchbase Capella resources: 

    • Projects
    • Hosted Clusters
    • InVPC Clusters 
    • Database Users for In-VPC Clusters
    • Buckets for In-VPC Clusters


couchbasecapella_project allows Projects to be created, edited and deleted in Couchbase Capella.

Hosted Clusters

couchbasecapella_hosted_cluster allows you to create, edit and delete Hosted Clusters in Couchbase Capella. 

In-VPC Clusters


couchbasecapella_bucket allows Buckets to be created and deleted for a Couchbase Capella In-VPC Cluster. 

Creating a single bucket

Creating multiple buckets

Database Users

couchbasecapella_database_user allows Database Users to be created, edited and deleted for a Couchbase Capella In-VPC Cluster. 

All Bucket Access

With Specific Bucket Access

Specific Bucket Access with Multiple Buckets

Creating Multiple Database Users

Getting Started

For more details about the Couchbase Capella Verified Provider on the Registry, click here.

To start your 30 day free trial of Couchbase Capella, click here.


Posted by James Wilkinson, Software Engineer

Leave a reply