Skip to content

sparkfabrik/terraform-typesense-keys

Repository files navigation

Typesense Keys Module

This module creates Typesense API keys and optionally a Kubernetes secret.

What it creates

  • Read-only API key: For document search operations.
  • Full access API key: For all Typesense operations.
  • Kubernetes secret: Contains host URL, API keys, and collection prefix (optional).

Diagram

flowchart LR
  typesense_module["Typesense Keys Module"] -- "generates" --> api_keys["API Keys (RO + Full Access)"]
  api_keys -- "stored in" --> k8s_secret["Kubernetes Secret"]
  terraform_config["Terraform Config"] -- "configures" --> typesense_provider["Typesense Provider"]
  typesense_provider -- "manages" --> typesense_module
  projects["Projects"] -- "consumes" --> k8s_secret
Loading

Usage

Basic usage with collection prefix

module "typesense_keys" {
  source = "github.com/sparkfabrik/terraform-typesense-keys?ref=X.Y.Z"
  
  collection_prefix        = "myproject"
  secret_namespace         = "myproject-stage"
  secret_name              = "myproject-typesense"
  typesense_external_host  = "typesense.example.com"
  typesense_external_port  = 443
  typesense_external_proto = "https"
  typesense_internal_host  = "typesense.default.svc.cluster.local"
  typesense_internal_port  = 8108
  typesense_internal_proto = "http"
}

Without collection prefix (all collections)

If you omit the collection_prefix, the API keys will have access to all collections (*):

module "typesense_keys" {
  source = "github.com/sparkfabrik/terraform-typesense-keys?ref=X.Y.Z"
  
  secret_namespace         = "myproject-stage"
  secret_name              = "myproject-typesense"
  typesense_external_host  = "typesense.example.com"
  typesense_internal_host  = "typesense.default.svc.cluster.local"
}

Without Kubernetes secret

If you only need the API keys without creating a Kubernetes secret, omit the secret_name:

module "typesense_keys" {
  source = "github.com/sparkfabrik/terraform-typesense-keys?ref=X.Y.Z"
  
  collection_prefix        = "myproject"
  typesense_external_host  = "typesense.example.com"
  typesense_internal_host  = "typesense.default.svc.cluster.local"
}

Providers

Name Version
kubernetes >= 2.21
random >= 3.4.3
typesense 0.0.5

Requirements

Name Version
terraform >= 1.2
kubernetes >= 2.21
random >= 3.4.3
typesense 0.0.5

Inputs

Name Description Type Default Required
collection_prefix The collection prefix for Typesense keys string "" no
secret_name The name of the Kubernetes secret string "" no
secret_namespace The Kubernetes namespace where the secret will be created string "" no
typesense_external_host The Typesense host URL string n/a yes
typesense_external_port The Typesense port number 443 no
typesense_external_proto The Typesense protocol string "https" no
typesense_internal_host The Typesense host URL string n/a yes
typesense_internal_port The Typesense port number 8108 no
typesense_internal_proto The Typesense protocol string "http" no

Outputs

Name Description
secret_name The name of the created Kubernetes secret
secret_namespace The namespace of the created Kubernetes secret

Resources

Name Type
kubernetes_secret_v1.typesense_credentials resource
random_password.full_access_key resource
random_password.readonly_key resource
typesense_key.full_access resource
typesense_key.readonly resource

Modules

No modules.

About

Terraform module to manage Typesense keys

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •