terraform-provider-onyx/docs/resources/cc_pair.md
A connector-credential pair: the object that actually indexes. It joins an onyx_connector to an onyx_credential and carries the access control for the documents they produce.
Creating a pair starts indexing. Destroying one removes the indexed documents too, which runs in the background — Terraform waits for it to finish.
~> Drift blind spot. Onyx does not report groups, auto_sync_options or processing_mode back on read, so Terraform cannot detect changes made to them elsewhere. They are recorded from the configuration at create time. After terraform import they are empty, and setting them then replaces the pair.
# A connector-credential pair is the object that actually indexes. It joins a
# connector to the credential it authenticates with, and carries the access
# control for the documents they produce.
resource "onyx_cc_pair" "confluence_wiki" {
name = "confluence-wiki"
connector_id = onyx_connector.confluence.id
credential_id = onyx_credential.confluence.id
# Everyone can read the indexed documents. Use "private" with groups to
# restrict them, or "sync" to mirror permissions from the source system.
access_type = "public"
}
# A pair whose documents only two groups may read.
resource "onyx_cc_pair" "hr_handbook" {
name = "hr-handbook"
connector_id = onyx_connector.hr_drive.id
credential_id = onyx_credential.hr_drive.id
# This side owns the link, so a group never fights the pair over it.
access_type = "private"
groups = [onyx_user_group.hr.id, onyx_user_group.legal.id]
# Pause a pair to stop new index runs. It keeps the documents it has.
paused = false
}
# Destroying a pair also removes the documents it indexed, which Onyx does in
# the background. Raise the timeout for a connector holding many documents.
resource "onyx_cc_pair" "large_archive" {
name = "large-archive"
connector_id = onyx_connector.archive.id
credential_id = onyx_credential.archive.id
timeouts {
delete = "2h"
}
}
connector_id (String) Id of the connector to pair, e.g. onyx_connector.docs.id.credential_id (String) Id of the credential to pair, e.g. onyx_credential.docs.id.name (String) Pair name, shown in the admin panel. Onyx does not require it to be unique, but a connector and credential can only be paired once.access_type (String) Who may read the indexed documents: public (everyone), private (the groups below), or sync (mirrored from the source system). sync needs a Business tier license and a source that supports permission sync.auto_sync_options (String) Permission-sync settings as a JSON object. Only meaningful with access_type = "sync".groups (Set of Number) User group ids that may read the documents. Applies when access_type = "private".paused (Boolean) Pause indexing. A paused pair keeps its documents but runs no new index attempts.processing_mode (String) How fetched documents are processed. Defaults to REGULAR, the full index pipeline. RAW_BINARY stores the file without extracting text. FILE_SYSTEM is deprecated and produces documents that cannot be searched.timeouts (Block, Optional) (see below for nested schema)id (String) Numeric connector-credential pair id.last_index_attempt_status (String) Status of the most recent index attempt, or null before the first one runs.num_docs_indexed (Number) Documents currently indexed by this pair.status (String) Server status: SCHEDULED, INITIAL_INDEXING, ACTIVE, PAUSED, DELETING or INVALID. Onyx cycles it as indexing progresses; use paused to change it.<a id="nestedblock--timeouts"></a>
timeoutsOptional:
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.Import is supported using the following syntax:
The terraform import command can be used, for example:
#!/bin/sh
# Import by numeric connector-credential pair id.
#
# Onyx does not report groups, auto_sync_options or processing_mode, so they
# are empty after an import. Setting them afterwards replaces the pair.
terraform import onyx_cc_pair.confluence_wiki 12