1. Packages
  2. Grafana Cloud
  3. API Docs
  4. ServiceAccountPermissionItem
Grafana v0.5.1 published on Wednesday, Jun 12, 2024 by pulumiverse

grafana.ServiceAccountPermissionItem

Explore with Pulumi AI

grafana logo
Grafana v0.5.1 published on Wednesday, Jun 12, 2024 by pulumiverse

    Manages a single permission item for a service account. Conflicts with the “grafana.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.ServiceAccount("test", {
        role: "Editor",
        isDisabled: false,
    });
    const team = new grafana.Team("team", {});
    const user = new grafana.User("user", {
        email: "user.name@example.com",
        login: "user.name",
        password: "my-password",
    });
    const onTeam = new grafana.ServiceAccountPermissionItem("onTeam", {
        serviceAccountId: test.id,
        team: team.id,
        permission: "Admin",
    });
    const onUser = new grafana.ServiceAccountPermissionItem("onUser", {
        serviceAccountId: test.id,
        user: user.id,
        permission: "Admin",
    });
    
    import pulumi
    import pulumiverse_grafana as grafana
    
    test = grafana.ServiceAccount("test",
        role="Editor",
        is_disabled=False)
    team = grafana.Team("team")
    user = grafana.User("user",
        email="user.name@example.com",
        login="user.name",
        password="my-password")
    on_team = grafana.ServiceAccountPermissionItem("onTeam",
        service_account_id=test.id,
        team=team.id,
        permission="Admin")
    on_user = grafana.ServiceAccountPermissionItem("onUser",
        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"
    )
    
    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
    		}
    		team, err := grafana.NewTeam(ctx, "team", nil)
    		if err != nil {
    			return err
    		}
    		user, err := grafana.NewUser(ctx, "user", &grafana.UserArgs{
    			Email:    pulumi.String("user.name@example.com"),
    			Login:    pulumi.String("user.name"),
    			Password: pulumi.String("my-password"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = grafana.NewServiceAccountPermissionItem(ctx, "onTeam", &grafana.ServiceAccountPermissionItemArgs{
    			ServiceAccountId: test.ID(),
    			Team:             team.ID(),
    			Permission:       pulumi.String("Admin"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = grafana.NewServiceAccountPermissionItem(ctx, "onUser", &grafana.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.ServiceAccount("test", new()
        {
            Role = "Editor",
            IsDisabled = false,
        });
    
        var team = new Grafana.Team("team");
    
        var user = new Grafana.User("user", new()
        {
            Email = "user.name@example.com",
            Login = "user.name",
            Password = "my-password",
        });
    
        var onTeam = new Grafana.ServiceAccountPermissionItem("onTeam", new()
        {
            ServiceAccountId = test.Id,
            Team = team.Id,
            Permission = "Admin",
        });
    
        var onUser = new Grafana.ServiceAccountPermissionItem("onUser", 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.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.ServiceAccountPermissionItem;
    import com.pulumi.grafana.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()        
                .role("Editor")
                .isDisabled(false)
                .build());
    
            var team = new Team("team");
    
            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:ServiceAccount
        properties:
          role: Editor
          isDisabled: false
      team:
        type: grafana:Team
      user:
        type: grafana:User
        properties:
          email: user.name@example.com
          login: user.name
          password: my-password
      onTeam:
        type: grafana:ServiceAccountPermissionItem
        properties:
          serviceAccountId: ${test.id}
          team: ${team.id}
          permission: Admin
      onUser:
        type: grafana:ServiceAccountPermissionItem
        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,
                                     permission: Optional[str] = None,
                                     service_account_id: Optional[str] = None,
                                     org_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.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var serviceAccountPermissionItemResource = new Grafana.ServiceAccountPermissionItem("serviceAccountPermissionItemResource", new()
    {
        Permission = "string",
        ServiceAccountId = "string",
        OrgId = "string",
        Team = "string",
        User = "string",
    });
    
    example, err := grafana.NewServiceAccountPermissionItem(ctx, "serviceAccountPermissionItemResource", &grafana.ServiceAccountPermissionItemArgs{
    	Permission:       pulumi.String("string"),
    	ServiceAccountId: pulumi.String("string"),
    	OrgId:            pulumi.String("string"),
    	Team:             pulumi.String("string"),
    	User:             pulumi.String("string"),
    })
    
    var serviceAccountPermissionItemResource = new ServiceAccountPermissionItem("serviceAccountPermissionItemResource", ServiceAccountPermissionItemArgs.builder()
        .permission("string")
        .serviceAccountId("string")
        .orgId("string")
        .team("string")
        .user("string")
        .build());
    
    service_account_permission_item_resource = grafana.ServiceAccountPermissionItem("serviceAccountPermissionItemResource",
        permission="string",
        service_account_id="string",
        org_id="string",
        team="string",
        user="string")
    
    const serviceAccountPermissionItemResource = new grafana.ServiceAccountPermissionItem("serviceAccountPermissionItemResource", {
        permission: "string",
        serviceAccountId: "string",
        orgId: "string",
        team: "string",
        user: "string",
    });
    
    type: grafana:ServiceAccountPermissionItem
    properties:
        orgId: string
        permission: string
        serviceAccountId: string
        team: string
        user: string
    

    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

    The ServiceAccountPermissionItem resource accepts the following input properties:

    Permission string
    the permission to be assigned
    ServiceAccountId string
    The ID of the service account.
    OrgId 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
    ServiceAccountId string
    The ID of the service account.
    OrgId 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
    serviceAccountId String
    The ID of the service account.
    orgId 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
    serviceAccountId string
    The ID of the service account.
    orgId 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_id str
    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
    serviceAccountId String
    The ID of the service account.
    orgId 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.
    The following state arguments are supported:
    OrgId 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
    ServiceAccountId string
    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
    OrgId 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
    ServiceAccountId string
    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
    orgId 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
    serviceAccountId String
    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
    orgId 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
    serviceAccountId string
    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_id str
    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
    orgId 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
    serviceAccountId String
    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.
    grafana logo
    Grafana v0.5.1 published on Wednesday, Jun 12, 2024 by pulumiverse