grafana.enterprise.RoleAssignmentItem
Explore with Pulumi AI
Manages a single assignment for a role. Conflicts with the “grafana.enterprise.RoleAssignment” resource which manages the entire set of assignments for a role.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as grafana from "@pulumiverse/grafana";
const testRole = new grafana.enterprise.Role("test_role", {
name: "Test Role",
uid: "testrole",
version: 1,
global: true,
permissions: [{
action: "org.users:add",
scope: "users:*",
}],
});
const testTeam = new grafana.oss.Team("test_team", {name: "terraform_test_team"});
const testUser = new grafana.oss.User("test_user", {
email: "terraform_user@test.com",
login: "terraform_user@test.com",
password: "password",
});
const testSa = new grafana.oss.ServiceAccount("test_sa", {
name: "terraform_test_sa",
role: "Viewer",
});
const user = new grafana.enterprise.RoleAssignmentItem("user", {
roleUid: testRole.uid,
userId: testUser.id,
});
const team = new grafana.enterprise.RoleAssignmentItem("team", {
roleUid: testRole.uid,
teamId: testTeam.id,
});
const serviceAccount = new grafana.enterprise.RoleAssignmentItem("service_account", {
roleUid: testRole.uid,
serviceAccountId: testSa.id,
});
import pulumi
import pulumiverse_grafana as grafana
test_role = grafana.enterprise.Role("test_role",
name="Test Role",
uid="testrole",
version=1,
global_=True,
permissions=[{
"action": "org.users:add",
"scope": "users:*",
}])
test_team = grafana.oss.Team("test_team", name="terraform_test_team")
test_user = grafana.oss.User("test_user",
email="terraform_user@test.com",
login="terraform_user@test.com",
password="password")
test_sa = grafana.oss.ServiceAccount("test_sa",
name="terraform_test_sa",
role="Viewer")
user = grafana.enterprise.RoleAssignmentItem("user",
role_uid=test_role.uid,
user_id=test_user.id)
team = grafana.enterprise.RoleAssignmentItem("team",
role_uid=test_role.uid,
team_id=test_team.id)
service_account = grafana.enterprise.RoleAssignmentItem("service_account",
role_uid=test_role.uid,
service_account_id=test_sa.id)
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-grafana/sdk/go/grafana/enterprise"
"github.com/pulumiverse/pulumi-grafana/sdk/go/grafana/oss"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
testRole, err := enterprise.NewRole(ctx, "test_role", &enterprise.RoleArgs{
Name: pulumi.String("Test Role"),
Uid: pulumi.String("testrole"),
Version: pulumi.Int(1),
Global: pulumi.Bool(true),
Permissions: enterprise.RolePermissionArray{
&enterprise.RolePermissionArgs{
Action: pulumi.String("org.users:add"),
Scope: pulumi.String("users:*"),
},
},
})
if err != nil {
return err
}
testTeam, err := oss.NewTeam(ctx, "test_team", &oss.TeamArgs{
Name: pulumi.String("terraform_test_team"),
})
if err != nil {
return err
}
testUser, err := oss.NewUser(ctx, "test_user", &oss.UserArgs{
Email: pulumi.String("terraform_user@test.com"),
Login: pulumi.String("terraform_user@test.com"),
Password: pulumi.String("password"),
})
if err != nil {
return err
}
testSa, err := oss.NewServiceAccount(ctx, "test_sa", &oss.ServiceAccountArgs{
Name: pulumi.String("terraform_test_sa"),
Role: pulumi.String("Viewer"),
})
if err != nil {
return err
}
_, err = enterprise.NewRoleAssignmentItem(ctx, "user", &enterprise.RoleAssignmentItemArgs{
RoleUid: testRole.Uid,
UserId: testUser.ID(),
})
if err != nil {
return err
}
_, err = enterprise.NewRoleAssignmentItem(ctx, "team", &enterprise.RoleAssignmentItemArgs{
RoleUid: testRole.Uid,
TeamId: testTeam.ID(),
})
if err != nil {
return err
}
_, err = enterprise.NewRoleAssignmentItem(ctx, "service_account", &enterprise.RoleAssignmentItemArgs{
RoleUid: testRole.Uid,
ServiceAccountId: testSa.ID(),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Grafana = Pulumiverse.Grafana;
return await Deployment.RunAsync(() =>
{
var testRole = new Grafana.Enterprise.Role("test_role", new()
{
Name = "Test Role",
Uid = "testrole",
Version = 1,
Global = true,
Permissions = new[]
{
new Grafana.Enterprise.Inputs.RolePermissionArgs
{
Action = "org.users:add",
Scope = "users:*",
},
},
});
var testTeam = new Grafana.Oss.Team("test_team", new()
{
Name = "terraform_test_team",
});
var testUser = new Grafana.Oss.User("test_user", new()
{
Email = "terraform_user@test.com",
Login = "terraform_user@test.com",
Password = "password",
});
var testSa = new Grafana.Oss.ServiceAccount("test_sa", new()
{
Name = "terraform_test_sa",
Role = "Viewer",
});
var user = new Grafana.Enterprise.RoleAssignmentItem("user", new()
{
RoleUid = testRole.Uid,
UserId = testUser.Id,
});
var team = new Grafana.Enterprise.RoleAssignmentItem("team", new()
{
RoleUid = testRole.Uid,
TeamId = testTeam.Id,
});
var serviceAccount = new Grafana.Enterprise.RoleAssignmentItem("service_account", new()
{
RoleUid = testRole.Uid,
ServiceAccountId = testSa.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.grafana.enterprise.Role;
import com.pulumi.grafana.enterprise.RoleArgs;
import com.pulumi.grafana.enterprise.inputs.RolePermissionArgs;
import com.pulumi.grafana.oss.Team;
import com.pulumi.grafana.oss.TeamArgs;
import com.pulumi.grafana.oss.User;
import com.pulumi.grafana.oss.UserArgs;
import com.pulumi.grafana.oss.ServiceAccount;
import com.pulumi.grafana.oss.ServiceAccountArgs;
import com.pulumi.grafana.enterprise.RoleAssignmentItem;
import com.pulumi.grafana.enterprise.RoleAssignmentItemArgs;
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 testRole = new Role("testRole", RoleArgs.builder()
.name("Test Role")
.uid("testrole")
.version(1)
.global(true)
.permissions(RolePermissionArgs.builder()
.action("org.users:add")
.scope("users:*")
.build())
.build());
var testTeam = new Team("testTeam", TeamArgs.builder()
.name("terraform_test_team")
.build());
var testUser = new User("testUser", UserArgs.builder()
.email("terraform_user@test.com")
.login("terraform_user@test.com")
.password("password")
.build());
var testSa = new ServiceAccount("testSa", ServiceAccountArgs.builder()
.name("terraform_test_sa")
.role("Viewer")
.build());
var user = new RoleAssignmentItem("user", RoleAssignmentItemArgs.builder()
.roleUid(testRole.uid())
.userId(testUser.id())
.build());
var team = new RoleAssignmentItem("team", RoleAssignmentItemArgs.builder()
.roleUid(testRole.uid())
.teamId(testTeam.id())
.build());
var serviceAccount = new RoleAssignmentItem("serviceAccount", RoleAssignmentItemArgs.builder()
.roleUid(testRole.uid())
.serviceAccountId(testSa.id())
.build());
}
}
resources:
testRole:
type: grafana:enterprise:Role
name: test_role
properties:
name: Test Role
uid: testrole
version: 1
global: true
permissions:
- action: org.users:add
scope: users:*
testTeam:
type: grafana:oss:Team
name: test_team
properties:
name: terraform_test_team
testUser:
type: grafana:oss:User
name: test_user
properties:
email: terraform_user@test.com
login: terraform_user@test.com
password: password
testSa:
type: grafana:oss:ServiceAccount
name: test_sa
properties:
name: terraform_test_sa
role: Viewer
user:
type: grafana:enterprise:RoleAssignmentItem
properties:
roleUid: ${testRole.uid}
userId: ${testUser.id}
team:
type: grafana:enterprise:RoleAssignmentItem
properties:
roleUid: ${testRole.uid}
teamId: ${testTeam.id}
serviceAccount:
type: grafana:enterprise:RoleAssignmentItem
name: service_account
properties:
roleUid: ${testRole.uid}
serviceAccountId: ${testSa.id}
Create RoleAssignmentItem Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RoleAssignmentItem(name: string, args: RoleAssignmentItemArgs, opts?: CustomResourceOptions);
@overload
def RoleAssignmentItem(resource_name: str,
args: RoleAssignmentItemArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RoleAssignmentItem(resource_name: str,
opts: Optional[ResourceOptions] = None,
role_uid: Optional[str] = None,
org_id: Optional[str] = None,
service_account_id: Optional[str] = None,
team_id: Optional[str] = None,
user_id: Optional[str] = None)
func NewRoleAssignmentItem(ctx *Context, name string, args RoleAssignmentItemArgs, opts ...ResourceOption) (*RoleAssignmentItem, error)
public RoleAssignmentItem(string name, RoleAssignmentItemArgs args, CustomResourceOptions? opts = null)
public RoleAssignmentItem(String name, RoleAssignmentItemArgs args)
public RoleAssignmentItem(String name, RoleAssignmentItemArgs args, CustomResourceOptions options)
type: grafana:enterprise:RoleAssignmentItem
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args RoleAssignmentItemArgs
- 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 RoleAssignmentItemArgs
- 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 RoleAssignmentItemArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RoleAssignmentItemArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RoleAssignmentItemArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var roleAssignmentItemResource = new Grafana.Enterprise.RoleAssignmentItem("roleAssignmentItemResource", new()
{
RoleUid = "string",
OrgId = "string",
ServiceAccountId = "string",
TeamId = "string",
UserId = "string",
});
example, err := enterprise.NewRoleAssignmentItem(ctx, "roleAssignmentItemResource", &enterprise.RoleAssignmentItemArgs{
RoleUid: pulumi.String("string"),
OrgId: pulumi.String("string"),
ServiceAccountId: pulumi.String("string"),
TeamId: pulumi.String("string"),
UserId: pulumi.String("string"),
})
var roleAssignmentItemResource = new RoleAssignmentItem("roleAssignmentItemResource", RoleAssignmentItemArgs.builder()
.roleUid("string")
.orgId("string")
.serviceAccountId("string")
.teamId("string")
.userId("string")
.build());
role_assignment_item_resource = grafana.enterprise.RoleAssignmentItem("roleAssignmentItemResource",
role_uid="string",
org_id="string",
service_account_id="string",
team_id="string",
user_id="string")
const roleAssignmentItemResource = new grafana.enterprise.RoleAssignmentItem("roleAssignmentItemResource", {
roleUid: "string",
orgId: "string",
serviceAccountId: "string",
teamId: "string",
userId: "string",
});
type: grafana:enterprise:RoleAssignmentItem
properties:
orgId: string
roleUid: string
serviceAccountId: string
teamId: string
userId: string
RoleAssignmentItem Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The RoleAssignmentItem resource accepts the following input properties:
- Role
Uid string - the role UID onto which to assign an actor
- Org
Id string - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- Service
Account stringId - the service account onto which the role is to be assigned
- Team
Id string - the team onto which the role is to be assigned
- User
Id string - the user onto which the role is to be assigned
- Role
Uid string - the role UID onto which to assign an actor
- Org
Id string - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- Service
Account stringId - the service account onto which the role is to be assigned
- Team
Id string - the team onto which the role is to be assigned
- User
Id string - the user onto which the role is to be assigned
- role
Uid String - the role UID onto which to assign an actor
- org
Id String - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- service
Account StringId - the service account onto which the role is to be assigned
- team
Id String - the team onto which the role is to be assigned
- user
Id String - the user onto which the role is to be assigned
- role
Uid string - the role UID onto which to assign an actor
- org
Id string - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- service
Account stringId - the service account onto which the role is to be assigned
- team
Id string - the team onto which the role is to be assigned
- user
Id string - the user onto which the role is to be assigned
- role_
uid str - the role UID onto which to assign an actor
- org_
id str - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- service_
account_ strid - the service account onto which the role is to be assigned
- team_
id str - the team onto which the role is to be assigned
- user_
id str - the user onto which the role is to be assigned
- role
Uid String - the role UID onto which to assign an actor
- org
Id String - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- service
Account StringId - the service account onto which the role is to be assigned
- team
Id String - the team onto which the role is to be assigned
- user
Id String - the user onto which the role is to be assigned
Outputs
All input properties are implicitly available as output properties. Additionally, the RoleAssignmentItem 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 RoleAssignmentItem Resource
Get an existing RoleAssignmentItem 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?: RoleAssignmentItemState, opts?: CustomResourceOptions): RoleAssignmentItem
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
org_id: Optional[str] = None,
role_uid: Optional[str] = None,
service_account_id: Optional[str] = None,
team_id: Optional[str] = None,
user_id: Optional[str] = None) -> RoleAssignmentItem
func GetRoleAssignmentItem(ctx *Context, name string, id IDInput, state *RoleAssignmentItemState, opts ...ResourceOption) (*RoleAssignmentItem, error)
public static RoleAssignmentItem Get(string name, Input<string> id, RoleAssignmentItemState? state, CustomResourceOptions? opts = null)
public static RoleAssignmentItem get(String name, Output<String> id, RoleAssignmentItemState 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.
- Org
Id string - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- Role
Uid string - the role UID onto which to assign an actor
- Service
Account stringId - the service account onto which the role is to be assigned
- Team
Id string - the team onto which the role is to be assigned
- User
Id string - the user onto which the role is to be assigned
- Org
Id string - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- Role
Uid string - the role UID onto which to assign an actor
- Service
Account stringId - the service account onto which the role is to be assigned
- Team
Id string - the team onto which the role is to be assigned
- User
Id string - the user onto which the role is to be assigned
- org
Id String - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- role
Uid String - the role UID onto which to assign an actor
- service
Account StringId - the service account onto which the role is to be assigned
- team
Id String - the team onto which the role is to be assigned
- user
Id String - the user onto which the role is to be assigned
- org
Id string - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- role
Uid string - the role UID onto which to assign an actor
- service
Account stringId - the service account onto which the role is to be assigned
- team
Id string - the team onto which the role is to be assigned
- user
Id string - the user onto which the role is to be assigned
- org_
id str - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- role_
uid str - the role UID onto which to assign an actor
- service_
account_ strid - the service account onto which the role is to be assigned
- team_
id str - the team onto which the role is to be assigned
- user_
id str - the user onto which the role is to be assigned
- org
Id String - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- role
Uid String - the role UID onto which to assign an actor
- service
Account StringId - the service account onto which the role is to be assigned
- team
Id String - the team onto which the role is to be assigned
- user
Id String - the user onto which the role is to be assigned
Import
$ pulumi import grafana:enterprise/roleAssignmentItem:RoleAssignmentItem name "{{ roleUID }}:{{ type (user, team or service_account) }}:{{ identifier }}"
$ pulumi import grafana:enterprise/roleAssignmentItem:RoleAssignmentItem name "{{ orgID }}:{{ roleUID }}:{{ type (user, team or service_account) }}:{{ identifier }}"
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- grafana pulumiverse/pulumi-grafana
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
grafana
Terraform Provider.