exoscale_database (Resource)

Manage Exoscale Database Services (DBaaS).

Example Usage

resource "exoscale_database" "my_database" {
  zone = "ch-gva-2"
  name = "my-database"

  type = "pg"
  plan = "startup-4"

  maintenance_dow  = "sunday"
  maintenance_time = "23:00:00"

  termination_protection = true

  pg {
    version = "13"

    backup_schedule = "04:00"

    ip_filter = [
      "1.2.3.4/32",
      "5.6.7.8/32",
    ]

    pg_settings = jsonencode({
      timezone : "Europe/Zurich"
    })
  }
}

Please refer to the examples directory for complete configuration examples.

Schema

Required

  • name (String) ❗ The name of the database service.
  • plan (String) The plan of the database service (use the Exoscale CLI - exo dbaas type show <TYPE> --plans - for reference).
  • type (String) ❗ The type of the database service (kafka, mysql, opensearch, pg, redis, grafana).
  • zone (String) ❗ The Exoscale Zone name.

Optional

  • grafana (Block, Optional) grafana database service type specific arguments. Structure is documented below. (see below for nested schema)
  • kafka (Block, Optional) kafka database service type specific arguments. Structure is documented below. (see below for nested schema)
  • maintenance_dow (String) The day of week to perform the automated database service maintenance (never, monday, tuesday, wednesday, thursday, friday, saturday, sunday).
  • maintenance_time (String) The time of day to perform the automated database service maintenance (HH:MM:SS)
  • mysql (Block, Optional) mysql database service type specific arguments. Structure is documented below. (see below for nested schema)
  • opensearch (Block, Optional) opensearch database service type specific arguments. Structure is documented below. (see below for nested schema)
  • pg (Block, Optional) pg database service type specific arguments. Structure is documented below. (see below for nested schema)
  • redis (Block, Optional) redis database service type specific arguments. Structure is documented below. (see below for nested schema)
  • termination_protection (Boolean) The database service protection boolean flag against termination/power-off.
  • timeouts (Block, Optional) (see below for nested schema)

Read-Only

  • ca_certificate (String) CA Certificate required to reach a DBaaS service through a TLS-protected connection.
  • created_at (String) The creation date of the database service.
  • disk_size (Number) The disk size of the database service.
  • id (String) The ID of this resource.
  • node_cpus (Number) The number of CPUs of the database service.
  • node_memory (Number) The amount of memory of the database service.
  • nodes (Number) The number of nodes of the database service.
  • state (String) The current state of the database service.
  • updated_at (String) The date of the latest database service update.

Nested Schema for grafana

Optional:

  • grafana_settings (String) Grafana configuration settings in JSON format (exo dbaas type show grafana --settings=grafana for reference).
  • ip_filter (Set of String) A list of CIDR blocks to allow incoming connections from.

Nested Schema for kafka

Optional:

  • enable_cert_auth (Boolean) Enable certificate-based authentication method.
  • enable_kafka_connect (Boolean) Enable Kafka Connect.
  • enable_kafka_rest (Boolean) Enable Kafka REST.
  • enable_sasl_auth (Boolean) Enable SASL-based authentication method.
  • enable_schema_registry (Boolean) Enable Schema Registry.
  • ip_filter (Set of String) A list of CIDR blocks to allow incoming connections from.
  • kafka_connect_settings (String) Kafka Connect configuration settings in JSON format (exo dbaas type show kafka --settings=kafka-connect for reference).
  • kafka_rest_settings (String) Kafka REST configuration settings in JSON format (exo dbaas type show kafka --settings=kafka-rest for reference).
  • kafka_settings (String) Kafka configuration settings in JSON format (exo dbaas type show kafka --settings=kafka for reference).
  • schema_registry_settings (String) Schema Registry configuration settings in JSON format (exo dbaas type show kafka --settings=schema-registry for reference)
  • version (String) Kafka major version (exo dbaas type show kafka for reference; may only be set at creation time).

Nested Schema for mysql

Optional:

  • admin_password (String, Sensitive) A custom administrator account password (may only be set at creation time).
  • admin_username (String) A custom administrator account username (may only be set at creation time).
  • backup_schedule (String) The automated backup schedule (HH:MM).
  • ip_filter (Set of String) A list of CIDR blocks to allow incoming connections from.
  • mysql_settings (String) MySQL configuration settings in JSON format (exo dbaas type show mysql --settings=mysql for reference).
  • version (String) MySQL major version (exo dbaas type show mysql for reference; may only be set at creation time).

Nested Schema for opensearch

Optional:

  • dashboards (Block, Optional) OpenSearch Dashboards settings (see below for nested schema)
  • fork_from_service (String) ❗ Service name
  • index_pattern (Block List) (can be used multiple times) Allows you to create glob style patterns and set a max number of indexes matching this pattern you want to keep. Creating indexes exceeding this value will cause the oldest one to get deleted. You could for example create a pattern looking like ’logs.?’ and then create index logs.1, logs.2 etc, it will delete logs.1 once you create logs.6. Do note ’logs.?’ does not apply to logs.10. Note: Setting max_index_count to 0 will do nothing and the pattern gets ignored. (see below for nested schema)
  • index_template (Block, Optional) Template settings for all new indexes (see below for nested schema)
  • ip_filter (Set of String) Allow incoming connections from this list of CIDR address block, e.g. `[“10.20.0.0/16”]
  • keep_index_refresh_interval (Boolean) Aiven automation resets index.refresh_interval to default value for every index to be sure that indices are always visible to search. If it doesn’t fit your case, you can disable this by setting up this flag to true.
  • max_index_count (Number) Maximum number of indexes to keep (Minimum value is 0)
  • recovery_backup_name (String) ❗ Name of a backup to recover from
  • settings (String) OpenSearch-specific settings, in json. e.g.jsonencode({thread_pool_search_size: 64}). Use exo x get-dbaas-settings-opensearch to get a list of available settings.
  • version (String) ❗ OpenSearch major version (exo dbaas type show opensearch for reference)

Nested Schema for opensearch.dashboards

Optional:

  • enabled (Boolean) Enable or disable OpenSearch Dashboards (default: true).
  • max_old_space_size (Number) Limits the maximum amount of memory (in MiB) the OpenSearch Dashboards process can use. This sets the max_old_space_size option of the nodejs running the OpenSearch Dashboards. Note: the memory reserved by OpenSearch Dashboards is not available for OpenSearch. (default: 128).
  • request_timeout (Number) Timeout in milliseconds for requests made by OpenSearch Dashboards towards OpenSearch (default: 30000)

Nested Schema for opensearch.index_pattern

Optional:

  • max_index_count (Number) Maximum number of indexes to keep before deleting the oldest one (Minimum value is 0)
  • pattern (String) fnmatch pattern
  • sorting_algorithm (String) alphabetical or creation_date.

Nested Schema for opensearch.index_template

Optional:

  • mapping_nested_objects_limit (Number) The maximum number of nested JSON objects that a single document can contain across all nested types. This limit helps to prevent out of memory errors when a document contains too many nested objects. (Default is 10000. Minimum value is 0, maximum value is 100000.)
  • number_of_replicas (Number) The number of replicas each primary shard has. (Minimum value is 0, maximum value is 29)
  • number_of_shards (Number) The number of primary shards that an index should have. (Minimum value is 1, maximum value is 1024.)

Nested Schema for pg

Optional:

  • admin_password (String, Sensitive) A custom administrator account password (may only be set at creation time).
  • admin_username (String) A custom administrator account username (may only be set at creation time).
  • backup_schedule (String) The automated backup schedule (HH:MM).
  • ip_filter (Set of String) A list of CIDR blocks to allow incoming connections from.
  • pg_settings (String) PostgreSQL configuration settings in JSON format (exo dbaas type show pg --settings=pg for reference).
  • pgbouncer_settings (String) PgBouncer configuration settings in JSON format (exo dbaas type show pg --settings=pgbouncer for reference).
  • pglookout_settings (String) pglookout configuration settings in JSON format (exo dbaas type show pg --settings=pglookout for reference).
  • version (String) PostgreSQL major version (exo dbaas type show pg for reference; may only be set at creation time).

Nested Schema for redis

Optional:

  • ip_filter (Set of String) A list of CIDR blocks to allow incoming connections from.
  • redis_settings (String) Redis configuration settings in JSON format (exo dbaas type show redis --settings=redis for reference).

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.
  • read (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). Read operations occur during any refresh or planning operation when refresh is enabled.
  • 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).

-> The symbol ❗ in an attribute indicates that modifying it, will force the creation of a new resource.

Import

# An existing database service may be imported by `<name>@<zone>`:

terraform import \
  exoscale_database.my_database \
  my-database@ch-gva-2