@pulumiverse/grafana
Version:
A Pulumi package for creating and managing grafana.
173 lines (172 loc) • 7.68 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
/**
* Manages and rotates service account tokens of a Grafana Cloud stack using the Cloud API
* This can be used to bootstrap a management service account token for a new stack
*
* * [Official documentation](https://grafana.com/docs/grafana/latest/administration/service-accounts/)
* * [HTTP API](https://grafana.com/docs/grafana/latest/developer-resources/api-reference/http-api/api-legacy/serviceaccount/#service-account-api)
*
* Required access policy scopes:
*
* * stack-service-accounts:write
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as grafana from "@pulumiverse/grafana";
*
* const cloudSa = new grafana.cloud.StackServiceAccount("cloud_sa", {
* stackSlug: "<your stack slug>",
* name: "cloud service account",
* role: "Admin",
* isDisabled: false,
* });
* const foo = new grafana.cloud.StackServiceAccountRotatingToken("foo", {
* stackSlug: "<your stack slug>",
* namePrefix: "key_foo",
* serviceAccountId: cloudSa.id,
* secondsToLive: 7776000,
* earlyRotationWindowSeconds: 604800,
* });
* export const serviceAccountTokenFooKey = fooGrafanaCloudStackServiceAccountToken.key;
* ```
*/
export declare class StackServiceAccountRotatingToken extends pulumi.CustomResource {
/**
* Get an existing StackServiceAccountRotatingToken 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?: StackServiceAccountRotatingTokenState, opts?: pulumi.CustomResourceOptions): StackServiceAccountRotatingToken;
/**
* Returns true if the given object is an instance of StackServiceAccountRotatingToken. 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 StackServiceAccountRotatingToken;
/**
* Deletes the service account token in Grafana when the resource is destroyed in Terraform, instead of leaving it to expire at its `expiration` time. Use it with `lifecycle { createBeforeDestroy = true }` to make sure that the new token is created before the old one is deleted. Defaults to `false`.
*/
readonly deleteOnDestroy: pulumi.Output<boolean | undefined>;
/**
* Duration of the time window before expiring where the token can be rotated, in seconds.
*/
readonly earlyRotationWindowSeconds: pulumi.Output<number>;
/**
* The expiration date of the service account token.
*/
readonly expiration: pulumi.Output<string>;
/**
* The status of the service account token.
*/
readonly hasExpired: pulumi.Output<boolean>;
/**
* The key of the service account token.
*/
readonly key: pulumi.Output<string>;
/**
* The name of the service account token. It will start with `<name_prefix>-` and will have characters appended to it to make the name unique.
*/
readonly name: pulumi.Output<string>;
/**
* Prefix for the name of the service account tokens created by this resource. The actual name will be stored in the computed field `name`, which will be in the format `<name_prefix>-<additional_characters>`.
*/
readonly namePrefix: pulumi.Output<string>;
/**
* Signals that the service account token is expired or within the period to be early rotated.
*/
readonly readyForRotation: pulumi.Output<boolean>;
/**
* The token expiration in seconds.
*/
readonly secondsToLive: pulumi.Output<number>;
/**
* The ID of the service account to which the token belongs.
*/
readonly serviceAccountId: pulumi.Output<string>;
readonly stackSlug: pulumi.Output<string>;
/**
* Create a StackServiceAccountRotatingToken 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: StackServiceAccountRotatingTokenArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering StackServiceAccountRotatingToken resources.
*/
export interface StackServiceAccountRotatingTokenState {
/**
* Deletes the service account token in Grafana when the resource is destroyed in Terraform, instead of leaving it to expire at its `expiration` time. Use it with `lifecycle { createBeforeDestroy = true }` to make sure that the new token is created before the old one is deleted. Defaults to `false`.
*/
deleteOnDestroy?: pulumi.Input<boolean>;
/**
* Duration of the time window before expiring where the token can be rotated, in seconds.
*/
earlyRotationWindowSeconds?: pulumi.Input<number>;
/**
* The expiration date of the service account token.
*/
expiration?: pulumi.Input<string>;
/**
* The status of the service account token.
*/
hasExpired?: pulumi.Input<boolean>;
/**
* The key of the service account token.
*/
key?: pulumi.Input<string>;
/**
* The name of the service account token. It will start with `<name_prefix>-` and will have characters appended to it to make the name unique.
*/
name?: pulumi.Input<string>;
/**
* Prefix for the name of the service account tokens created by this resource. The actual name will be stored in the computed field `name`, which will be in the format `<name_prefix>-<additional_characters>`.
*/
namePrefix?: pulumi.Input<string>;
/**
* Signals that the service account token is expired or within the period to be early rotated.
*/
readyForRotation?: pulumi.Input<boolean>;
/**
* The token expiration in seconds.
*/
secondsToLive?: pulumi.Input<number>;
/**
* The ID of the service account to which the token belongs.
*/
serviceAccountId?: pulumi.Input<string>;
stackSlug?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a StackServiceAccountRotatingToken resource.
*/
export interface StackServiceAccountRotatingTokenArgs {
/**
* Deletes the service account token in Grafana when the resource is destroyed in Terraform, instead of leaving it to expire at its `expiration` time. Use it with `lifecycle { createBeforeDestroy = true }` to make sure that the new token is created before the old one is deleted. Defaults to `false`.
*/
deleteOnDestroy?: pulumi.Input<boolean>;
/**
* Duration of the time window before expiring where the token can be rotated, in seconds.
*/
earlyRotationWindowSeconds: pulumi.Input<number>;
/**
* Prefix for the name of the service account tokens created by this resource. The actual name will be stored in the computed field `name`, which will be in the format `<name_prefix>-<additional_characters>`.
*/
namePrefix: pulumi.Input<string>;
/**
* The token expiration in seconds.
*/
secondsToLive: pulumi.Input<number>;
/**
* The ID of the service account to which the token belongs.
*/
serviceAccountId: pulumi.Input<string>;
stackSlug: pulumi.Input<string>;
}