Skip to main content
Type: rvn-planetscale-vitess · Latest version: 0.1.0

Readme

Managed PlanetScale MySQL with application credentials, safe migrations, and in-place cluster resizing.

Overview

Creates one Vitess database with a main branch, manages its default keyspace, and generates a read/write application credential. Each module instance owns its database. The initial size is PS-10; safe migrations and deletion protection are enabled. PlanetScale’s built-in backups remain in effect.

Use cases

Provisioning

Uses the standard Ravion Terraform change and destroy pipelines. No separate PlanetScale pipeline or pipeline ID is required. The first deployment creates the branch at the selected size, its default keyspace, and application credentials. From the second deployment, the module automatically imports that existing keyspace into Terraform state and manages its size and extra replicas. An import can resize it in the same apply; it does not copy data or create another keyspace. Extra replicas are first applied on the second deployment, even if configured initially.

Configuration

Metrics

Declares 63 native branch/tablet chart candidates using the saved integration. Metrics work from the first successful deployment; no keyspace adoption, CloudWatch account, exporter, or separate metrics database setting is required. Shard, tablet, and availability-zone series remain separate. Missing or engine-specific metrics are shown as unavailable rather than zero. Metrics currently preserve raw native values. Unit/rate semantics and live availability are not fully verified; metric support depends on the engine, topology, and activity of the branch.

Application connections

Connect with the host, port, database_name, username and sensitive password outputs. A sensitive connection_string is also available. Configure TLS certificate and hostname verification in your MySQL driver; clients use different TLS options. Passwords are stored in Terraform state. The application credential has read/write data access. Schema migration credentials and PlanetScale deploy-request workflows are separate concerns.

Advanced configuration

Uses the same Terraform settings as other Ravion modules: OpenTofu version override, Ravion Terraform workspace name, and Advanced Terraform variables. Change and destroy pipelines inherit the environment’s normal pipeline defaults; configure those defaults at organization, project, or environment scope, not as PlanetScale-specific module inputs. Advanced Terraform variables override the generated variables. Advanced Terraform variables can configure additional keyspaces and passwords, VTGate sizing/autoscaling, and custom backup policies. These options can add charges. Custom backups are optional; built-in backups remain available without them. Cluster sizes are listed for the selected organization and region, including Metal SKUs with their NVMe disk capacity. Additional branches, VSchema and deploy requests are outside this release’s scope.

Design decisions

Database identity and region are fixed after creation. Compute sizing remains editable. The first deployment uses PlanetScale’s automatically-created default keyspace. Later deployments adopt it automatically, using the previous deployment’s branch ID; they never create a second default keyspace. On destroy, Terraform deletes an already-imported default keyspace before deleting the branch. Disable branch deletion protection and apply first. This deletion order needs verification with a disposable PlanetScale database before production use. No AWS resources are needed for the PlanetScale database itself; AWS is used by the Terraform runner and short-lived secret delivery. Plan, apply, and destroy each use their own temporary token from the selected integration; no bootstrap credential reaches the runner.

Learn more

Inputs reference

All inputs for rvn-planetscale-vitess version 0.1.0. Use the name shown for each field as the input key in module config.

PlanetScale integration

string
required
PlanetScale integration. Select an active integration from Settings → Integrations. The organization and short-lived credentials come from this connection.
  • Immutable after creation

Database

string
required
Database name.
  • Default: << project.given_id >>-<< environment.given_id >>-<< module.given_id >>
  • Immutable after creation
  • Pattern: ^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$ — 1-64 lowercase letters, numbers, and hyphens. Start and end with a letter or number.
string
required
Database region. Choose a MySQL region available to the selected PlanetScale organization near your application.
  • Immutable after creation
string
required
Cluster size. Choose a regional MySQL size. Metal options include local NVMe disk capacity in the SKU. Compute is per instance; the cluster includes a primary and two replicas. Changes resize in place.
  • Default: PS_10
number
Extra replicas. Additional replicas beyond PlanetScale’s included replicas; increases cost. Applied from the second deployment, after automatic default-keyspace adoption.
  • Default: 0
  • Min: 0
string_array
Application credential CIDRs. Restrict application connections to these IPv4 or IPv6 CIDR ranges. Empty permits connections from any source IP.
  • Default: []
boolean
Deletion protection. Disable and apply before destroying the database. The default keyspace is deleted before the branch.
  • Default: true
boolean
Safe migrations. Require PlanetScale deploy requests for schema changes. Disable only when direct DDL on main is intended.
  • Default: true

Terraform settings

string
OpenTofu version override. Override the environment’s default version for this module
string
Ravion Terraform workspace name. Override Terraform state backend workspace name. Defaults to project + environment + module given ids.
  • Immutable after creation
boolean
Include default plan policies. Turn off to plan with only the policies below instead of the default read-only policies. Requires at least one policy below.
  • Default: true
string_array
Terraform plan IAM policies. IAM managed policy ARNs for the Terraform plan runner role. Without default policies, allow s3:CreateBucket, s3:PutObject, s3:GetObject, and s3:ListBucket on the ravion-terraform-plans-<AWS account number> bucket in this account.
  • Default: []
boolean
Include default apply policies. Turn off to apply and destroy with only the policies below instead of AdministratorAccess. Requires at least one policy below.
  • Default: true
string_array
Terraform apply IAM policies. IAM managed policy ARNs for the Terraform apply runner role. Without default policies, allow s3:CreateBucket, s3:PutObject, s3:GetObject, and s3:ListBucket on the ravion-terraform-plans-<AWS account number> bucket in this account.
  • Default: []
object
Advanced Terraform variables. Optional raw Terraform variable overrides for advanced module inputs or one-off overrides. Values here override the generated variables above.
  • Default: {}
string
required
Terraform execution environment. Runs OpenTofu with short-lived credentials from the selected integration. This does not select the database’s cloud account or region.
  • Default: << defaults.execution_environment_id >>