@pulumi/databricks
Version:
A Pulumi package for creating and managing databricks cloud resources.
146 lines • 9.27 kB
JavaScript
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.MwsLogDelivery = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* > Initialize provider with `alias = "mws"`, `host = "https://accounts.cloud.databricks.com"` and use `provider = databricks.mws`
*
* This resource configures the delivery of the two supported log types from Databricks workspaces: [billable usage logs](https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html) and [audit logs](https://docs.databricks.com/administration-guide/account-settings/audit-logs.html).
*
* You cannot delete a log delivery configuration, but you can disable it when you no longer need it. This fact is important because there is a limit to the number of enabled log delivery configurations that you can create for an account. You can create a maximum of two enabled configurations that use the account level (no workspace filter) and two enabled configurations for every specific workspace (a workspaceId can occur in the workspace filter for two configurations). You can re-enable a disabled configuration, but the request fails if it violates the limits previously described.
*
* ## Billable Usage
*
* CSV files are delivered to `<delivery_path_prefix>/billable-usage/csv/` and are named `workspaceId=<workspace-id>-usageMonth=<month>.csv`, which are delivered daily by overwriting the month's CSV file for each workspace. Format of CSV file, as well as some usage examples, can be found [here](https://docs.databricks.com/administration-guide/account-settings/usage.html#download-usage-as-a-csv-file).
*
* Common processing scenario is to apply [cost allocation tags](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html), that could be enforced by setting customTags on a cluster or through cluster policy. Report contains `clusterId` field, that could be joined with data from AWS [cost and usage reports](https://docs.aws.amazon.com/cur/latest/userguide/cur-create.html), that can be joined with `user:ClusterId` tag from AWS usage report.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* const usageLogs = new databricks.MwsLogDelivery("usage_logs", {
* accountId: databricksAccountId,
* credentialsId: logWriter.credentialsId,
* storageConfigurationId: logBucket.storageConfigurationId,
* deliveryPathPrefix: "billable-usage",
* configName: "Usage Logs",
* logType: "BILLABLE_USAGE",
* outputFormat: "CSV",
* });
* ```
*
* ## Audit Logs
*
* JSON files with [static schema](https://docs.databricks.com/administration-guide/account-settings/audit-logs.html#audit-log-schema) are delivered to `<delivery_path_prefix>/workspaceId=<workspaceId>/date=<yyyy-mm-dd>/auditlogs_<internal-id>.json`. Logs are available within 15 minutes of activation for audit logs. New JSON files are delivered every few minutes, potentially overwriting existing files for each workspace. Sometimes data may arrive later than 15 minutes. Databricks can overwrite the delivered log files in your bucket at any time. If a file is overwritten, the existing content remains, but there may be additional lines for more auditable events. Overwriting ensures exactly-once semantics without requiring read or delete access to your account.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* const auditLogs = new databricks.MwsLogDelivery("audit_logs", {
* accountId: databricksAccountId,
* credentialsId: logWriter.credentialsId,
* storageConfigurationId: logBucket.storageConfigurationId,
* deliveryPathPrefix: "audit-logs",
* configName: "Audit Logs",
* logType: "AUDIT_LOGS",
* outputFormat: "JSON",
* });
* ```
*
* ## Related Resources
*
* The following resources are used in the same context:
*
* * Provisioning Databricks on AWS guide.
* * databricks.MwsCredentials to configure the cross-account role for creation of new workspaces within AWS.
* * databricks.MwsCustomerManagedKeys to configure KMS keys for new workspaces within AWS.
* * databricks.MwsNetworks to [configure VPC](https://docs.databricks.com/administration-guide/cloud-configurations/aws/customer-managed-vpc.html) & subnets for new workspaces within AWS.
* * databricks.MwsStorageConfigurations to configure root bucket new workspaces within AWS.
* * databricks.MwsWorkspaces to set up [AWS and GCP workspaces](https://docs.databricks.com/getting-started/overview.html#e2-architecture-1).
*
* ## Import
*
* !> Importing this resource is not currently supported.
*/
class MwsLogDelivery extends pulumi.CustomResource {
/**
* Get an existing MwsLogDelivery 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 MwsLogDelivery(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of MwsLogDelivery. 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'] === MwsLogDelivery.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accountId"] = state ? state.accountId : undefined;
resourceInputs["configId"] = state ? state.configId : undefined;
resourceInputs["configName"] = state ? state.configName : undefined;
resourceInputs["credentialsId"] = state ? state.credentialsId : undefined;
resourceInputs["deliveryPathPrefix"] = state ? state.deliveryPathPrefix : undefined;
resourceInputs["deliveryStartTime"] = state ? state.deliveryStartTime : undefined;
resourceInputs["logType"] = state ? state.logType : undefined;
resourceInputs["outputFormat"] = state ? state.outputFormat : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["storageConfigurationId"] = state ? state.storageConfigurationId : undefined;
resourceInputs["workspaceIdsFilters"] = state ? state.workspaceIdsFilters : undefined;
}
else {
const args = argsOrState;
if ((!args || args.accountId === undefined) && !opts.urn) {
throw new Error("Missing required property 'accountId'");
}
if ((!args || args.credentialsId === undefined) && !opts.urn) {
throw new Error("Missing required property 'credentialsId'");
}
if ((!args || args.logType === undefined) && !opts.urn) {
throw new Error("Missing required property 'logType'");
}
if ((!args || args.outputFormat === undefined) && !opts.urn) {
throw new Error("Missing required property 'outputFormat'");
}
if ((!args || args.storageConfigurationId === undefined) && !opts.urn) {
throw new Error("Missing required property 'storageConfigurationId'");
}
resourceInputs["accountId"] = args ? args.accountId : undefined;
resourceInputs["configId"] = args ? args.configId : undefined;
resourceInputs["configName"] = args ? args.configName : undefined;
resourceInputs["credentialsId"] = args ? args.credentialsId : undefined;
resourceInputs["deliveryPathPrefix"] = args ? args.deliveryPathPrefix : undefined;
resourceInputs["deliveryStartTime"] = args ? args.deliveryStartTime : undefined;
resourceInputs["logType"] = args ? args.logType : undefined;
resourceInputs["outputFormat"] = args ? args.outputFormat : undefined;
resourceInputs["status"] = args ? args.status : undefined;
resourceInputs["storageConfigurationId"] = args ? args.storageConfigurationId : undefined;
resourceInputs["workspaceIdsFilters"] = args ? args.workspaceIdsFilters : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(MwsLogDelivery.__pulumiType, name, resourceInputs, opts);
}
}
exports.MwsLogDelivery = MwsLogDelivery;
/** @internal */
MwsLogDelivery.__pulumiType = 'databricks:index/mwsLogDelivery:MwsLogDelivery';
//# sourceMappingURL=mwsLogDelivery.js.map
;