@pulumi/digitalocean
Version:
A Pulumi package for creating and managing DigitalOcean cloud resources.
247 lines (246 loc) • 9.64 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
/**
* Provides a DigitalOcean database logsink resource allowing you to forward logs from a managed database cluster to an external OpenSearch cluster or Elasticsearch endpoint.
*
* This resource is compatible with both OpenSearch and Elasticsearch endpoints due to API compatibility. You can use this resource to connect to either service.
*
* This resource supports the following DigitalOcean managed database engines:
*
* * PostgreSQL
* * MySQL
* * Kafka
* * Valkey
*
* **Note**: MongoDB databases use a different log forwarding mechanism and require Datadog logsinks (not currently available in this provider).
*
* ## Example Usage
*
* ### Basic OpenSearch configuration
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const postgres_example = new digitalocean.DatabaseCluster("postgres-example", {
* name: "example-postgres-cluster",
* engine: "pg",
* version: "15",
* size: digitalocean.DatabaseSlug.DB_1VPCU1GB,
* region: digitalocean.Region.NYC1,
* nodeCount: 1,
* });
* const example = new digitalocean.DatabaseLogsinkOpensearch("example", {
* clusterId: postgres_example.id,
* name: "opensearch-logs",
* endpoint: "https://opensearch.example.com:9200",
* indexPrefix: "db-logs",
* indexDaysMax: 7,
* });
* ```
*
* ### OpenSearch with authentication and CA certificate
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
* import * as std from "@pulumi/std";
*
* const example_secure = new digitalocean.DatabaseLogsinkOpensearch("example-secure", {
* clusterId: postgres_example.id,
* name: "opensearch-secure",
* endpoint: "https://user:password@opensearch.example.com:9200",
* indexPrefix: "secure-logs",
* indexDaysMax: 14,
* caCert: std.file({
* input: "/path/to/ca.pem",
* }).then(invoke => invoke.result),
* timeoutSeconds: 30,
* });
* ```
*
* ### Elasticsearch endpoint configuration
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const elasticsearch = new digitalocean.DatabaseLogsinkOpensearch("elasticsearch", {
* clusterId: postgres_example.id,
* name: "elasticsearch-logs",
* endpoint: "https://elasticsearch.example.com:9243",
* indexPrefix: "es-logs",
* indexDaysMax: 30,
* });
* ```
*
* ### MySQL to OpenSearch configuration
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const mysql_example = new digitalocean.DatabaseCluster("mysql-example", {
* name: "example-mysql-cluster",
* engine: "mysql",
* version: "8",
* size: digitalocean.DatabaseSlug.DB_1VPCU1GB,
* region: digitalocean.Region.NYC1,
* nodeCount: 1,
* });
* const mysql = new digitalocean.DatabaseLogsinkOpensearch("mysql", {
* clusterId: mysql_example.id,
* name: "mysql-logs",
* endpoint: "https://opensearch.example.com:9200",
* indexPrefix: "mysql-logs",
* indexDaysMax: 7,
* });
* ```
*
* ## Important Notes
*
* ### Elasticsearch Compatibility
* This resource works with both OpenSearch and Elasticsearch endpoints due to their API compatibility. Use the same resource type regardless of whether you're connecting to OpenSearch or Elasticsearch.
*
* ### Managed OpenSearch with Trusted Sources
* When forwarding logs to a DigitalOcean Managed OpenSearch cluster with trusted sources enabled, you must manually allow-list the IP addresses of your database cluster nodes.
*
* ### Authentication
* Include authentication credentials directly in the endpoint URL using the format `https://username:password@host:port`. Alternatively, configure authentication on your OpenSearch/Elasticsearch cluster to accept connections from your database cluster's IP addresses.
*
* ## Import
*
* Database logsink OpenSearch resources can be imported using the composite ID format `cluster_id,logsink_id`. For example:
*
* ```sh
* $ pulumi import digitalocean:index/databaseLogsinkOpensearch:DatabaseLogsinkOpensearch example 245bcfd0-7f31-4ce6-a2bc-475a116cca97,f38db7c8-1f31-4ce6-a2bc-475a116cca97
* ```
*
* **Note**: The cluster ID and logsink ID must be separated by a comma.
*/
export declare class DatabaseLogsinkOpensearch extends pulumi.CustomResource {
/**
* Get an existing DatabaseLogsinkOpensearch resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: DatabaseLogsinkOpensearchState, opts?: pulumi.CustomResourceOptions): DatabaseLogsinkOpensearch;
/**
* Returns true if the given object is an instance of DatabaseLogsinkOpensearch. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is DatabaseLogsinkOpensearch;
/**
* CA certificate for TLS verification in PEM format. Can be specified using `file()` function. This field is marked as sensitive.
*/
readonly caCert: pulumi.Output<string | undefined>;
/**
* UUID of the source database cluster that will forward logs.
*/
readonly clusterId: pulumi.Output<string>;
/**
* HTTPS URL to the OpenSearch or Elasticsearch cluster (e.g., `https://host:port`). **Note**: Only HTTPS URLs are supported.
*/
readonly endpoint: pulumi.Output<string>;
/**
* Maximum number of days to retain indices. Must be 1 or greater.
*/
readonly indexDaysMax: pulumi.Output<number | undefined>;
/**
* Prefix for the indices where logs will be stored.
*/
readonly indexPrefix: pulumi.Output<string>;
/**
* The unique identifier for the logsink as returned by the DigitalOcean API.
*/
readonly logsinkId: pulumi.Output<string>;
/**
* Display name for the logsink. **Note**: This is immutable; changing it will force recreation of the resource.
*/
readonly name: pulumi.Output<string>;
/**
* Request timeout for log deliveries in seconds. Must be 1 or greater.
*/
readonly timeoutSeconds: pulumi.Output<number | undefined>;
/**
* Create a DatabaseLogsinkOpensearch resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: DatabaseLogsinkOpensearchArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering DatabaseLogsinkOpensearch resources.
*/
export interface DatabaseLogsinkOpensearchState {
/**
* CA certificate for TLS verification in PEM format. Can be specified using `file()` function. This field is marked as sensitive.
*/
caCert?: pulumi.Input<string>;
/**
* UUID of the source database cluster that will forward logs.
*/
clusterId?: pulumi.Input<string>;
/**
* HTTPS URL to the OpenSearch or Elasticsearch cluster (e.g., `https://host:port`). **Note**: Only HTTPS URLs are supported.
*/
endpoint?: pulumi.Input<string>;
/**
* Maximum number of days to retain indices. Must be 1 or greater.
*/
indexDaysMax?: pulumi.Input<number>;
/**
* Prefix for the indices where logs will be stored.
*/
indexPrefix?: pulumi.Input<string>;
/**
* The unique identifier for the logsink as returned by the DigitalOcean API.
*/
logsinkId?: pulumi.Input<string>;
/**
* Display name for the logsink. **Note**: This is immutable; changing it will force recreation of the resource.
*/
name?: pulumi.Input<string>;
/**
* Request timeout for log deliveries in seconds. Must be 1 or greater.
*/
timeoutSeconds?: pulumi.Input<number>;
}
/**
* The set of arguments for constructing a DatabaseLogsinkOpensearch resource.
*/
export interface DatabaseLogsinkOpensearchArgs {
/**
* CA certificate for TLS verification in PEM format. Can be specified using `file()` function. This field is marked as sensitive.
*/
caCert?: pulumi.Input<string>;
/**
* UUID of the source database cluster that will forward logs.
*/
clusterId: pulumi.Input<string>;
/**
* HTTPS URL to the OpenSearch or Elasticsearch cluster (e.g., `https://host:port`). **Note**: Only HTTPS URLs are supported.
*/
endpoint: pulumi.Input<string>;
/**
* Maximum number of days to retain indices. Must be 1 or greater.
*/
indexDaysMax?: pulumi.Input<number>;
/**
* Prefix for the indices where logs will be stored.
*/
indexPrefix: pulumi.Input<string>;
/**
* Display name for the logsink. **Note**: This is immutable; changing it will force recreation of the resource.
*/
name?: pulumi.Input<string>;
/**
* Request timeout for log deliveries in seconds. Must be 1 or greater.
*/
timeoutSeconds?: pulumi.Input<number>;
}