Setup your ElephantSQL cluster with Terraform. Create your account at https://customer.elephantsql.com/ to get an API key.
Example
terraform {
required_providers {
elephantsql = {
source = "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
}
export ELEPHANTSQL_APIKEY=<your-key>
terraform init
# Create the database instance
terraform apply -auto-approve
# View the database URL
terraform output -raw psql_url
Use from source
git clone https://github.com/ElephantSQL/terraform-provider-elephantsql.git
cd terraform-provider-elephantsql
make local-install
You can use dev_overrides
to make Terraform use your local build:
# save as $HOME/elephantsql-provider-dev.tfrc
provider_installation {
dev_overrides {
"elephantsql/elephantsql" = "/home/foo/terraform-provider-elephantsql"
}
}
TERRAFORM_CONFIG=$HOME/elephantsql-provider-dev.tfrc terraform apply -auto-approve