Terraform Provider

Crunchy Bridge has released a verified Terraform provider. The Terraform provider allows including Crunchy Bridge managed PostgreSQL clusters as part of an Infrastructure as Code (IaC) devops strategy, including configuring other Terraform resources to connect to these clusters.

The Crunchy Bridge Terraform provider is intended for use with both open-source Terraform and Terraform Cloud.

Get started with our Terraform provider

Sample Provisioning

Add this code to you main.tf Terraform configuration file:

terraform {
  required_providers {
    crunchybridge = {
      source  = "CrunchyData/crunchybridge"
      version = "0.1.0"
    }
  }
}

provider "crunchybridge" {
  // Set these to your API key
  application_id     = "pato7ykzflmwsex54pbvym"
  application_secret = "ZZbjH3LZWhP1be2Nt5KX-I3g79aGeK8JNQFHn8"
}

data "crunchybridge_account" "user" {}

resource "crunchybridge_cluster" "demo" {
  team_id = data.crunchybridge_account.user.default_team
  name    = "famously-fragile-impala-47"
  provider_id = "aws"
  region_id = "us-east-1"	
  plan_id = "standard-8"
  is_ha = "false"
  storage = "100"
  major_version = "14"
}

data "crunchybridge_clusterstatus" "status" {
  id = crunchybridge_cluster.demo.id
}

output "demo_status" {
  value = data.crunchybridge_clusterstatus.status
}

The provider section above calls out the Crunchy Bridge provider. The resource specification will allow you to input specifications for the database provision you want to create, like the cloud provider, region, plan, storage, and Postgres version. The data specifications define data which will be queried to identify the user’s default_team and to query the cluster status for the output.

Sample Deprovisioning

You’ll just keep your terraform and provider code in there, but remove the data and resource definitions. In the declarative model, by removing definitions we’re declaring that we want any previously created definitions deprovisioned.

Update main.tf:

terraform {
  required_providers {
    crunchybridge = {
      source  = "CrunchyData/crunchybridge"
      version = "0.1.0"
    }
  }
}

provider "crunchybridge" {
    application_id     = "pato7ykzflmwsex54pbvym"
    application_secret = "ZZbjH3LZWhP1be2Nt5KX-I3g79aGeK8JNQFHn8"
}

For additional examples, usage guides, and detailed technical documentation, refer to the provider documentation. Visit the GitHub repository to collaborate with us on issues or enhancement requests.