Skip to content

Latest commit

 

History

History
106 lines (74 loc) · 4.09 KB

mariadb.md

File metadata and controls

106 lines (74 loc) · 4.09 KB
page_title cozystack_mariadb Resource - cozystack
subcategory
description A Cozystack managed MariaDB instance, deployed inside a tenant namespace. The deprecated inline backup block is not managed; use the BackupClass / Plan flow instead.

cozystack_mariadb (Resource)

A Cozystack managed MariaDB instance, deployed inside a tenant namespace. The deprecated inline backup block is not managed; use the BackupClass / Plan flow instead.

Example Usage

resource "cozystack_mariadb" "app" {
  name      = "app"
  namespace = "tenant-root"

  replicas = 2
  version  = "v11.8"
  size     = "20Gi"

  # Passwords are generated by the platform and kept in the
  # mariadb-app-credentials Secret.
  users = {
    app = { max_user_connections = 100 }
  }
  databases = {
    appdb = { roles = { admin = ["app"] } }
  }
}

Schema

Required

  • name (String) MariaDB instance name (metadata.name). Immutable.
  • namespace (String) Tenant namespace the application is created in. Immutable.

Optional

  • databases (Attributes Map) Databases keyed by name, each with admin/readonly user roles. (see below for nested schema)
  • external (Boolean) Enable external access from outside the cluster.
  • replicas (Number) Number of MariaDB replicas.
  • resources (Attributes) Explicit CPU and memory per replica; overrides resources_preset for any field set. (see below for nested schema)
  • resources_preset (String) Sizing preset applied when resources is omitted.
  • size (String) Persistent volume size (quantity, e.g. 10Gi).
  • storage_class (String) StorageClass used to store the data. Changing a value set here replaces the object, because an existing volume is never migrated to another class. Removing the attribute from the configuration does not: the object keeps its volumes and the recorded class reverts to the default.
  • users (Attributes Map) MariaDB users keyed by user name. The platform generates every user's password and keeps it in the mariadb-<name>-credentials Secret; it cannot be set here. (see below for nested schema)
  • version (String) MariaDB version (v11.8, v11.4, v10.11, v10.6).
  • wait_for_ready (Boolean) Block on create/update until the Ready condition is true and any server-generated outputs the resource exposes are readable.
  • wait_timeout (String) Maximum time to wait when wait_for_ready is set (Go duration, e.g. 10m). Readiness and outputs share this budget; outputs that never appear leave a warning and their attributes stay null until the next refresh.

Read-Only

  • chart_version (String) Deployed chart version (status.version).
  • id (String) Synthetic identifier in the form namespace/name.
  • ready (Boolean) Whether the application's Ready condition is true.
  • uid (String) Server-assigned object UID (metadata.uid). Stable across updates; changes on recreate.

Nested Schema for databases

Optional:

Nested Schema for databases.roles

Optional:

  • admin (List of String) Users with admin privileges.
  • readonly (List of String) Users with read-only privileges.

Nested Schema for resources

Optional:

  • cpu (String) CPU available to each replica (quantity, e.g. 500m).
  • memory (String) Memory available to each replica (quantity, e.g. 512Mi).

Nested Schema for users

Optional:

  • max_user_connections (Number) Maximum number of connections for the user.

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

# MariaDB instances are imported as "<namespace>/<name>".
terraform import cozystack_mariadb.app tenant-root/app