upstash / terraform-provider-upstash

MIT License
22 stars 4 forks source link

Upstash Terraform Provider

This is the repository of official Upstash Terraform provider.

Installation


terraform {
  required_providers {
    upstash = {
      source = "upstash/upstash"
      version = "x.x.x"
    }
  }
}

provider "upstash" {
  email    = var.email
  api_key  = var.api_key
}

email is your registered email in Upstash.

api_key can be generated from Upstash Console. For more information please check our docs.

Create Database Using Terraform

Here example code snippet that creates database:

resource "upstash_redis_database" "redis" {
  database_name = "db-name"
  region        = "eu-west-1"
  tls           = "true"
  multi_zone    = "false"
}

Import Resources From Outside of Terraform

To import resources created outside of the terraform provider, simply create the resource in .tf file as follows:

resource "upstash_redis_database" "redis" {}

after this, you can run the command:

terraform import upstash_redis_database.redis <db-id>

Above example is given for an Upstash Redis database. You can import all of the resources by changing the resource type and providing the resource id.

You can check full spec and doc from here.

Support, Bugs Reports, Feature Requests

If you need support then you can ask your questions Upstash Team in upstash.com chat widget.

There is also discord channel available for community. Please check here for more information.

Requirements

Development

If you want to locally build/test the provider then follow these steps:

Updating the Docs

This provider uses tfplugindocs to generate its documentation. Run the command below, and the docs will be automatically generated from the provider code and examples

tfplugindocs

Testing

source envSetters.txt
go test -v

If you want to run a specific test, you can use the -run flag. To run the test, first navigate to integrationtesting folder, and then run the following command. You can replace TestUpstashVectorIndexMAIN with the name of the test you want to run.

go test -v . -run TestUpstashVectorIndexMAIN