UNPKG

@pulumiverse/grafana

Version:

A Pulumi package for creating and managing grafana.

176 lines (175 loc) 10.8 kB
import * as pulumi from "@pulumi/pulumi"; /** * 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. */ export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: GenericResourceState, opts?: pulumi.CustomResourceOptions): GenericResource; /** * 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: any): obj is GenericResource; /** * Whether the resource can be edited from the Grafana UI. Defaults to `false` — Terraform-managed resources are locked from UI edits unless you opt in. Set to `true` to allow UI modifications; not supported by all resources. */ readonly allowUiUpdates: pulumi.Output<boolean>; /** * Override the identity stamped on this resource's manager metadata. Defaults to "grafana-terraform-provider". Use this to distinguish resources managed by different Terraform workspaces targeting the same Grafana instance. */ readonly managerIdentity: pulumi.Output<string | undefined>; /** * Kubernetes-style manifest, typically from `yamldecode(file(...))` or `jsondecode(file(...))`. Must contain `apiVersion`, `kind`, `metadata` (with `name` or `uid`), and `spec`. Use HCL `merge()` to inject Terraform variables. If you start from an exported manifest, remove noisy server-managed metadata such as `resourceVersion`, `generation`, and `managedFields`, or import the resource first and use the normalized state shape. If `metadata.namespace` is set, it must match the namespace selected from provider `orgId` or `stackId` / autodiscovery. Top-level manifest fields are limited to `apiVersion`, `kind`, `metadata`, `spec`, and the ignored `status` field. The `secure` field must not be set here; use the top-level `secure` argument instead. */ readonly manifest: pulumi.Output<any>; /** * **NOTE:** This field is write-only and its value will not be updated in state as part of read operations. * Write-only secure values map. Each key must contain exactly one of `create` or `name`; empty objects are invalid. */ readonly secure: pulumi.Output<any | undefined>; /** * Set this to 1 when using `secure`, then increment it whenever you want Terraform to re-apply secure values. */ readonly secureVersion: pulumi.Output<number | undefined>; /** * Create a GenericResource resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args?: GenericResourceArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering GenericResource resources. */ export interface GenericResourceState { /** * Whether the resource can be edited from the Grafana UI. Defaults to `false` — Terraform-managed resources are locked from UI edits unless you opt in. Set to `true` to allow UI modifications; not supported by all resources. */ allowUiUpdates?: pulumi.Input<boolean>; /** * Override the identity stamped on this resource's manager metadata. Defaults to "grafana-terraform-provider". Use this to distinguish resources managed by different Terraform workspaces targeting the same Grafana instance. */ managerIdentity?: pulumi.Input<string>; /** * Kubernetes-style manifest, typically from `yamldecode(file(...))` or `jsondecode(file(...))`. Must contain `apiVersion`, `kind`, `metadata` (with `name` or `uid`), and `spec`. Use HCL `merge()` to inject Terraform variables. If you start from an exported manifest, remove noisy server-managed metadata such as `resourceVersion`, `generation`, and `managedFields`, or import the resource first and use the normalized state shape. If `metadata.namespace` is set, it must match the namespace selected from provider `orgId` or `stackId` / autodiscovery. Top-level manifest fields are limited to `apiVersion`, `kind`, `metadata`, `spec`, and the ignored `status` field. The `secure` field must not be set here; use the top-level `secure` argument instead. */ manifest?: any; /** * **NOTE:** This field is write-only and its value will not be updated in state as part of read operations. * Write-only secure values map. Each key must contain exactly one of `create` or `name`; empty objects are invalid. */ secure?: any; /** * Set this to 1 when using `secure`, then increment it whenever you want Terraform to re-apply secure values. */ secureVersion?: pulumi.Input<number>; } /** * The set of arguments for constructing a GenericResource resource. */ export interface GenericResourceArgs { /** * Whether the resource can be edited from the Grafana UI. Defaults to `false` — Terraform-managed resources are locked from UI edits unless you opt in. Set to `true` to allow UI modifications; not supported by all resources. */ allowUiUpdates?: pulumi.Input<boolean>; /** * Override the identity stamped on this resource's manager metadata. Defaults to "grafana-terraform-provider". Use this to distinguish resources managed by different Terraform workspaces targeting the same Grafana instance. */ managerIdentity?: pulumi.Input<string>; /** * Kubernetes-style manifest, typically from `yamldecode(file(...))` or `jsondecode(file(...))`. Must contain `apiVersion`, `kind`, `metadata` (with `name` or `uid`), and `spec`. Use HCL `merge()` to inject Terraform variables. If you start from an exported manifest, remove noisy server-managed metadata such as `resourceVersion`, `generation`, and `managedFields`, or import the resource first and use the normalized state shape. If `metadata.namespace` is set, it must match the namespace selected from provider `orgId` or `stackId` / autodiscovery. Top-level manifest fields are limited to `apiVersion`, `kind`, `metadata`, `spec`, and the ignored `status` field. The `secure` field must not be set here; use the top-level `secure` argument instead. */ manifest?: any; /** * **NOTE:** This field is write-only and its value will not be updated in state as part of read operations. * Write-only secure values map. Each key must contain exactly one of `create` or `name`; empty objects are invalid. */ secure?: any; /** * Set this to 1 when using `secure`, then increment it whenever you want Terraform to re-apply secure values. */ secureVersion?: pulumi.Input<number>; }