UNPKG

@pulumiverse/grafana

Version:

A Pulumi package for creating and managing grafana.

126 lines 6.65 kB
"use strict"; // *** 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.SyntheticMonitoringInstallation = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Sets up Synthetic Monitoring on a Grafana cloud stack and generates a token. * Once a Grafana Cloud stack is created, a user can either use this resource or go into the UI to install synthetic monitoring. * This resource cannot be imported but it can be used on an existing Synthetic Monitoring installation without issues. * * **Note that this resource must be used on a provider configured with Grafana Cloud credentials.** * * * [Official documentation](https://grafana.com/docs/grafana-cloud/testing/synthetic-monitoring/set-up/) * * [API documentation](https://github.com/grafana/synthetic-monitoring-api-go-client/blob/main/docs/API.md#apiv1registerinstall) * * Required access policy scopes: * * * stacks:read * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as grafana from "@pulumi/grafana"; * import * as grafana from "@pulumiverse/grafana"; * * const config = new pulumi.Config(); * // Cloud Access Policy token for Grafana Cloud with the following scopes: accesspolicies:read|write|delete, stacks:read|write|delete * const cloudAccessPolicyToken = config.requireObject("cloudAccessPolicyToken"); * const stackSlug = config.requireObject("stackSlug"); * const cloudRegion = config.get("cloudRegion") || "prod-us-east-0"; * const smStack = new grafana.cloud.Stack("sm_stack", { * name: stackSlug, * slug: stackSlug, * regionSlug: cloudRegion, * }); * // Step 2: Install Synthetic Monitoring on the stack * const smMetricsPublish = new grafana.cloud.AccessPolicy("sm_metrics_publish", { * region: cloudRegion, * name: "metric-publisher-for-sm", * scopes: [ * "metrics:write", * "stacks:read", * "logs:write", * "traces:write", * ], * realms: [{ * type: "stack", * identifier: smStack.id, * }], * }); * const smMetricsPublishAccessPolicyToken = new grafana.cloud.AccessPolicyToken("sm_metrics_publish", { * region: cloudRegion, * accessPolicyId: smMetricsPublish.policyId, * name: "metric-publisher-for-sm", * }); * const smStackInstallation = new grafana.syntheticmonitoring.Installation("sm_stack", { * stackId: smStack.id, * metricsPublisherKey: smMetricsPublishAccessPolicyToken.token, * }); * const main = grafana.syntheticMonitoring.getProbes({}); * ``` * * @deprecated grafana.index/syntheticmonitoringinstallation.SyntheticMonitoringInstallation has been deprecated in favor of grafana.syntheticmonitoring/installation.Installation */ class SyntheticMonitoringInstallation extends pulumi.CustomResource { /** * Get an existing SyntheticMonitoringInstallation 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) { pulumi.log.warn("SyntheticMonitoringInstallation is deprecated: grafana.index/syntheticmonitoringinstallation.SyntheticMonitoringInstallation has been deprecated in favor of grafana.syntheticmonitoring/installation.Installation"); return new SyntheticMonitoringInstallation(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of SyntheticMonitoringInstallation. 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'] === SyntheticMonitoringInstallation.__pulumiType; } /** @deprecated grafana.index/syntheticmonitoringinstallation.SyntheticMonitoringInstallation has been deprecated in favor of grafana.syntheticmonitoring/installation.Installation */ constructor(name, argsOrState, opts) { pulumi.log.warn("SyntheticMonitoringInstallation is deprecated: grafana.index/syntheticmonitoringinstallation.SyntheticMonitoringInstallation has been deprecated in favor of grafana.syntheticmonitoring/installation.Installation"); let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["metricsPublisherKey"] = state ? state.metricsPublisherKey : undefined; resourceInputs["smAccessToken"] = state ? state.smAccessToken : undefined; resourceInputs["stackId"] = state ? state.stackId : undefined; resourceInputs["stackSmApiUrl"] = state ? state.stackSmApiUrl : undefined; } else { const args = argsOrState; if ((!args || args.metricsPublisherKey === undefined) && !opts.urn) { throw new Error("Missing required property 'metricsPublisherKey'"); } if ((!args || args.stackId === undefined) && !opts.urn) { throw new Error("Missing required property 'stackId'"); } resourceInputs["metricsPublisherKey"] = (args === null || args === void 0 ? void 0 : args.metricsPublisherKey) ? pulumi.secret(args.metricsPublisherKey) : undefined; resourceInputs["stackId"] = args ? args.stackId : undefined; resourceInputs["stackSmApiUrl"] = args ? args.stackSmApiUrl : undefined; resourceInputs["smAccessToken"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["metricsPublisherKey"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(SyntheticMonitoringInstallation.__pulumiType, name, resourceInputs, opts); } } exports.SyntheticMonitoringInstallation = SyntheticMonitoringInstallation; /** @internal */ SyntheticMonitoringInstallation.__pulumiType = 'grafana:index/syntheticMonitoringInstallation:SyntheticMonitoringInstallation'; //# sourceMappingURL=syntheticMonitoringInstallation.js.map