grafana.ServiceAccountPermissionItem
Explore with Pulumi AI
Manages a single permission item for a service account. Conflicts with the “grafana.oss.ServiceAccountPermission” resource which manages the entire set of permissions for a service account.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as grafana from "@pulumiverse/grafana";
const test = new grafana.oss.ServiceAccount("test", {
name: "terraform-sa",
role: "Editor",
isDisabled: false,
});
const team = new grafana.oss.Team("team", {name: "Team Name"});
const user = new grafana.oss.User("user", {
email: "user.name@example.com",
login: "user.name",
password: "my-password",
});
const onTeam = new grafana.oss.ServiceAccountPermissionItem("on_team", {
serviceAccountId: test.id,
team: team.id,
permission: "Admin",
});
const onUser = new grafana.oss.ServiceAccountPermissionItem("on_user", {
serviceAccountId: test.id,
user: user.id,
permission: "Admin",
});
import pulumi
import pulumiverse_grafana as grafana
test = grafana.oss.ServiceAccount("test",
name="terraform-sa",
role="Editor",
is_disabled=False)
team = grafana.oss.Team("team", name="Team Name")
user = grafana.oss.User("user",
email="user.name@example.com",
login="user.name",
password="my-password")
on_team = grafana.oss.ServiceAccountPermissionItem("on_team",
service_account_id=test.id,
team=team.id,
permission="Admin")
on_user = grafana.oss.ServiceAccountPermissionItem("on_user",
service_account_id=test.id,
user=user.id,
permission="Admin")
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-grafana/sdk/go/grafana/oss"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
test, err := oss.NewServiceAccount(ctx, "test", &oss.ServiceAccountArgs{
Name: pulumi.String("terraform-sa"),
Role: pulumi.String("Editor"),
IsDisabled: pulumi.Bool(false),
})
if err != nil {
return err
}
team, err := oss.NewTeam(ctx, "team", &oss.TeamArgs{
Name: pulumi.String("Team Name"),
})
if err != nil {
return err
}
user, err := oss.NewUser(ctx, "user", &oss.UserArgs{
Email: pulumi.String("user.name@example.com"),
Login: pulumi.String("user.name"),
Password: pulumi.String("my-password"),
})
if err != nil {
return err
}
_, err = oss.NewServiceAccountPermissionItem(ctx, "on_team", &oss.ServiceAccountPermissionItemArgs{
ServiceAccountId: test.ID(),
Team: team.ID(),
Permission: pulumi.String("Admin"),
})
if err != nil {
return err
}
_, err = oss.NewServiceAccountPermissionItem(ctx, "on_user", &oss.ServiceAccountPermissionItemArgs{
ServiceAccountId: test.ID(),
User: user.ID(),
Permission: pulumi.String("Admin"),
})
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 test = new Grafana.Oss.ServiceAccount("test", new()
{
Name = "terraform-sa",
Role = "Editor",
IsDisabled = false,
});
var team = new Grafana.Oss.Team("team", new()
{
Name = "Team Name",
});
var user = new Grafana.Oss.User("user", new()
{
Email = "user.name@example.com",
Login = "user.name",
Password = "my-password",
});
var onTeam = new Grafana.Oss.ServiceAccountPermissionItem("on_team", new()
{
ServiceAccountId = test.Id,
Team = team.Id,
Permission = "Admin",
});
var onUser = new Grafana.Oss.ServiceAccountPermissionItem("on_user", new()
{
ServiceAccountId = test.Id,
User = user.Id,
Permission = "Admin",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.grafana.oss.ServiceAccount;
import com.pulumi.grafana.oss.ServiceAccountArgs;
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.ServiceAccountPermissionItem;
import com.pulumi.grafana.oss.ServiceAccountPermissionItemArgs;
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()
.name("terraform-sa")
.role("Editor")
.isDisabled(false)
.build());
var team = new Team("team", TeamArgs.builder()
.name("Team Name")
.build());
var user = new User("user", UserArgs.builder()
.email("user.name@example.com")
.login("user.name")
.password("my-password")
.build());
var onTeam = new ServiceAccountPermissionItem("onTeam", ServiceAccountPermissionItemArgs.builder()
.serviceAccountId(test.id())
.team(team.id())
.permission("Admin")
.build());
var onUser = new ServiceAccountPermissionItem("onUser", ServiceAccountPermissionItemArgs.builder()
.serviceAccountId(test.id())
.user(user.id())
.permission("Admin")
.build());
}
}
resources:
test:
type: grafana:oss:ServiceAccount
properties:
name: terraform-sa
role: Editor
isDisabled: false
team:
type: grafana:oss:Team
properties:
name: Team Name
user:
type: grafana:oss:User
properties:
email: user.name@example.com
login: user.name
password: my-password
onTeam:
type: grafana:oss:ServiceAccountPermissionItem
name: on_team
properties:
serviceAccountId: ${test.id}
team: ${team.id}
permission: Admin
onUser:
type: grafana:oss:ServiceAccountPermissionItem
name: on_user
properties:
serviceAccountId: ${test.id}
user: ${user.id}
permission: Admin
Create ServiceAccountPermissionItem Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ServiceAccountPermissionItem(name: string, args: ServiceAccountPermissionItemArgs, opts?: CustomResourceOptions);
@overload
def ServiceAccountPermissionItem(resource_name: str,
args: ServiceAccountPermissionItemArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ServiceAccountPermissionItem(resource_name: str,
opts: Optional[ResourceOptions] = None,
org_id: Optional[str] = None,
permission: Optional[str] = None,
service_account_id: Optional[str] = None,
team: Optional[str] = None,
user: Optional[str] = None)
func NewServiceAccountPermissionItem(ctx *Context, name string, args ServiceAccountPermissionItemArgs, opts ...ResourceOption) (*ServiceAccountPermissionItem, error)
public ServiceAccountPermissionItem(string name, ServiceAccountPermissionItemArgs args, CustomResourceOptions? opts = null)
public ServiceAccountPermissionItem(String name, ServiceAccountPermissionItemArgs args)
public ServiceAccountPermissionItem(String name, ServiceAccountPermissionItemArgs args, CustomResourceOptions options)
type: grafana:ServiceAccountPermissionItem
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 ServiceAccountPermissionItemArgs
- 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 ServiceAccountPermissionItemArgs
- 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 ServiceAccountPermissionItemArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ServiceAccountPermissionItemArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ServiceAccountPermissionItemArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
ServiceAccountPermissionItem 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 ServiceAccountPermissionItem resource accepts the following input properties:
- Permission string
- the permission to be assigned
- Service
Account stringId - The ID of the service account.
- Org
Id string - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- Team string
- the team onto which the permission is to be assigned
- User string
- the user or service account onto which the permission is to be assigned
- Permission string
- the permission to be assigned
- Service
Account stringId - The ID of the service account.
- Org
Id string - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- Team string
- the team onto which the permission is to be assigned
- User string
- the user or service account onto which the permission is to be assigned
- permission String
- the permission to be assigned
- service
Account StringId - The ID of the service account.
- org
Id String - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- team String
- the team onto which the permission is to be assigned
- user String
- the user or service account onto which the permission is to be assigned
- permission string
- the permission to be assigned
- service
Account stringId - The ID of the service account.
- org
Id string - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- team string
- the team onto which the permission is to be assigned
- user string
- the user or service account onto which the permission is to be assigned
- permission str
- the permission to be assigned
- service_
account_ strid - The ID of the service account.
- org_
id str - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- team str
- the team onto which the permission is to be assigned
- user str
- the user or service account onto which the permission is to be assigned
- permission String
- the permission to be assigned
- service
Account StringId - The ID of the service account.
- org
Id String - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- team String
- the team onto which the permission is to be assigned
- user String
- the user or service account onto which the permission is to be assigned
Outputs
All input properties are implicitly available as output properties. Additionally, the ServiceAccountPermissionItem 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 ServiceAccountPermissionItem Resource
Get an existing ServiceAccountPermissionItem 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?: ServiceAccountPermissionItemState, opts?: CustomResourceOptions): ServiceAccountPermissionItem
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
org_id: Optional[str] = None,
permission: Optional[str] = None,
service_account_id: Optional[str] = None,
team: Optional[str] = None,
user: Optional[str] = None) -> ServiceAccountPermissionItem
func GetServiceAccountPermissionItem(ctx *Context, name string, id IDInput, state *ServiceAccountPermissionItemState, opts ...ResourceOption) (*ServiceAccountPermissionItem, error)
public static ServiceAccountPermissionItem Get(string name, Input<string> id, ServiceAccountPermissionItemState? state, CustomResourceOptions? opts = null)
public static ServiceAccountPermissionItem get(String name, Output<String> id, ServiceAccountPermissionItemState 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.
- Permission string
- the permission to be assigned
- Service
Account stringId - The ID of the service account.
- Team string
- the team onto which the permission is to be assigned
- User string
- the user or service account onto which the permission is to be assigned
- Org
Id string - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- Permission string
- the permission to be assigned
- Service
Account stringId - The ID of the service account.
- Team string
- the team onto which the permission is to be assigned
- User string
- the user or service account onto which the permission is to be assigned
- org
Id String - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- permission String
- the permission to be assigned
- service
Account StringId - The ID of the service account.
- team String
- the team onto which the permission is to be assigned
- user String
- the user or service account onto which the permission is to be assigned
- org
Id string - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- permission string
- the permission to be assigned
- service
Account stringId - The ID of the service account.
- team string
- the team onto which the permission is to be assigned
- user string
- the user or service account onto which the permission is to be assigned
- org_
id str - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- permission str
- the permission to be assigned
- service_
account_ strid - The ID of the service account.
- team str
- the team onto which the permission is to be assigned
- user str
- the user or service account onto which the permission is to be assigned
- org
Id String - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- permission String
- the permission to be assigned
- service
Account StringId - The ID of the service account.
- team String
- the team onto which the permission is to be assigned
- user String
- the user or service account onto which the permission is to be assigned
Import
$ pulumi import grafana:index/serviceAccountPermissionItem:ServiceAccountPermissionItem name "{{ serviceAccountID }}:{{ type (role, team, or user) }}:{{ identifier }}"
$ pulumi import grafana:index/serviceAccountPermissionItem:ServiceAccountPermissionItem name "{{ orgID }}:{{ serviceAccountID }}:{{ type (role, team, or user) }}:{{ 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.