oci_distributed_database_distributed_databases_insert_dg

Executes INSERTDG operations against an existing distributed database. Configure one to three insert_dg blocks; all blocks are submitted together in one PATCH request. The provider generates the API operation fields automatically.

Example Usage

resource "oci_distributed_database_distributed_databases_insert_dg" "insert_dg" {
  distributed_database_id = oci_distributed_database_distributed_database.example.id

  insert_dg {
    selection    = "catalogDetails[?originalReplica.database.name == 'catalog-database-a'].originalReplica.database"
    replica_name = "standby"
    database {
      source                   = "XS_EXISTING_CLUSTER"
      vm_cluster_id            = var.standby_vm_cluster_id
      admin_password_secret_id = var.standby_password_secret_id
    }
  }
}

The example references an existing main database resource and input variables. Replace the topology and database names with names from your database.

Argument Reference

Each block generates operation: MERGE with a JSON-encoded value containing subOperation: INSERTDG and dataGuardReplicas: [{name: replica_name, database: ...}]. The provider maps Terraform field names to API field names.

For XS_NEW_CLUSTER, supply availability_domain, exascale_db_storage_vault_id, and vm_cluster_details. For XS_NEW_VAULT_AND_CLUSTER, supply availability_domain, db_storage_vault_details, and vm_cluster_details. Supply exactly one admin password or password secret for every source. Sensitive inputs remain in Terraform state; protect access to the state backend.

Action Lifecycle

Creation executes the configured operations. An update executes them when the operation list changes, without an incremental trigger. Refresh reads the database state and does not execute operations. Unchanged action instances are not replayed when additional instances are added. Recreating an action instance, including after its state is removed, executes its configured operations again.

Resource labels are user-defined. For example, name two instances insert_dg and insert_dg_2; each submits its own operations. Keep successful instances unchanged and add another instance for additional operations. Changing an existing instance submits its full operation list again. Use depends_on to order instances targeting the same database when they must run sequentially.

Removing an operation block does not execute its inverse, but changing a nonempty list submits the remaining blocks again. At least one block is required. Removing the entire action resource only clears its Terraform state; it does not remove topology members or delete the target database. To remove members explicitly, use the corresponding REMOVE or REMOVEDG resource. Action changes do not replace or destroy the main database resource.

The provider polls the asynchronous work request and then refreshes the target until its top-level lifecycle state is ACTIVE or INACTIVE. Work requests ending in FAILED, CANCELED, or NEEDS_ATTENTION fail the action. Missing work-request IDs and API failures also produce diagnostics. Diagnostics identify the operation, database OCID, and available work-request OCID and service error details.

After adding shards, run distributed_databases configure sharding after the INSERT resource completes successfully so the new shards participate in the sharding topology. Configure an explicit dependency on the action resource. Each additional INSERT resource needs a new configure-sharding action instance, or an explicit invocation through the main resource’s existing configure-sharding trigger.

Attributes Reference

Timeouts

The timeouts block accepts create, read, update, and delete, each defaulting to 12 hours. Destroy only clears action state.

Import

Import is not supported for this resource.

Related Resources