A Terraform provider for CouchDB.
- Support for the CouchDB API v3
- Lazy initialization of the CouchDB connection
- Retry logic for provisioning a database
Clone repository to: $GOPATH/src/github.com/rossmerr/terraform-provider-couchdb
$ mkdir -p $GOPATH/src/github.com/rossmerr; cd $GOPATH/src/github.com/rossmerr
$ git clone git@github.com/rossmerr/terraform-provider-couchdb
Enter the provider directory and build the provider
$ cd $GOPATH/src/github.com/rossmerr/terraform-provider-couchdb
$ go install
If you're building the provider, follow the instructions to install it as a plugin.
After placing it into your plugins directory, run terraform init
to initialize it.
Or run the make install
and you can reference the provider locally using
terraform {
required_providers {
couchdb = {
source = "github.com/rossmerr/couchdb"
}
}
}
provider "couchdb" {
endpoint = "localhost:5984"
name = "jenny"
password = "secret"
}
resource "couchdb_database" "db1" {
name = "example"
}
resource "couchdb_database_replication" "db2db" {
name = "example"
source = couchdb_database.db1.name
target = "example-clone"
create_target = true
continuous = true
}
resource "couchdb_database_design_document" "test" {
database = couchdb_database.db1.name
name = "types"
views = <<EOF
{
"people" : {
"map" : "function(doc) { if (doc.type == 'person') { emit(doc); } }",
"reduce": ""
}
}
EOF
}