@pulumiverse/grafana
Version:
A Pulumi package for creating and managing grafana.
175 lines • 7.63 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.SsoSettings = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manages Grafana SSO Settings for OAuth2, SAML and LDAP. Support for LDAP is currently in preview, it will be available in Grafana starting with v11.3.
*
* * [Official documentation](https://grafana.com/docs/grafana/latest/setup-grafana/configure-security/configure-authentication/)
* * [HTTP API](https://grafana.com/docs/grafana/latest/developers/http_api/sso-settings/)
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as grafana from "@pulumiverse/grafana";
*
* // Configure SSO for GitHub using OAuth2
* const githubSsoSettings = new grafana.oss.SsoSettings("github_sso_settings", {
* providerName: "github",
* oauth2Settings: {
* name: "Github",
* clientId: "<your GitHub app client id>",
* clientSecret: "<your GitHub app client secret>",
* allowSignUp: true,
* autoLogin: false,
* scopes: "user:email,read:org",
* teamIds: "150,300",
* allowedOrganizations: "[\"My Organization\", \"Octocats\"]",
* allowedDomains: "mycompany.com mycompany.org",
* },
* });
* // Configure SSO using generic OAuth2
* const genericSsoSettings = new grafana.oss.SsoSettings("generic_sso_settings", {
* providerName: "generic_oauth",
* oauth2Settings: {
* name: "Auth0",
* authUrl: "https://<domain>/authorize",
* tokenUrl: "https://<domain>/oauth/token",
* apiUrl: "https://<domain>/userinfo",
* clientId: "<client id>",
* clientSecret: "<client secret>",
* allowSignUp: true,
* autoLogin: false,
* scopes: "openid profile email offline_access",
* usePkce: true,
* useRefreshToken: true,
* },
* });
* // Configure SSO using SAML
* const samlSsoSettings = new grafana.oss.SsoSettings("saml_sso_settings", {
* providerName: "saml",
* samlSettings: {
* allowSignUp: true,
* certificatePath: "devenv/docker/blocks/auth/saml-enterprise/cert.crt",
* privateKeyPath: "devenv/docker/blocks/auth/saml-enterprise/key.pem",
* idpMetadataUrl: "https://nexus.microsoftonline-p.com/federationmetadata/saml20/federationmetadata.xml",
* signatureAlgorithm: "rsa-sha256",
* assertionAttributeLogin: "login",
* assertionAttributeEmail: "email",
* nameIdFormat: "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress",
* },
* });
* // Configure SSO using LDAP
* const ldapSsoSettings = new grafana.oss.SsoSettings("ldap_sso_settings", {
* providerName: "ldap",
* ldapSettings: {
* enabled: true,
* config: {
* servers: [{
* host: "127.0.0.1",
* port: 389,
* searchFilter: "(cn=%s)",
* bindDn: "cn=admin,dc=grafana,dc=org",
* bindPassword: "grafana",
* searchBaseDns: ["dc=grafana,dc=org"],
* attributes: {
* name: "givenName",
* surname: "sn",
* username: "cn",
* member_of: "memberOf",
* email: "email",
* },
* groupMappings: [
* {
* groupDn: "cn=superadmins,dc=grafana,dc=org",
* orgRole: "Admin",
* orgId: 1,
* grafanaAdmin: true,
* },
* {
* groupDn: "cn=users,dc=grafana,dc=org",
* orgRole: "Editor",
* },
* {
* groupDn: "*",
* orgRole: "Viewer",
* },
* ],
* }],
* },
* },
* });
* ```
*
* ## Import
*
* ```sh
* $ pulumi import grafana:index/ssoSettings:SsoSettings name "{{ provider }}"
* ```
*
* ```sh
* $ pulumi import grafana:index/ssoSettings:SsoSettings name "{{ orgID }}:{{ provider }}"
* ```
*
* @deprecated grafana.index/ssosettings.SsoSettings has been deprecated in favor of grafana.oss/ssosettings.SsoSettings
*/
class SsoSettings extends pulumi.CustomResource {
/**
* Get an existing SsoSettings 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) {
pulumi.log.warn("SsoSettings is deprecated: grafana.index/ssosettings.SsoSettings has been deprecated in favor of grafana.oss/ssosettings.SsoSettings");
return new SsoSettings(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of SsoSettings. 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'] === SsoSettings.__pulumiType;
}
/** @deprecated grafana.index/ssosettings.SsoSettings has been deprecated in favor of grafana.oss/ssosettings.SsoSettings */
constructor(name, argsOrState, opts) {
pulumi.log.warn("SsoSettings is deprecated: grafana.index/ssosettings.SsoSettings has been deprecated in favor of grafana.oss/ssosettings.SsoSettings");
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["ldapSettings"] = state ? state.ldapSettings : undefined;
resourceInputs["oauth2Settings"] = state ? state.oauth2Settings : undefined;
resourceInputs["providerName"] = state ? state.providerName : undefined;
resourceInputs["samlSettings"] = state ? state.samlSettings : undefined;
}
else {
const args = argsOrState;
if ((!args || args.providerName === undefined) && !opts.urn) {
throw new Error("Missing required property 'providerName'");
}
resourceInputs["ldapSettings"] = args ? args.ldapSettings : undefined;
resourceInputs["oauth2Settings"] = args ? args.oauth2Settings : undefined;
resourceInputs["providerName"] = args ? args.providerName : undefined;
resourceInputs["samlSettings"] = args ? args.samlSettings : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const aliasOpts = { aliases: [{ type: "grafana:index/ssoSettings:SsoSettings" }] };
opts = pulumi.mergeOptions(opts, aliasOpts);
super(SsoSettings.__pulumiType, name, resourceInputs, opts);
}
}
exports.SsoSettings = SsoSettings;
/** @internal */
SsoSettings.__pulumiType = 'grafana:index/ssoSettings:SsoSettings';
//# sourceMappingURL=ssoSettings.js.map