UNPKG

@pulumiverse/grafana

Version:

A Pulumi package for creating and managing grafana.

168 lines (167 loc) 6.26 kB
import * as pulumi from "@pulumi/pulumi"; /** * Sets up the k6 App on a Grafana Cloud instance 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 k6. * This resource cannot be imported but it can be used on an existing k6 App 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/k6/) * * Required access policy scopes: * * * stacks:read * * stacks:write * * subscriptions:read * * orgs:read * * stack-service-accounts:write * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as grafana from "@pulumiverse/grafana"; * * const config = new pulumi.Config(); * // Cloud Access Policy token for Grafana Cloud with the following scopes: stacks:read|write|delete, stack-service-accounts:write * const cloudAccessPolicyToken = config.requireObject<any>("cloudAccessPolicyToken"); * const stackSlug = config.requireObject<any>("stackSlug"); * const cloudRegion = config.get("cloudRegion") || "us"; * const k6Stack = new grafana.cloud.Stack("k6_stack", { * name: stackSlug, * slug: stackSlug, * regionSlug: cloudRegion, * }); * // Step 2: Create a Service Account and a token to install the k6 App * const k6Sa = new grafana.cloud.StackServiceAccount("k6_sa", { * stackSlug: stackSlug, * name: `${stackSlug}-k6-app`, * role: "Admin", * isDisabled: false, * }); * const k6SaToken = new grafana.cloud.StackServiceAccountToken("k6_sa_token", { * stackSlug: stackSlug, * name: `${stackSlug}-k6-app-token`, * serviceAccountId: k6Sa.id, * }); * // Step 3: Install the k6 App on the stack * const k6Installation = new grafana.k6.Installation("k6_installation", { * cloudAccessPolicyToken: cloudAccessPolicyToken, * stackId: k6Stack.id, * grafanaSaToken: k6SaToken.key, * grafanaUser: "admin", * }); * const myK6Project = new grafana.k6.Project("my_k6_project", {name: "k6 Project created with TF"}); * ``` */ export declare class Installation extends pulumi.CustomResource { /** * Get an existing Installation 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?: InstallationState, opts?: pulumi.CustomResourceOptions): Installation; /** * Returns true if the given object is an instance of Installation. 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 Installation; /** * The [Grafana Cloud access policy](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/). */ readonly cloudAccessPolicyToken: pulumi.Output<string>; /** * The [service account](https://grafana.com/docs/grafana/latest/administration/service-accounts/) token. */ readonly grafanaSaToken: pulumi.Output<string>; /** * The user to use for the installation. */ readonly grafanaUser: pulumi.Output<string>; /** * Generated token to access the k6 API. */ readonly k6AccessToken: pulumi.Output<string>; /** * The Grafana Cloud k6 API url. */ readonly k6ApiUrl: pulumi.Output<string>; /** * The identifier of the k6 organization. */ readonly k6Organization: pulumi.Output<string>; /** * The identifier of the stack to install k6 on. */ readonly stackId: pulumi.Output<string>; /** * Create a Installation 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: InstallationArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Installation resources. */ export interface InstallationState { /** * The [Grafana Cloud access policy](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/). */ cloudAccessPolicyToken?: pulumi.Input<string>; /** * The [service account](https://grafana.com/docs/grafana/latest/administration/service-accounts/) token. */ grafanaSaToken?: pulumi.Input<string>; /** * The user to use for the installation. */ grafanaUser?: pulumi.Input<string>; /** * Generated token to access the k6 API. */ k6AccessToken?: pulumi.Input<string>; /** * The Grafana Cloud k6 API url. */ k6ApiUrl?: pulumi.Input<string>; /** * The identifier of the k6 organization. */ k6Organization?: pulumi.Input<string>; /** * The identifier of the stack to install k6 on. */ stackId?: pulumi.Input<string>; } /** * The set of arguments for constructing a Installation resource. */ export interface InstallationArgs { /** * The [Grafana Cloud access policy](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/). */ cloudAccessPolicyToken: pulumi.Input<string>; /** * The [service account](https://grafana.com/docs/grafana/latest/administration/service-accounts/) token. */ grafanaSaToken: pulumi.Input<string>; /** * The user to use for the installation. */ grafanaUser: pulumi.Input<string>; /** * The Grafana Cloud k6 API url. */ k6ApiUrl?: pulumi.Input<string>; /** * The identifier of the stack to install k6 on. */ stackId: pulumi.Input<string>; }