grafana.oss.ServiceAccountPermission
Explore with Pulumi AI
Manages the entire set of permissions for a service account. Permissions that aren’t specified when applying this resource will be removed.
Note: This resource is available from Grafana 9.2.4 onwards.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as grafana from "@pulumiverse/grafana";
const test = new grafana.oss.ServiceAccount("test", {
name: "sa-terraform-test",
role: "Editor",
isDisabled: false,
});
const testTeam = new grafana.oss.Team("test_team", {name: "tf_test_team"});
const testUser = new grafana.oss.User("test_user", {
email: "tf_user@test.com",
login: "tf_user@test.com",
password: "password",
});
const testPermissions = new grafana.oss.ServiceAccountPermission("test_permissions", {
serviceAccountId: test.id,
permissions: [
{
userId: testUser.id,
permission: "Edit",
},
{
teamId: testTeam.id,
permission: "Admin",
},
],
});
import pulumi
import pulumiverse_grafana as grafana
test = grafana.oss.ServiceAccount("test",
name="sa-terraform-test",
role="Editor",
is_disabled=False)
test_team = grafana.oss.Team("test_team", name="tf_test_team")
test_user = grafana.oss.User("test_user",
email="tf_user@test.com",
login="tf_user@test.com",
password="password")
test_permissions = grafana.oss.ServiceAccountPermission("test_permissions",
service_account_id=test.id,
permissions=[
{
"user_id": test_user.id,
"permission": "Edit",
},
{
"team_id": test_team.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("sa-terraform-test"),
Role: pulumi.String("Editor"),
IsDisabled: pulumi.Bool(false),
})
if err != nil {
return err
}
testTeam, err := oss.NewTeam(ctx, "test_team", &oss.TeamArgs{
Name: pulumi.String("tf_test_team"),
})
if err != nil {
return err
}
testUser, err := oss.NewUser(ctx, "test_user", &oss.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 = oss.NewServiceAccountPermission(ctx, "test_permissions", &oss.ServiceAccountPermissionArgs{
ServiceAccountId: test.ID(),
Permissions: oss.ServiceAccountPermissionPermissionArray{
&oss.ServiceAccountPermissionPermissionArgs{
UserId: testUser.ID(),
Permission: pulumi.String("Edit"),
},
&oss.ServiceAccountPermissionPermissionArgs{
TeamId: testTeam.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 = "sa-terraform-test",
Role = "Editor",
IsDisabled = false,
});
var testTeam = new Grafana.Oss.Team("test_team", new()
{
Name = "tf_test_team",
});
var testUser = new Grafana.Oss.User("test_user", new()
{
Email = "tf_user@test.com",
Login = "tf_user@test.com",
Password = "password",
});
var testPermissions = new Grafana.Oss.ServiceAccountPermission("test_permissions", new()
{
ServiceAccountId = test.Id,
Permissions = new[]
{
new Grafana.Oss.Inputs.ServiceAccountPermissionPermissionArgs
{
UserId = testUser.Id,
Permission = "Edit",
},
new Grafana.Oss.Inputs.ServiceAccountPermissionPermissionArgs
{
TeamId = testTeam.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.ServiceAccountPermission;
import com.pulumi.grafana.oss.ServiceAccountPermissionArgs;
import com.pulumi.grafana.oss.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()
.name("sa-terraform-test")
.role("Editor")
.isDisabled(false)
.build());
var testTeam = new Team("testTeam", TeamArgs.builder()
.name("tf_test_team")
.build());
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());
}
}
resources:
test:
type: grafana:oss:ServiceAccount
properties:
name: sa-terraform-test
role: Editor
isDisabled: false
testTeam:
type: grafana:oss:Team
name: test_team
properties:
name: tf_test_team
testUser:
type: grafana:oss:User
name: test_user
properties:
email: tf_user@test.com
login: tf_user@test.com
password: password
testPermissions:
type: grafana:oss:ServiceAccountPermission
name: test_permissions
properties:
serviceAccountId: ${test.id}
permissions:
- userId: ${testUser.id}
permission: Edit
- teamId: ${testTeam.id}
permission: Admin
Create ServiceAccountPermission Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ServiceAccountPermission(name: string, args: ServiceAccountPermissionArgs, opts?: CustomResourceOptions);
@overload
def ServiceAccountPermission(resource_name: str,
args: ServiceAccountPermissionArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ServiceAccountPermission(resource_name: str,
opts: Optional[ResourceOptions] = None,
service_account_id: Optional[str] = None,
org_id: Optional[str] = None,
permissions: Optional[Sequence[ServiceAccountPermissionPermissionArgs]] = 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:oss:ServiceAccountPermission
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 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var serviceAccountPermissionResource = new Grafana.Oss.ServiceAccountPermission("serviceAccountPermissionResource", new()
{
ServiceAccountId = "string",
OrgId = "string",
Permissions = new[]
{
new Grafana.Oss.Inputs.ServiceAccountPermissionPermissionArgs
{
Permission = "string",
TeamId = "string",
UserId = "string",
},
},
});
example, err := oss.NewServiceAccountPermission(ctx, "serviceAccountPermissionResource", &oss.ServiceAccountPermissionArgs{
ServiceAccountId: pulumi.String("string"),
OrgId: pulumi.String("string"),
Permissions: oss.ServiceAccountPermissionPermissionArray{
&oss.ServiceAccountPermissionPermissionArgs{
Permission: pulumi.String("string"),
TeamId: pulumi.String("string"),
UserId: pulumi.String("string"),
},
},
})
var serviceAccountPermissionResource = new ServiceAccountPermission("serviceAccountPermissionResource", ServiceAccountPermissionArgs.builder()
.serviceAccountId("string")
.orgId("string")
.permissions(ServiceAccountPermissionPermissionArgs.builder()
.permission("string")
.teamId("string")
.userId("string")
.build())
.build());
service_account_permission_resource = grafana.oss.ServiceAccountPermission("serviceAccountPermissionResource",
service_account_id="string",
org_id="string",
permissions=[{
"permission": "string",
"team_id": "string",
"user_id": "string",
}])
const serviceAccountPermissionResource = new grafana.oss.ServiceAccountPermission("serviceAccountPermissionResource", {
serviceAccountId: "string",
orgId: "string",
permissions: [{
permission: "string",
teamId: "string",
userId: "string",
}],
});
type: grafana:oss:ServiceAccountPermission
properties:
orgId: string
permissions:
- permission: string
teamId: string
userId: string
serviceAccountId: string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The ServiceAccountPermission resource accepts the following input properties:
- 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.
- Permissions
List<Pulumiverse.
Grafana. Oss. Inputs. Service Account Permission Permission> - The permission items to add/update. Items that are omitted from the list will be removed.
- 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.
- Permissions
[]Service
Account Permission Permission Args - The permission items to add/update. Items that are omitted from the list will be removed.
- 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.
- permissions
List<Service
Account Permission Permission> - The permission items to add/update. Items that are omitted from the list will be removed.
- 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.
- permissions
Service
Account Permission Permission[] - The permission items to add/update. Items that are omitted from the list will be removed.
- 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.
- permissions
Sequence[Service
Account Permission Permission Args] - The permission items to add/update. Items that are omitted from the list will be removed.
- 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.
- permissions List<Property Map>
- The permission items to add/update. Items that are omitted from the list will be removed.
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,
org_id: Optional[str] = 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.
- Org
Id string - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- Permissions
List<Pulumiverse.
Grafana. Oss. Inputs. Service Account Permission Permission> - The permission items to add/update. Items that are omitted from the list will be removed.
- 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.
- Permissions
[]Service
Account Permission Permission Args - The permission items to add/update. Items that are omitted from the list will be removed.
- 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.
- permissions
List<Service
Account Permission Permission> - The permission items to add/update. Items that are omitted from the list will be removed.
- 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.
- permissions
Service
Account Permission Permission[] - The permission items to add/update. Items that are omitted from the list will be removed.
- service
Account stringId - 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.
- permissions
Sequence[Service
Account Permission Permission Args] - The permission items to add/update. Items that are omitted from the list will be removed.
- service_
account_ strid - 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.
- permissions List<Property Map>
- The permission items to add/update. Items that are omitted from the list will be removed.
- service
Account StringId - The id of the service account.
Supporting Types
ServiceAccountPermissionPermission, ServiceAccountPermissionPermissionArgs
- Permission string
- Permission to associate with item. Must be one of
View
,Edit
, orAdmin
. - Team
Id string - ID of the team to manage permissions for. Defaults to
0
. - User
Id string - ID of the user or service account to manage permissions for. Defaults to
0
.
- Permission string
- Permission to associate with item. Must be one of
View
,Edit
, orAdmin
. - Team
Id string - ID of the team to manage permissions for. Defaults to
0
. - User
Id string - ID of the user or service account to manage permissions for. Defaults to
0
.
- permission String
- Permission to associate with item. Must be one of
View
,Edit
, orAdmin
. - team
Id String - ID of the team to manage permissions for. Defaults to
0
. - user
Id String - ID of the user or service account to manage permissions for. Defaults to
0
.
- permission string
- Permission to associate with item. Must be one of
View
,Edit
, orAdmin
. - team
Id string - ID of the team to manage permissions for. Defaults to
0
. - user
Id string - ID of the user or service account to manage permissions for. Defaults to
0
.
- permission str
- Permission to associate with item. Must be one of
View
,Edit
, orAdmin
. - team_
id str - ID of the team to manage permissions for. Defaults to
0
. - user_
id str - ID of the user or service account to manage permissions for. Defaults to
0
.
- permission String
- Permission to associate with item. Must be one of
View
,Edit
, orAdmin
. - team
Id String - ID of the team to manage permissions for. Defaults to
0
. - user
Id String - ID of the user or service account to manage permissions for. Defaults to
0
.
Import
$ pulumi import grafana:oss/serviceAccountPermission:ServiceAccountPermission name "{{ serviceAccountID }}"
$ pulumi import grafana:oss/serviceAccountPermission:ServiceAccountPermission name "{{ orgID }}:{{ serviceAccountID }}"
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.