1. Packages
  2. Packages
  3. Datadog Provider
  4. API Docs
  5. getRolePermissions
Viewing docs for Datadog v5.10.0
published on Thursday, Jul 30, 2026 by Pulumi
datadog logo
Viewing docs for Datadog v5.10.0
published on Thursday, Jul 30, 2026 by Pulumi

    Use this data source to retrieve the list of permissions assigned to a Datadog role.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as datadog from "@pulumi/datadog";
    
    // Get the API Key Manager role
    const apiKeyManager = datadog.getRole({
        filter: "API Key Manager",
    });
    // List permissions assigned to the API Key Manager role
    const apiKeyManagerPermissions = apiKeyManager.then(apiKeyManager => datadog.getRolePermissions({
        roleId: apiKeyManager.id,
    }));
    
    import pulumi
    import pulumi_datadog as datadog
    
    # Get the API Key Manager role
    api_key_manager = datadog.get_role(filter="API Key Manager")
    # List permissions assigned to the API Key Manager role
    api_key_manager_permissions = datadog.get_role_permissions(role_id=api_key_manager.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-datadog/sdk/v5/go/datadog"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Get the API Key Manager role
    		apiKeyManager, err := datadog.GetRole(ctx, &datadog.LookupRoleArgs{
    			Filter: "API Key Manager",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// List permissions assigned to the API Key Manager role
    		_, err = datadog.GetRolePermissions(ctx, &datadog.GetRolePermissionsArgs{
    			RoleId: apiKeyManager.Id,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Datadog = Pulumi.Datadog;
    
    return await Deployment.RunAsync(() => 
    {
        // Get the API Key Manager role
        var apiKeyManager = Datadog.GetRole.Invoke(new()
        {
            Filter = "API Key Manager",
        });
    
        // List permissions assigned to the API Key Manager role
        var apiKeyManagerPermissions = Datadog.GetRolePermissions.Invoke(new()
        {
            RoleId = apiKeyManager.Apply(getRoleResult => getRoleResult.Id),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.datadog.DatadogFunctions;
    import com.pulumi.datadog.inputs.GetRoleArgs;
    import com.pulumi.datadog.inputs.GetRolePermissionsArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    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) {
            // Get the API Key Manager role
            final var apiKeyManager = DatadogFunctions.getRole(GetRoleArgs.builder()
                .filter("API Key Manager")
                .build());
    
            // List permissions assigned to the API Key Manager role
            final var apiKeyManagerPermissions = DatadogFunctions.getRolePermissions(GetRolePermissionsArgs.builder()
                .roleId(apiKeyManager.id())
                .build());
    
        }
    }
    
    variables:
      # Get the API Key Manager role
      apiKeyManager:
        fn::invoke:
          function: datadog:getRole
          arguments:
            filter: API Key Manager
      # List permissions assigned to the API Key Manager role
      apiKeyManagerPermissions:
        fn::invoke:
          function: datadog:getRolePermissions
          arguments:
            roleId: ${apiKeyManager.id}
    
    pulumi {
      required_providers {
        datadog = {
          source = "pulumi/datadog"
        }
      }
    }
    
    data "datadog_getrole" "apiKeyManager" {
      filter = "API Key Manager"
    }
    data "datadog_getrolepermissions" "apiKeyManagerPermissions" {
      role_id = data.datadog_getrole.apiKeyManager.id
    }
    
    # Get the API Key Manager role
    # List permissions assigned to the API Key Manager role
    

    Using getRolePermissions

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getRolePermissions(args: GetRolePermissionsArgs, opts?: InvokeOptions): Promise<GetRolePermissionsResult>
    function getRolePermissionsOutput(args: GetRolePermissionsOutputArgs, opts?: InvokeOptions): Output<GetRolePermissionsResult>
    def get_role_permissions(role_id: Optional[str] = None,
                             opts: Optional[InvokeOptions] = None) -> GetRolePermissionsResult
    def get_role_permissions_output(role_id: pulumi.Input[Optional[str]] = None,
                             opts: Optional[InvokeOptions] = None) -> Output[GetRolePermissionsResult]
    func GetRolePermissions(ctx *Context, args *GetRolePermissionsArgs, opts ...InvokeOption) (*GetRolePermissionsResult, error)
    func GetRolePermissionsOutput(ctx *Context, args *GetRolePermissionsOutputArgs, opts ...InvokeOption) GetRolePermissionsResultOutput

    > Note: This function is named GetRolePermissions in the Go SDK.

    public static class GetRolePermissions 
    {
        public static Task<GetRolePermissionsResult> InvokeAsync(GetRolePermissionsArgs args, InvokeOptions? opts = null)
        public static Output<GetRolePermissionsResult> Invoke(GetRolePermissionsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetRolePermissionsResult> getRolePermissions(GetRolePermissionsArgs args, InvokeOptions options)
    public static Output<GetRolePermissionsResult> getRolePermissions(GetRolePermissionsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: datadog:index/getRolePermissions:getRolePermissions
      arguments:
        # arguments dictionary
    data "datadog_get_role_permissions" "name" {
        # arguments
    }

    The following arguments are supported:

    RoleId string
    The role's identifier.
    RoleId string
    The role's identifier.
    role_id string
    The role's identifier.
    roleId String
    The role's identifier.
    roleId string
    The role's identifier.
    role_id str
    The role's identifier.
    roleId String
    The role's identifier.

    getRolePermissions Result

    The following output properties are available:

    Id string
    The ID of this resource.
    Permissions List<GetRolePermissionsPermission>
    List of permissions assigned to the role.
    RoleId string
    The role's identifier.
    Id string
    The ID of this resource.
    Permissions []GetRolePermissionsPermission
    List of permissions assigned to the role.
    RoleId string
    The role's identifier.
    id string
    The ID of this resource.
    permissions list(object)
    List of permissions assigned to the role.
    role_id string
    The role's identifier.
    id String
    The ID of this resource.
    permissions List<GetRolePermissionsPermission>
    List of permissions assigned to the role.
    roleId String
    The role's identifier.
    id string
    The ID of this resource.
    permissions GetRolePermissionsPermission[]
    List of permissions assigned to the role.
    roleId string
    The role's identifier.
    id str
    The ID of this resource.
    permissions Sequence[GetRolePermissionsPermission]
    List of permissions assigned to the role.
    role_id str
    The role's identifier.
    id String
    The ID of this resource.
    permissions List<Property Map>
    List of permissions assigned to the role.
    roleId String
    The role's identifier.

    Supporting Types

    GetRolePermissionsPermission

    Name string
    PermissionId string
    Name string
    PermissionId string
    name string
    permission_id string
    name String
    permissionId String
    name string
    permissionId string
    name String
    permissionId String

    Package Details

    Repository
    Datadog pulumi/pulumi-datadog
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the datadog Terraform Provider.
    datadog logo
    Viewing docs for Datadog v5.10.0
    published on Thursday, Jul 30, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial