grafana.ServiceAccountPermission

Explore with Pulumi AI

Note: This resource is available from Grafana 9.2.4 onwards.

Example Usage

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

return await Deployment.RunAsync(() => 
{
    var test = new Grafana.ServiceAccount("test", new()
    {
        Role = "Editor",
        IsDisabled = false,
    });

    var testTeam = new Grafana.Team("testTeam");

    var testUser = new Grafana.User("testUser", new()
    {
        Email = "tf_user@test.com",
        Login = "tf_user@test.com",
        Password = "password",
    });

    var testPermissions = new Grafana.ServiceAccountPermission("testPermissions", new()
    {
        ServiceAccountId = test.Id,
        Permissions = new[]
        {
            new Grafana.Inputs.ServiceAccountPermissionPermissionArgs
            {
                UserId = testUser.Id,
                Permission = "Edit",
            },
            new Grafana.Inputs.ServiceAccountPermissionPermissionArgs
            {
                TeamId = testTeam.Id,
                Permission = "Admin",
            },
        },
    });

});
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 {
		test, err := grafana.NewServiceAccount(ctx, "test", &grafana.ServiceAccountArgs{
			Role:       pulumi.String("Editor"),
			IsDisabled: pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		testTeam, err := grafana.NewTeam(ctx, "testTeam", nil)
		if err != nil {
			return err
		}
		testUser, err := grafana.NewUser(ctx, "testUser", &grafana.UserArgs{
			Email:    pulumi.String("tf_user@test.com"),
			Login:    pulumi.String("tf_user@test.com"),
			Password: pulumi.String("password"),
		})
		if err != nil {
			return err
		}
		_, err = grafana.NewServiceAccountPermission(ctx, "testPermissions", &grafana.ServiceAccountPermissionArgs{
			ServiceAccountId: test.ID(),
			Permissions: grafana.ServiceAccountPermissionPermissionArray{
				&grafana.ServiceAccountPermissionPermissionArgs{
					UserId:     testUser.ID(),
					Permission: pulumi.String("Edit"),
				},
				&grafana.ServiceAccountPermissionPermissionArgs{
					TeamId:     testTeam.ID(),
					Permission: pulumi.String("Admin"),
				},
			},
		})
		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.ServiceAccount;
import com.pulumi.grafana.ServiceAccountArgs;
import com.pulumi.grafana.Team;
import com.pulumi.grafana.User;
import com.pulumi.grafana.UserArgs;
import com.pulumi.grafana.ServiceAccountPermission;
import com.pulumi.grafana.ServiceAccountPermissionArgs;
import com.pulumi.grafana.inputs.ServiceAccountPermissionPermissionArgs;
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 ServiceAccount("test", ServiceAccountArgs.builder()        
            .role("Editor")
            .isDisabled(false)
            .build());

        var testTeam = new Team("testTeam");

        var testUser = new User("testUser", UserArgs.builder()        
            .email("tf_user@test.com")
            .login("tf_user@test.com")
            .password("password")
            .build());

        var testPermissions = new ServiceAccountPermission("testPermissions", ServiceAccountPermissionArgs.builder()        
            .serviceAccountId(test.id())
            .permissions(            
                ServiceAccountPermissionPermissionArgs.builder()
                    .userId(testUser.id())
                    .permission("Edit")
                    .build(),
                ServiceAccountPermissionPermissionArgs.builder()
                    .teamId(testTeam.id())
                    .permission("Admin")
                    .build())
            .build());

    }
}
import pulumi
import lbrlabs_pulumi_grafana as grafana

test = grafana.ServiceAccount("test",
    role="Editor",
    is_disabled=False)
test_team = grafana.Team("testTeam")
test_user = grafana.User("testUser",
    email="tf_user@test.com",
    login="tf_user@test.com",
    password="password")
test_permissions = grafana.ServiceAccountPermission("testPermissions",
    service_account_id=test.id,
    permissions=[
        grafana.ServiceAccountPermissionPermissionArgs(
            user_id=test_user.id,
            permission="Edit",
        ),
        grafana.ServiceAccountPermissionPermissionArgs(
            team_id=test_team.id,
            permission="Admin",
        ),
    ])
import * as pulumi from "@pulumi/pulumi";
import * as grafana from "@lbrlabs/pulumi-grafana";

const test = new grafana.ServiceAccount("test", {
    role: "Editor",
    isDisabled: false,
});
const testTeam = new grafana.Team("testTeam", {});
const testUser = new grafana.User("testUser", {
    email: "tf_user@test.com",
    login: "tf_user@test.com",
    password: "password",
});
const testPermissions = new grafana.ServiceAccountPermission("testPermissions", {
    serviceAccountId: test.id,
    permissions: [
        {
            userId: testUser.id,
            permission: "Edit",
        },
        {
            teamId: testTeam.id,
            permission: "Admin",
        },
    ],
});
resources:
  test:
    type: grafana:ServiceAccount
    properties:
      role: Editor
      isDisabled: false
  testTeam:
    type: grafana:Team
  testUser:
    type: grafana:User
    properties:
      email: tf_user@test.com
      login: tf_user@test.com
      password: password
  testPermissions:
    type: grafana:ServiceAccountPermission
    properties:
      serviceAccountId: ${test.id}
      permissions:
        - userId: ${testUser.id}
          permission: Edit
        - teamId: ${testTeam.id}
          permission: Admin

Create ServiceAccountPermission Resource

new ServiceAccountPermission(name: string, args: ServiceAccountPermissionArgs, opts?: CustomResourceOptions);
@overload
def ServiceAccountPermission(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             permissions: Optional[Sequence[ServiceAccountPermissionPermissionArgs]] = None,
                             service_account_id: Optional[str] = None)
@overload
def ServiceAccountPermission(resource_name: str,
                             args: ServiceAccountPermissionArgs,
                             opts: Optional[ResourceOptions] = None)
func NewServiceAccountPermission(ctx *Context, name string, args ServiceAccountPermissionArgs, opts ...ResourceOption) (*ServiceAccountPermission, error)
public ServiceAccountPermission(string name, ServiceAccountPermissionArgs args, CustomResourceOptions? opts = null)
public ServiceAccountPermission(String name, ServiceAccountPermissionArgs args)
public ServiceAccountPermission(String name, ServiceAccountPermissionArgs args, CustomResourceOptions options)
type: grafana:ServiceAccountPermission
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args ServiceAccountPermissionArgs
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 ServiceAccountPermissionArgs
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 ServiceAccountPermissionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ServiceAccountPermissionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ServiceAccountPermissionArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

ServiceAccountPermission 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 ServiceAccountPermission resource accepts the following input properties:

Permissions List<Lbrlabs.PulumiPackage.Grafana.Inputs.ServiceAccountPermissionPermissionArgs>

The permission items to add/update. Items that are omitted from the list will be removed.

ServiceAccountId string

The id of the service account.

Permissions []ServiceAccountPermissionPermissionArgs

The permission items to add/update. Items that are omitted from the list will be removed.

ServiceAccountId string

The id of the service account.

permissions List<ServiceAccountPermissionPermissionArgs>

The permission items to add/update. Items that are omitted from the list will be removed.

serviceAccountId String

The id of the service account.

permissions ServiceAccountPermissionPermissionArgs[]

The permission items to add/update. Items that are omitted from the list will be removed.

serviceAccountId string

The id of the service account.

permissions Sequence[ServiceAccountPermissionPermissionArgs]

The permission items to add/update. Items that are omitted from the list will be removed.

service_account_id str

The id of the service account.

permissions List<Property Map>

The permission items to add/update. Items that are omitted from the list will be removed.

serviceAccountId String

The id of the service account.

Outputs

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

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing ServiceAccountPermission Resource

Get an existing ServiceAccountPermission 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?: ServiceAccountPermissionState, opts?: CustomResourceOptions): ServiceAccountPermission
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        permissions: Optional[Sequence[ServiceAccountPermissionPermissionArgs]] = None,
        service_account_id: Optional[str] = None) -> ServiceAccountPermission
func GetServiceAccountPermission(ctx *Context, name string, id IDInput, state *ServiceAccountPermissionState, opts ...ResourceOption) (*ServiceAccountPermission, error)
public static ServiceAccountPermission Get(string name, Input<string> id, ServiceAccountPermissionState? state, CustomResourceOptions? opts = null)
public static ServiceAccountPermission get(String name, Output<String> id, ServiceAccountPermissionState 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:
Permissions List<Lbrlabs.PulumiPackage.Grafana.Inputs.ServiceAccountPermissionPermissionArgs>

The permission items to add/update. Items that are omitted from the list will be removed.

ServiceAccountId string

The id of the service account.

Permissions []ServiceAccountPermissionPermissionArgs

The permission items to add/update. Items that are omitted from the list will be removed.

ServiceAccountId string

The id of the service account.

permissions List<ServiceAccountPermissionPermissionArgs>

The permission items to add/update. Items that are omitted from the list will be removed.

serviceAccountId String

The id of the service account.

permissions ServiceAccountPermissionPermissionArgs[]

The permission items to add/update. Items that are omitted from the list will be removed.

serviceAccountId string

The id of the service account.

permissions Sequence[ServiceAccountPermissionPermissionArgs]

The permission items to add/update. Items that are omitted from the list will be removed.

service_account_id str

The id of the service account.

permissions List<Property Map>

The permission items to add/update. Items that are omitted from the list will be removed.

serviceAccountId String

The id of the service account.

Supporting Types

ServiceAccountPermissionPermission

Permission string

Permission to associate with item. Must be Edit or Admin.

TeamId int

ID of the team to manage permissions for. Specify either this or user_id. Defaults to 0.

UserId int

ID of the user to manage permissions for. Specify either this or team_id. Defaults to 0.

Permission string

Permission to associate with item. Must be Edit or Admin.

TeamId int

ID of the team to manage permissions for. Specify either this or user_id. Defaults to 0.

UserId int

ID of the user to manage permissions for. Specify either this or team_id. Defaults to 0.

permission String

Permission to associate with item. Must be Edit or Admin.

teamId Integer

ID of the team to manage permissions for. Specify either this or user_id. Defaults to 0.

userId Integer

ID of the user to manage permissions for. Specify either this or team_id. Defaults to 0.

permission string

Permission to associate with item. Must be Edit or Admin.

teamId number

ID of the team to manage permissions for. Specify either this or user_id. Defaults to 0.

userId number

ID of the user to manage permissions for. Specify either this or team_id. Defaults to 0.

permission str

Permission to associate with item. Must be Edit or Admin.

team_id int

ID of the team to manage permissions for. Specify either this or user_id. Defaults to 0.

user_id int

ID of the user to manage permissions for. Specify either this or team_id. Defaults to 0.

permission String

Permission to associate with item. Must be Edit or Admin.

teamId Number

ID of the team to manage permissions for. Specify either this or user_id. Defaults to 0.

userId Number

ID of the user to manage permissions for. Specify either this or team_id. Defaults to 0.

Package Details

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

This Pulumi package is based on the grafana Terraform Provider.