@pulumi/digitalocean
Version:
A Pulumi package for creating and managing DigitalOcean cloud resources.
192 lines • 7.49 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.DatabaseLogsinkRsyslog = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides a DigitalOcean database logsink resource allowing you to forward logs from a managed database cluster to an external rsyslog server.
*
* 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 rsyslog 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.DatabaseLogsinkRsyslog("example", {
* clusterId: postgres_example.id,
* name: "rsyslog-prod",
* server: "192.0.2.10",
* port: 514,
* format: "rfc5424",
* });
* ```
*
* ### TLS-enabled rsyslog configuration
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
* import * as std from "@pulumi/std";
*
* const example_tls = new digitalocean.DatabaseLogsinkRsyslog("example-tls", {
* clusterId: postgres_example.id,
* name: "rsyslog-secure",
* server: "logs.example.com",
* port: 6514,
* tls: true,
* format: "rfc5424",
* caCert: std.file({
* input: "/path/to/ca.pem",
* }).then(invoke => invoke.result),
* });
* ```
*
* ### mTLS (mutual TLS) configuration
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
* import * as std from "@pulumi/std";
*
* const example_mtls = new digitalocean.DatabaseLogsinkRsyslog("example-mtls", {
* clusterId: postgres_example.id,
* name: "rsyslog-mtls",
* server: "secure-logs.example.com",
* port: 6514,
* tls: true,
* format: "rfc5424",
* caCert: std.file({
* input: "/path/to/ca.pem",
* }).then(invoke => invoke.result),
* clientCert: std.file({
* input: "/path/to/client.crt",
* }).then(invoke => invoke.result),
* clientKey: std.file({
* input: "/path/to/client.key",
* }).then(invoke => invoke.result),
* });
* ```
*
* ### Custom format configuration
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const example_custom = new digitalocean.DatabaseLogsinkRsyslog("example-custom", {
* clusterId: postgres_example.id,
* name: "rsyslog-custom",
* server: "192.0.2.10",
* port: 514,
* format: "custom",
* logline: "<%pri%>%timestamp:::date-rfc3339% %HOSTNAME% %app-name% %msg%",
* structuredData: "[example@41058 iut=\"3\"]",
* });
* ```
*
* ## Import
*
* Database logsink rsyslog resources can be imported using the composite ID format `cluster_id,logsink_id`. For example:
*
* ```sh
* $ pulumi import digitalocean:index/databaseLogsinkRsyslog:DatabaseLogsinkRsyslog example 245bcfd0-7f31-4ce6-a2bc-475a116cca97,f38db7c8-1f31-4ce6-a2bc-475a116cca97
* ```
*
* **Note**: The cluster ID and logsink ID must be separated by a comma.
*/
class DatabaseLogsinkRsyslog extends pulumi.CustomResource {
/**
* Get an existing DatabaseLogsinkRsyslog 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, id, state, opts) {
return new DatabaseLogsinkRsyslog(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of DatabaseLogsinkRsyslog. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === DatabaseLogsinkRsyslog.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["caCert"] = state?.caCert;
resourceInputs["clientCert"] = state?.clientCert;
resourceInputs["clientKey"] = state?.clientKey;
resourceInputs["clusterId"] = state?.clusterId;
resourceInputs["format"] = state?.format;
resourceInputs["logline"] = state?.logline;
resourceInputs["logsinkId"] = state?.logsinkId;
resourceInputs["name"] = state?.name;
resourceInputs["port"] = state?.port;
resourceInputs["server"] = state?.server;
resourceInputs["structuredData"] = state?.structuredData;
resourceInputs["tls"] = state?.tls;
}
else {
const args = argsOrState;
if (args?.clusterId === undefined && !opts.urn) {
throw new Error("Missing required property 'clusterId'");
}
if (args?.port === undefined && !opts.urn) {
throw new Error("Missing required property 'port'");
}
if (args?.server === undefined && !opts.urn) {
throw new Error("Missing required property 'server'");
}
resourceInputs["caCert"] = args?.caCert ? pulumi.secret(args.caCert) : undefined;
resourceInputs["clientCert"] = args?.clientCert;
resourceInputs["clientKey"] = args?.clientKey ? pulumi.secret(args.clientKey) : undefined;
resourceInputs["clusterId"] = args?.clusterId;
resourceInputs["format"] = args?.format;
resourceInputs["logline"] = args?.logline;
resourceInputs["name"] = args?.name;
resourceInputs["port"] = args?.port;
resourceInputs["server"] = args?.server;
resourceInputs["structuredData"] = args?.structuredData;
resourceInputs["tls"] = args?.tls;
resourceInputs["logsinkId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["caCert", "clientKey"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(DatabaseLogsinkRsyslog.__pulumiType, name, resourceInputs, opts);
}
}
exports.DatabaseLogsinkRsyslog = DatabaseLogsinkRsyslog;
/** @internal */
DatabaseLogsinkRsyslog.__pulumiType = 'digitalocean:index/databaseLogsinkRsyslog:DatabaseLogsinkRsyslog';
//# sourceMappingURL=databaseLogsinkRsyslog.js.map