UNPKG

@pulumiverse/grafana

Version:

A Pulumi package for creating and managing grafana.

121 lines 4.88 kB
"use strict"; // *** 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.Integration = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages Grafana Cloud integrations. * * * [Official documentation](https://grafana.com/docs/grafana-cloud/data-configuration/integrations/) * * This provider lets you manage Grafana Cloud Integrations. * Alerts can optionally be disabled. * * Please note: Grafana Cloud Integrations do not support in-place upgrades, and require a teardown and reapply to resolve version drift. * As such it is recommended to have a separate TF plan for integrations to cleanly destroy them as needed. * * Update, only triggered on config change, is implemented as a complete uninstall, then reinstall of the integration in question. * * Required access policy scopes: * * * folders:read * * folders:write * * dashboards:read * * dashboards:write * * rules:read * * rules:write * * Based on: https://grafana.com/docs/grafana/latest/alerting/alerting-rules/alerting-migration/#import-rules-with-grafana-alerting * * **Note:** This resource creates folders and dashboards as part of the integration installation process, which requires additional permissions beyond the basic integration scopes. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as grafana from "@pulumiverse/grafana"; * * // install linux-node integration * const linux_node = new grafana.cloud.Integration("linux-node", {slug: "linux-node"}); * // install kafka integration w. alerts disabled * const kafka = new grafana.cloud.Integration("kafka", { * slug: "kafka", * alertsEnabled: false, * }); * export const linuxNodeIntegration = { * name: linux_node.name, * latestVersion: linux_node.latestVersion, * installedVersion: linux_node.installedVersion, * dashboardFolder: linux_node.dashboardFolder, * }; * export const kafkaIntegration = { * name: kafka.name, * latestVersion: kafka.latestVersion, * installedVersion: kafka.installedVersion, * dashboardFolder: kafka.dashboardFolder, * }; * ``` * * ## Import * * ```sh * terraform import grafana_cloud_integration.name "{{ slug }}" * ``` */ class Integration extends pulumi.CustomResource { /** * Get an existing Integration 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 Integration(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Integration. 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'] === Integration.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["alertsEnabled"] = state?.alertsEnabled; resourceInputs["dashboardFolder"] = state?.dashboardFolder; resourceInputs["installedVersion"] = state?.installedVersion; resourceInputs["latestVersion"] = state?.latestVersion; resourceInputs["name"] = state?.name; resourceInputs["slug"] = state?.slug; } else { const args = argsOrState; if (args?.slug === undefined && !opts.urn) { throw new Error("Missing required property 'slug'"); } resourceInputs["alertsEnabled"] = args?.alertsEnabled; resourceInputs["slug"] = args?.slug; resourceInputs["dashboardFolder"] = undefined /*out*/; resourceInputs["installedVersion"] = undefined /*out*/; resourceInputs["latestVersion"] = undefined /*out*/; resourceInputs["name"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Integration.__pulumiType, name, resourceInputs, opts); } } exports.Integration = Integration; /** @internal */ Integration.__pulumiType = 'grafana:cloud/integration:Integration'; //# sourceMappingURL=integration.js.map