UNPKG

@pulumiverse/grafana

Version:

A Pulumi package for creating and managing grafana.

135 lines 6.37 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.GenericResource = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages arbitrary Grafana App Platform resources when a typed Terraform resource is not yet available. The resource is still experimental; diffing semantics are subject to change - feedback welcome in https://github.com/grafana/terraform-provider-grafana/issues. * * This resource accepts a Kubernetes-style `manifest` as the single source of truth for the resource definition. Use HCL `merge()` if you need to inject Terraform variables into a static manifest file. * * Only namespaced App Platform kinds are supported. The provider autodiscovers the namespace from `/bootdata` on every operation. If autodiscovery does not find a cloud stack namespace, the provider falls back to the explicit `stackId` and then `orgId` provider settings. * * Top-level manifest fields are limited to `apiVersion`, `kind`, `metadata`, `spec`, and the ignored `status` field. If `metadata.namespace` is configured, it must match the provider-selected namespace. * * Inside `manifest.metadata`, both Kubernetes `name` and `uid` are accepted as input aliases for the object identifier. * * The top-level `secure` argument is write-only and requires Terraform 1.11 or later. Each configured key must set exactly one of `create` or `name`, and Terraform only re-sends those secure values when `secureVersion` changes. * * Reads refresh managed drift from the API. Metadata drift is limited to the metadata keys you configured; `spec` is authoritative, so extra remote spec fields are refreshed into state and will drift until Terraform restores the configured object. * * Import format: * * Import stores a normalized manifest without noisy server-managed metadata such as `resourceVersion` or `managedFields`. Because `secure` is write-only, imported configurations still need you to add `secure` and `secureVersion` manually afterward. * * ## Example Usage * * ### Repository with Secure Fields * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as grafana from "@pulumiverse/grafana"; * * // Repository with secure fields. * // Secure values are top-level because `secure` is write-only and cannot live in the manifest. * const repository = new grafana.apps.GenericResource("repository", { * manifest: { * apiVersion: "provisioning.grafana.app/v1beta1", * kind: "Repository", * metadata: { * name: "platform-repo", * }, * spec: { * title: "Platform Repository", * description: "Repository managed through the generic resource", * type: "github", * workflows: ["write"], * sync: { * enabled: false, * target: "folder", * intervalSeconds: 300, * }, * github: { * url: "https://github.com/example/grafana-dashboards", * branch: "main", * path: "grafana", * generateDashboardPreviews: false, * }, * }, * }, * secure: { * token: { * create: githubToken, * }, * webhookSecret: { * create: webhookSecret, * }, * }, * secureVersion: 1, * }); * ``` * * ## Import * * Import uses the format `<api_group>/<version>/<kind>/<object_name>`: * * ```sh * $ pulumi import grafana:apps/genericResource:GenericResource example provisioning.grafana.app/v1beta1/Repository/platform-repo * ``` * * After import, add `secure` and `secureVersion` back manually because write-only arguments are not stored in state. */ class GenericResource extends pulumi.CustomResource { /** * Get an existing GenericResource 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 GenericResource(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of GenericResource. 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'] === GenericResource.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["allowUiUpdates"] = state?.allowUiUpdates; resourceInputs["managerIdentity"] = state?.managerIdentity; resourceInputs["manifest"] = state?.manifest; resourceInputs["secure"] = state?.secure; resourceInputs["secureVersion"] = state?.secureVersion; } else { const args = argsOrState; resourceInputs["allowUiUpdates"] = args?.allowUiUpdates; resourceInputs["managerIdentity"] = args?.managerIdentity; resourceInputs["manifest"] = args?.manifest; resourceInputs["secure"] = args?.secure ? pulumi.secret(args.secure) : undefined; resourceInputs["secureVersion"] = args?.secureVersion; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["secure"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(GenericResource.__pulumiType, name, resourceInputs, opts); } } exports.GenericResource = GenericResource; /** @internal */ GenericResource.__pulumiType = 'grafana:apps/genericResource:GenericResource'; //# sourceMappingURL=genericResource.js.map