/terraform-provider-elephantsql

Terraform provider for ElephantSQL

Primary LanguageGoMozilla Public License 2.0MPL-2.0

Terraform provider for ElephantSQL

Setup your ElephantSQL cluster with Terraform

Install

git clone https://github.com/ElephantSQL/terraform-provider-elephantsql.git
cd terraform-provider-elephantsql
make local-install

Now the provider is installed in the terraform plugins folder and ready to be used.

Example

terraform {
  required_providers {
    elephantsql = {
      source = "localhost/elephantsql/elephantsql"
    }
  }
}

resource "elephantsql_instance" "sql_hippo" {
  name   = "terraform-provider-test"
  plan   = "hippo"
  region = "amazon-web-services::us-east-1"
}

output "psql_url" {
  sensitive = true
  value = elephantsql_instance.sql_hippo.url
}
# Create the database instance
terraform apply -auto-approve
# View the database URL
terraform output -raw psql_url

Working with HashiCorp Enterprise remote state

To work with HashiCorp Enterprise remote state you need to build linux_amd64 binary and unpack it.

make release
cd bin/release/linux/amd64
gunzip -c /terraform-provider-elephantsql_linux_amd64.tar.gz | tar xopf -

You need to move it to terraform.d/plugins/linux_64 directory (relational, inside your Terraform directory).

mv terraform-provider-elephantsql your_working_directory/terraform.d/plugins/linux_64

Your cloud should be now working properly.

Keep in mind it's dynamically changing, so please follow those instructions.