@pulumiverse/scaleway
Version:
A Pulumi package for creating and managing Scaleway cloud resources.
164 lines • 7.45 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GrafanaUser = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* > **Deprecated:** This resource is deprecated and will be removed on **January 1st, 2026**.
*
* > **Migration Guide:** Grafana authentication is now managed through [Scaleway IAM (Identity and Access Management)](https://www.scaleway.com/en/docs/identity-and-access-management/iam/). To access your Grafana instance, use the `scaleway.observability.getGrafana` data source to retrieve the Grafana URL and authenticate using your Scaleway IAM credentials.
*
* The `scaleway.observability.GrafanaUser` resource allows you to create and manage [Grafana users](https://www.scaleway.com/en/docs/observability/cockpit/concepts/#grafana-users) in Scaleway Cockpit.
*
* Refer to Cockpit's [product documentation](https://www.scaleway.com/en/docs/observability/cockpit/concepts/) and [API documentation](https://www.scaleway.com/en/developers/api/cockpit/regional-api) for more information.
*
* ## Example Usage
*
* ### Migration to IAM Authentication
*
* Instead of managing Grafana users, retrieve your Grafana URL using the data source:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@pulumiverse/scaleway";
*
* // Old approach (deprecated)
* // resource "scaleway_cockpit_grafana_user" "main" {
* // project_id = scaleway_account_project.project.id
* // login = "my-awesome-user"
* // role = "editor"
* // }
* // New approach - Use IAM authentication
* const main = scaleway.observability.getGrafana({
* projectId: project.id,
* });
* export const grafanaUrl = main.then(main => main.grafanaUrl);
* ```
*
* ### Programmatic access with the Grafana provider
*
* To automate Grafana configuration (e.g., dashboards, alerting) with Terraform, reuse your Scaleway IAM secret as an `X-Auth-Token` header. The Grafana provider must run in `anonymous` mode because user/password authentication is deprecated.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@pulumiverse/scaleway";
*
* const config = new pulumi.Config();
* // Scaleway IAM secret key used for both the Scaleway and Grafana providers
* const scalewaySecretKey = config.require("scalewaySecretKey");
* const main = scaleway.observability.getGrafana({
* projectId: project.id,
* });
* ```
*
* The header `X-Auth-Token` is mandatory when Grafana users are disabled. Store the IAM secret key securely (environment variable, secrets manager, etc.) and avoid committing it to version control.
*
* ### Create a Grafana user (Deprecated)
*
* The following command allows you to create a Grafana user within a specific Scaleway Project.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@pulumiverse/scaleway";
*
* const project = new scaleway.account.Project("project", {name: "test project grafana user"});
* const main = new scaleway.observability.GrafanaUser("main", {
* projectId: project.id,
* login: "my-awesome-user",
* role: "editor",
* });
* ```
*
* ## Import
*
* This section explains how to import Grafana users using the ID of the Project associated with Cockpit, and the Grafana user ID in the `{project_id}/{grafana_user_id}` format.
*
* ```sh
* $ pulumi import scaleway:observability/grafanaUser:GrafanaUser main 11111111-1111-1111-1111-111111111111/2
* ```
*/
class GrafanaUser extends pulumi.CustomResource {
/**
* Get an existing GrafanaUser 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 GrafanaUser(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'scaleway:observability/grafanaUser:GrafanaUser';
/**
* Returns true if the given object is an instance of GrafanaUser. 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'] === GrafanaUser.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["grafanaUrl"] = state?.grafanaUrl;
resourceInputs["login"] = state?.login;
resourceInputs["password"] = state?.password;
resourceInputs["projectId"] = state?.projectId;
resourceInputs["role"] = state?.role;
}
else {
const args = argsOrState;
if (args?.login === undefined && !opts.urn) {
throw new Error("Missing required property 'login'");
}
if (args?.role === undefined && !opts.urn) {
throw new Error("Missing required property 'role'");
}
resourceInputs["login"] = args?.login;
resourceInputs["projectId"] = args?.projectId;
resourceInputs["role"] = args?.role;
resourceInputs["grafanaUrl"] = undefined /*out*/;
resourceInputs["password"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const aliasOpts = { aliases: [{ type: "scaleway:index/cockpitGrafanaUser:CockpitGrafanaUser" }] };
opts = pulumi.mergeOptions(opts, aliasOpts);
const secretOpts = { additionalSecretOutputs: ["password"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(GrafanaUser.__pulumiType, name, resourceInputs, opts);
}
}
exports.GrafanaUser = GrafanaUser;
//# sourceMappingURL=grafanaUser.js.map