streamtime_clickhouse (Resource)

A ClickHouse analytics database on a fleet. Creating one deploys it and waits until it is ready; a change is deployed and waited for too. If a change fails to deploy, the next plan shows it as an update and that apply deploys it again.

Example Usage

# A ClickHouse database on an existing fleet. Apply waits until it is ready,
# and until a change is running.
resource "streamtime_clickhouse" "events" {
  identifier     = "events"
  fleet          = streamtime_fleet.byok.identifier
  retention_days = 14

  tags = {
    team = "analytics"
  }

  # Shards, replicas, resources and ClickHouse settings.
  advanced_configuration = jsonencode({
    shards   = 1
    replicas = 2
  })

  timeouts = {
    create = "30m"
    update = "30m"
    delete = "30m"
  }
}

output "clickhouse_http_url" {
  value = streamtime_clickhouse.events.http_url
}

Schema

Required

  • fleet (String) Identifier of the fleet to deploy on. Changing it creates a new database.
  • identifier (String) Unique name of the database: up to 24 lowercase letters, digits and dashes. Changing it creates a new database.

Optional

  • advanced_configuration (String, Sensitive) Advanced settings, as a JSON object set with jsonencode(): shards, replicas, resources, image, users, profiles and settings. Users may include credentials. Settings Streamtime fills in are not shown as changes.
  • cloud_provider (String) Cloud the database runs in, for your records.
  • description (String) Free-text description.
  • region (String) Region the database runs in, for your records.
  • retention_days (Number) Days ingested data is kept before it ages out. Streamtime uses 30 when it is left out.
  • tags (Map of String) Tags on the database, as key = value. Removing the attribute keeps the current tags; set tags = {} to clear them.
  • tenancy_mode (String) Shared, Isolated or Dedicated, for your records.
  • timeouts (Attributes) (see below for nested schema)

Read-Only

  • configuration_state (String) Whether the database’s settings are complete: incomplete, valid or invalid.
  • credentials_secret_uri (String) Path of the Streamtime secret that holds the default user’s credentials. It is never the password itself.
  • dns_record (String) Address of the database’s own gateway, once it is ready.
  • generation (Number) Version of the database’s settings; it goes up when they change.
  • http_url (String) HTTP address of the database, once it is ready.
  • id (String) Same as identifier. Use the identifier to import.
  • observed_generation (Number) Version of the settings the running database has.
  • reconciliation_state (String) Progress of the last change: pending, queued, running, succeeded or failed.
  • status (String) Health of the database, for example Provisioning, Healthy or Error.

Nested Schema for timeouts

Optional:

  • create (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as “30s” or “2h45m”. Valid time units are “s” (seconds), “m” (minutes), “h” (hours).
  • delete (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as “30s” or “2h45m”. Valid time units are “s” (seconds), “m” (minutes), “h” (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
  • update (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as “30s” or “2h45m”. Valid time units are “s” (seconds), “m” (minutes), “h” (hours).

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

# Import by identifier.
terraform import streamtime_clickhouse.events events