[Документация Yandex Cloud](../../index.md) > [Terraform в Yandex Cloud](../index.md) > Справочник Terraform > Ресурсы (англ.) > Managed Service for Trino > Resources > trino_cluster

# yandex_trino_cluster (Resource)

Managed Trino cluster.

## Example usage

```terraform
resource "yandex_trino_cluster" "trino" {
  name               = "trino-created-with-terraform"
  service_account_id = yandex_iam_service_account.trino.id
  subnet_ids         = [yandex_vpc_subnet.a.id, yandex_vpc_subnet.b.id, yandex_vpc_subnet.d.id]

  coordinator = {
    resource_preset_id = "c8-m32"
  }

  worker = {
    fixed_scale = {
      count = 4
    }
    resource_preset_id = "c4-m16"
  }


  retry_policy = {
    additional_properties = {
      fault-tolerant-execution-max-task-split-count = 1024
    }
    policy = "TASK"
    exchange_manager = {
      additional_properties = {
        exchange.sink-buffer-pool-min-size = 16
      }
      service_s3 = {}
    }
  }

  # resource_groups = file("resource-groups.json")
  resource_groups = jsonencode(
    {
      "rootGroups" : [
        {
          "name" : "global",
          "softMemoryLimit" : "80%",
          "hardConcurrencyLimit" : 100,
          "maxQueued" : 1000,
          "schedulingPolicy" : "weighted",
          "subGroups" : [
            {
              "name" : "adhoc",
              "softMemoryLimit" : "10%",
              "hardConcurrencyLimit" : 50,
              "maxQueued" : 1,
              "schedulingWeight" : 10,
              "subGroups" : [
                {
                  "name" : "other",
                  "softMemoryLimit" : "10%",
                  "hardConcurrencyLimit" : 2,
                  "maxQueued" : 1,
                  "schedulingWeight" : 10,
                  "schedulingPolicy" : "weighted_fair",
                  "subGroups" : [
                    {
                      "name" : "$${USER}",
                      "softMemoryLimit" : "10%",
                      "hardConcurrencyLimit" : 1,
                      "maxQueued" : 100
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "admin",
          "softMemoryLimit" : "100%",
          "hardConcurrencyLimit" : 50,
          "maxQueued" : 100,
          "schedulingPolicy" : "query_priority"
        }
      ],
      "selectors" : [
        {
          "user" : "bob",
          "userGroup" : "admin",
          "queryType" : "DATA_DEFINITION",
          "source" : "jdbc#(?<toolname>.*)",
          "clientTags" : [
            "hipri"
          ],
          "group" : "admin"
        },
        {
          "group" : "global.adhoc.other.$${USER}"
        }
      ],
      "cpuQuotaPeriod" : "1h"
    }
  )


  query_properties = {
    "query.max-memory-per-node"     = "7GB"
    "memory.heap-headroom-per-node" = "31%"
    "query.max-memory"              = "13GB"
    "query.max-total-memory"        = "21GB"
  }

  maintenance_window = {
    day  = "MON"
    hour = 15
    type = "ANYTIME"
  }
}
```

## Arguments & Attributes Reference

- `coordinator` [Block]. Configuration of `coordinator` instances.
  - `resource_preset_id` (**Required**)(String). The identifier of the preset for computational resources available to an instance (CPU, memory etc.).
- `created_at` (*Read-Only*) (String). The creation timestamp of the resource.
- `deletion_protection` (Bool). The `true` value means that resource is protected from accidental deletion.
- `description` (String). The resource description.
- `folder_id` (String). The folder identifier that resource belongs to. If it is not provided, the default provider `folder-id` is used.
- `id` (*Read-Only*) (String). The resource identifier.
- `labels` (Map Of String). A set of key/value label pairs which assigned to resource.
- `logging` [Block]. Cloud Logging configuration.
  - `enabled` (**Required**)(Bool). Enables delivery of logs generated by the Trino components to [Cloud Logging](../../logging/index.md).
  - `folder_id` (String). Logs will be written to **default log group** of specified folder. Exactly one of the attributes `folder_id` or `log_group_id` should be specified.
  - `log_group_id` (String). Logs will be written to the **specified log group**. Exactly one of the attributes `folder_id` or `log_group_id` should be specified.
  - `min_level` (String). Minimum level of messages that will be sent to Cloud Logging. Can be either `TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR` or `FATAL`. If not set then server default is applied (currently `INFO`).
- `maintenance_window` [Block]. Configuration of window for maintenance operations.
  - `day` (String). Day of week for maintenance window. One of `MON`, `TUE`, `WED`, `THU`, `FRI`, `SAT`, `SUN`.
  - `hour` (Number). Hour of day in UTC time zone (1-24) for maintenance window.
  - `type` (String). Type of maintenance window. Can be either `ANYTIME` or `WEEKLY`. If `WEEKLY`, day and hour must be specified.
- `name` (**Required**)(String). The resource name.
- `private_access` (Bool). Enables access to the cluster only via private endpoint.
- `query_properties` (Map Of String). Query properties configuration.
- `resource_groups_json` (String). Resource groups configuration as a Trino-like json. Note, that some fields are not supported in Managed Trino, refer to documentation for more details. We recommend using `jsonencode()` as it can help sidestep different issues with formatting, whitespace and other nuances inherent to JSON.
- `retry_policy` [Block]. Configuration for retry policy, specifying the spooling storage destination and other settings.
  - `additional_properties` (Map Of String). Additional properties.
  - `exchange_manager` [Block]. Configuration for exchange manager.
    - `additional_properties` (Map Of String). Additional properties.
    - `s3` [Block]. Use user Object Storage bucket as exchange manager.
      - `bucket` (**Required**)(String). Name of the Object Storage bucket used as exchange manager storage.
    - `service_s3` [Block]. Use S3 created on service side as exchange manager.
  - `policy` (**Required**)(String). Retry policy level
- `security_group_ids` (Set Of String). The list of security groups applied to resource or their components.
- `service_account_id` (**Required**)(String). [Service account](../../iam/concepts/users/service-accounts.md) which linked to the resource. For more information, see [documentation](../../managed-trino/concepts/impersonation.md).
- `subnet_ids` (**Required**)(Set Of String). The list of VPC subnets identifiers which resource is attached.
- `tls` [Block]. Configuration for TLS.
  - `trusted_certificates` (List Of String). Trusted CA-certificates. Each element should contain single self-signed CA-certificate or chain of CA-certificates where first certificate if leaf and last certificate is self-signed root.
- `version` (String). Trino version. Format: "Number".
- `worker` [Block]. Configuration of worker instances.
  - `auto_scale` [Block]. A scaling policy that dynamically adjusts the number of worker instances based on the cluster's workload.
    - `max_count` (**Required**)(Number). The maximum number of worker instances.
    - `min_count` (**Required**)(Number). The minimum number of worker instances.
  - `fixed_scale` [Block]. A fixed scaling policy that specifies a fixed number of worker instances.
    - `count` (**Required**)(Number). Specifies the number of worker instances.
  - `resource_preset_id` (**Required**)(String). The identifier of the preset for computational resources available to an instance (CPU, memory etc.).
- `timeouts` [Block]. 
  - `create` (String). A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) 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](https://pkg.go.dev/time#ParseDuration) 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](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).

## Import

The resource can be imported by using their `resource ID`. For getting it you can use Yandex Cloud [Web Console](https://console.yandex.cloud) or Yandex Cloud [CLI](../../cli/quickstart.md).

```shell
# terraform import yandex_trino_cluster.<resource Name> <resource Id>
terraform import yandex_tirno_cluster.my_trino_cluster c9qk5**********h6a91
```