grafana logo
Grafana v0.0.10, May 21 23

grafana.Organization

Explore with Pulumi AI

This resource represents an instance-scoped resource and uses Grafana’s admin APIs. It does not work with API tokens or service accounts which are org-scoped. You must use basic auth.

Example Usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Grafana = Lbrlabs.PulumiPackage.Grafana;

return await Deployment.RunAsync(() => 
{
    var test = new Grafana.Organization("test", new()
    {
        AdminUser = "admin",
        Admins = new[]
        {
            "admin@example.com",
        },
        CreateUsers = true,
        Editors = new[]
        {
            "editor-01@example.com",
            "editor-02@example.com",
        },
        Viewers = new[]
        {
            "viewer-01@example.com",
            "viewer-02@example.com",
        },
    });

});
package main

import (
	"github.com/lbrlabs/pulumi-grafana/sdk/go/grafana"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := grafana.NewOrganization(ctx, "test", &grafana.OrganizationArgs{
			AdminUser: pulumi.String("admin"),
			Admins: pulumi.StringArray{
				pulumi.String("admin@example.com"),
			},
			CreateUsers: pulumi.Bool(true),
			Editors: pulumi.StringArray{
				pulumi.String("editor-01@example.com"),
				pulumi.String("editor-02@example.com"),
			},
			Viewers: pulumi.StringArray{
				pulumi.String("viewer-01@example.com"),
				pulumi.String("viewer-02@example.com"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.grafana.Organization;
import com.pulumi.grafana.OrganizationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var test = new Organization("test", OrganizationArgs.builder()        
            .adminUser("admin")
            .admins("admin@example.com")
            .createUsers(true)
            .editors(            
                "editor-01@example.com",
                "editor-02@example.com")
            .viewers(            
                "viewer-01@example.com",
                "viewer-02@example.com")
            .build());

    }
}
import pulumi
import lbrlabs_pulumi_grafana as grafana

test = grafana.Organization("test",
    admin_user="admin",
    admins=["admin@example.com"],
    create_users=True,
    editors=[
        "editor-01@example.com",
        "editor-02@example.com",
    ],
    viewers=[
        "viewer-01@example.com",
        "viewer-02@example.com",
    ])
import * as pulumi from "@pulumi/pulumi";
import * as grafana from "@lbrlabs/pulumi-grafana";

const test = new grafana.Organization("test", {
    adminUser: "admin",
    admins: ["admin@example.com"],
    createUsers: true,
    editors: [
        "editor-01@example.com",
        "editor-02@example.com",
    ],
    viewers: [
        "viewer-01@example.com",
        "viewer-02@example.com",
    ],
});
resources:
  test:
    type: grafana:Organization
    properties:
      adminUser: admin
      admins:
        - admin@example.com
      createUsers: true
      editors:
        - editor-01@example.com
        - editor-02@example.com
      viewers:
        - viewer-01@example.com
        - viewer-02@example.com

Create Organization Resource

new Organization(name: string, args?: OrganizationArgs, opts?: CustomResourceOptions);
@overload
def Organization(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 admin_user: Optional[str] = None,
                 admins: Optional[Sequence[str]] = None,
                 create_users: Optional[bool] = None,
                 editors: Optional[Sequence[str]] = None,
                 name: Optional[str] = None,
                 viewers: Optional[Sequence[str]] = None)
@overload
def Organization(resource_name: str,
                 args: Optional[OrganizationArgs] = None,
                 opts: Optional[ResourceOptions] = None)
func NewOrganization(ctx *Context, name string, args *OrganizationArgs, opts ...ResourceOption) (*Organization, error)
public Organization(string name, OrganizationArgs? args = null, CustomResourceOptions? opts = null)
public Organization(String name, OrganizationArgs args)
public Organization(String name, OrganizationArgs args, CustomResourceOptions options)
type: grafana:Organization
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args OrganizationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args OrganizationArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args OrganizationArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args OrganizationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args OrganizationArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Organization Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Organization resource accepts the following input properties:

AdminUser string

The login name of the configured default admin user for the Grafana installation. If unset, this value defaults to admin, the Grafana default. Grafana adds the default admin user to all organizations automatically upon creation, and this parameter keeps Terraform from removing it from organizations.

Admins List<string>

A list of email addresses corresponding to users who should be given admin access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

CreateUsers bool

Whether or not to create Grafana users specified in the organization's membership if they don't already exist in Grafana. If unspecified, this parameter defaults to true, creating placeholder users with the name, login, and email set to the email of the user, and a random password. Setting this option to false will cause an error to be thrown for any users that do not already exist in Grafana. Defaults to true.

Editors List<string>

A list of email addresses corresponding to users who should be given editor access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

Name string

The display name for the Grafana organization created.

Viewers List<string>

A list of email addresses corresponding to users who should be given viewer access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

AdminUser string

The login name of the configured default admin user for the Grafana installation. If unset, this value defaults to admin, the Grafana default. Grafana adds the default admin user to all organizations automatically upon creation, and this parameter keeps Terraform from removing it from organizations.

Admins []string

A list of email addresses corresponding to users who should be given admin access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

CreateUsers bool

Whether or not to create Grafana users specified in the organization's membership if they don't already exist in Grafana. If unspecified, this parameter defaults to true, creating placeholder users with the name, login, and email set to the email of the user, and a random password. Setting this option to false will cause an error to be thrown for any users that do not already exist in Grafana. Defaults to true.

Editors []string

A list of email addresses corresponding to users who should be given editor access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

Name string

The display name for the Grafana organization created.

Viewers []string

A list of email addresses corresponding to users who should be given viewer access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

adminUser String

The login name of the configured default admin user for the Grafana installation. If unset, this value defaults to admin, the Grafana default. Grafana adds the default admin user to all organizations automatically upon creation, and this parameter keeps Terraform from removing it from organizations.

admins List<String>

A list of email addresses corresponding to users who should be given admin access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

createUsers Boolean

Whether or not to create Grafana users specified in the organization's membership if they don't already exist in Grafana. If unspecified, this parameter defaults to true, creating placeholder users with the name, login, and email set to the email of the user, and a random password. Setting this option to false will cause an error to be thrown for any users that do not already exist in Grafana. Defaults to true.

editors List<String>

A list of email addresses corresponding to users who should be given editor access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

name String

The display name for the Grafana organization created.

viewers List<String>

A list of email addresses corresponding to users who should be given viewer access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

adminUser string

The login name of the configured default admin user for the Grafana installation. If unset, this value defaults to admin, the Grafana default. Grafana adds the default admin user to all organizations automatically upon creation, and this parameter keeps Terraform from removing it from organizations.

admins string[]

A list of email addresses corresponding to users who should be given admin access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

createUsers boolean

Whether or not to create Grafana users specified in the organization's membership if they don't already exist in Grafana. If unspecified, this parameter defaults to true, creating placeholder users with the name, login, and email set to the email of the user, and a random password. Setting this option to false will cause an error to be thrown for any users that do not already exist in Grafana. Defaults to true.

editors string[]

A list of email addresses corresponding to users who should be given editor access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

name string

The display name for the Grafana organization created.

viewers string[]

A list of email addresses corresponding to users who should be given viewer access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

admin_user str

The login name of the configured default admin user for the Grafana installation. If unset, this value defaults to admin, the Grafana default. Grafana adds the default admin user to all organizations automatically upon creation, and this parameter keeps Terraform from removing it from organizations.

admins Sequence[str]

A list of email addresses corresponding to users who should be given admin access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

create_users bool

Whether or not to create Grafana users specified in the organization's membership if they don't already exist in Grafana. If unspecified, this parameter defaults to true, creating placeholder users with the name, login, and email set to the email of the user, and a random password. Setting this option to false will cause an error to be thrown for any users that do not already exist in Grafana. Defaults to true.

editors Sequence[str]

A list of email addresses corresponding to users who should be given editor access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

name str

The display name for the Grafana organization created.

viewers Sequence[str]

A list of email addresses corresponding to users who should be given viewer access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

adminUser String

The login name of the configured default admin user for the Grafana installation. If unset, this value defaults to admin, the Grafana default. Grafana adds the default admin user to all organizations automatically upon creation, and this parameter keeps Terraform from removing it from organizations.

admins List<String>

A list of email addresses corresponding to users who should be given admin access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

createUsers Boolean

Whether or not to create Grafana users specified in the organization's membership if they don't already exist in Grafana. If unspecified, this parameter defaults to true, creating placeholder users with the name, login, and email set to the email of the user, and a random password. Setting this option to false will cause an error to be thrown for any users that do not already exist in Grafana. Defaults to true.

editors List<String>

A list of email addresses corresponding to users who should be given editor access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

name String

The display name for the Grafana organization created.

viewers List<String>

A list of email addresses corresponding to users who should be given viewer access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

Outputs

All input properties are implicitly available as output properties. Additionally, the Organization resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

OrgId int

The organization id assigned to this organization by Grafana.

Id string

The provider-assigned unique ID for this managed resource.

OrgId int

The organization id assigned to this organization by Grafana.

id String

The provider-assigned unique ID for this managed resource.

orgId Integer

The organization id assigned to this organization by Grafana.

id string

The provider-assigned unique ID for this managed resource.

orgId number

The organization id assigned to this organization by Grafana.

id str

The provider-assigned unique ID for this managed resource.

org_id int

The organization id assigned to this organization by Grafana.

id String

The provider-assigned unique ID for this managed resource.

orgId Number

The organization id assigned to this organization by Grafana.

Look up Existing Organization Resource

Get an existing Organization resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: OrganizationState, opts?: CustomResourceOptions): Organization
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        admin_user: Optional[str] = None,
        admins: Optional[Sequence[str]] = None,
        create_users: Optional[bool] = None,
        editors: Optional[Sequence[str]] = None,
        name: Optional[str] = None,
        org_id: Optional[int] = None,
        viewers: Optional[Sequence[str]] = None) -> Organization
func GetOrganization(ctx *Context, name string, id IDInput, state *OrganizationState, opts ...ResourceOption) (*Organization, error)
public static Organization Get(string name, Input<string> id, OrganizationState? state, CustomResourceOptions? opts = null)
public static Organization get(String name, Output<String> id, OrganizationState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AdminUser string

The login name of the configured default admin user for the Grafana installation. If unset, this value defaults to admin, the Grafana default. Grafana adds the default admin user to all organizations automatically upon creation, and this parameter keeps Terraform from removing it from organizations.

Admins List<string>

A list of email addresses corresponding to users who should be given admin access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

CreateUsers bool

Whether or not to create Grafana users specified in the organization's membership if they don't already exist in Grafana. If unspecified, this parameter defaults to true, creating placeholder users with the name, login, and email set to the email of the user, and a random password. Setting this option to false will cause an error to be thrown for any users that do not already exist in Grafana. Defaults to true.

Editors List<string>

A list of email addresses corresponding to users who should be given editor access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

Name string

The display name for the Grafana organization created.

OrgId int

The organization id assigned to this organization by Grafana.

Viewers List<string>

A list of email addresses corresponding to users who should be given viewer access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

AdminUser string

The login name of the configured default admin user for the Grafana installation. If unset, this value defaults to admin, the Grafana default. Grafana adds the default admin user to all organizations automatically upon creation, and this parameter keeps Terraform from removing it from organizations.

Admins []string

A list of email addresses corresponding to users who should be given admin access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

CreateUsers bool

Whether or not to create Grafana users specified in the organization's membership if they don't already exist in Grafana. If unspecified, this parameter defaults to true, creating placeholder users with the name, login, and email set to the email of the user, and a random password. Setting this option to false will cause an error to be thrown for any users that do not already exist in Grafana. Defaults to true.

Editors []string

A list of email addresses corresponding to users who should be given editor access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

Name string

The display name for the Grafana organization created.

OrgId int

The organization id assigned to this organization by Grafana.

Viewers []string

A list of email addresses corresponding to users who should be given viewer access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

adminUser String

The login name of the configured default admin user for the Grafana installation. If unset, this value defaults to admin, the Grafana default. Grafana adds the default admin user to all organizations automatically upon creation, and this parameter keeps Terraform from removing it from organizations.

admins List<String>

A list of email addresses corresponding to users who should be given admin access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

createUsers Boolean

Whether or not to create Grafana users specified in the organization's membership if they don't already exist in Grafana. If unspecified, this parameter defaults to true, creating placeholder users with the name, login, and email set to the email of the user, and a random password. Setting this option to false will cause an error to be thrown for any users that do not already exist in Grafana. Defaults to true.

editors List<String>

A list of email addresses corresponding to users who should be given editor access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

name String

The display name for the Grafana organization created.

orgId Integer

The organization id assigned to this organization by Grafana.

viewers List<String>

A list of email addresses corresponding to users who should be given viewer access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

adminUser string

The login name of the configured default admin user for the Grafana installation. If unset, this value defaults to admin, the Grafana default. Grafana adds the default admin user to all organizations automatically upon creation, and this parameter keeps Terraform from removing it from organizations.

admins string[]

A list of email addresses corresponding to users who should be given admin access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

createUsers boolean

Whether or not to create Grafana users specified in the organization's membership if they don't already exist in Grafana. If unspecified, this parameter defaults to true, creating placeholder users with the name, login, and email set to the email of the user, and a random password. Setting this option to false will cause an error to be thrown for any users that do not already exist in Grafana. Defaults to true.

editors string[]

A list of email addresses corresponding to users who should be given editor access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

name string

The display name for the Grafana organization created.

orgId number

The organization id assigned to this organization by Grafana.

viewers string[]

A list of email addresses corresponding to users who should be given viewer access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

admin_user str

The login name of the configured default admin user for the Grafana installation. If unset, this value defaults to admin, the Grafana default. Grafana adds the default admin user to all organizations automatically upon creation, and this parameter keeps Terraform from removing it from organizations.

admins Sequence[str]

A list of email addresses corresponding to users who should be given admin access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

create_users bool

Whether or not to create Grafana users specified in the organization's membership if they don't already exist in Grafana. If unspecified, this parameter defaults to true, creating placeholder users with the name, login, and email set to the email of the user, and a random password. Setting this option to false will cause an error to be thrown for any users that do not already exist in Grafana. Defaults to true.

editors Sequence[str]

A list of email addresses corresponding to users who should be given editor access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

name str

The display name for the Grafana organization created.

org_id int

The organization id assigned to this organization by Grafana.

viewers Sequence[str]

A list of email addresses corresponding to users who should be given viewer access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

adminUser String

The login name of the configured default admin user for the Grafana installation. If unset, this value defaults to admin, the Grafana default. Grafana adds the default admin user to all organizations automatically upon creation, and this parameter keeps Terraform from removing it from organizations.

admins List<String>

A list of email addresses corresponding to users who should be given admin access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

createUsers Boolean

Whether or not to create Grafana users specified in the organization's membership if they don't already exist in Grafana. If unspecified, this parameter defaults to true, creating placeholder users with the name, login, and email set to the email of the user, and a random password. Setting this option to false will cause an error to be thrown for any users that do not already exist in Grafana. Defaults to true.

editors List<String>

A list of email addresses corresponding to users who should be given editor access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

name String

The display name for the Grafana organization created.

orgId Number

The organization id assigned to this organization by Grafana.

viewers List<String>

A list of email addresses corresponding to users who should be given viewer access to the organization. Note: users specified here must already exist in Grafana unless 'create_users' is set to true.

Import

 $ pulumi import grafana:index/organization:Organization org_name {{org_id}}

Package Details

Repository
grafana lbrlabs/pulumi-grafana
License
Apache-2.0
Notes

This Pulumi package is based on the grafana Terraform Provider.