1. Packages
  2. Packages
  3. Pagerduty Provider
  4. API Docs
  5. getUsers
Viewing docs for PagerDuty v3.11.2 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
pagerduty logo
Viewing docs for PagerDuty v3.11.2 (Older version)
published on Monday, Mar 9, 2026 by Pulumi

    Use this data source to get information about list of users that you can use for other PagerDuty resources, optionally filtering by team ids.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Pagerduty = Pulumi.Pagerduty;
    
    return await Deployment.RunAsync(() => 
    {
        var devops = Pagerduty.GetTeam.Invoke(new()
        {
            Name = "devops",
        });
    
        var me = Pagerduty.GetUser.Invoke(new()
        {
            Email = "me@example.com",
        });
    
        var exampleWTeam = new Pagerduty.User("exampleWTeam", new()
        {
            Email = "user-with-team@example.com",
        });
    
        var example = new Pagerduty.TeamMembership("example", new()
        {
            TeamId = pagerduty_team.Devops.Id,
            UserId = exampleWTeam.Id,
        });
    
        var allUsers = Pagerduty.GetUsers.Invoke();
    
        var fromDevopsTeam = Pagerduty.GetUsers.Invoke(new()
        {
            TeamIds = new[]
            {
                pagerduty_team.Devops.Id,
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-pagerduty/sdk/v3/go/pagerduty"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
    _, err := pagerduty.LookupTeam(ctx, &pagerduty.LookupTeamArgs{
    Name: "devops",
    }, nil);
    if err != nil {
    return err
    }
    _, err = pagerduty.LookupUser(ctx, &pagerduty.LookupUserArgs{
    Email: "me@example.com",
    }, nil);
    if err != nil {
    return err
    }
    exampleWTeam, err := pagerduty.NewUser(ctx, "exampleWTeam", &pagerduty.UserArgs{
    Email: pulumi.String("user-with-team@example.com"),
    })
    if err != nil {
    return err
    }
    _, err = pagerduty.NewTeamMembership(ctx, "example", &pagerduty.TeamMembershipArgs{
    TeamId: pulumi.Any(pagerduty_team.Devops.Id),
    UserId: exampleWTeam.ID(),
    })
    if err != nil {
    return err
    }
    _, err = pagerduty.GetUsers(ctx, nil, nil);
    if err != nil {
    return err
    }
    _, err = pagerduty.GetUsers(ctx, &pagerduty.GetUsersArgs{
    TeamIds: interface{}{
    pagerduty_team.Devops.Id,
    },
    }, nil);
    if err != nil {
    return err
    }
    return nil
    })
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.pagerduty.PagerdutyFunctions;
    import com.pulumi.pagerduty.inputs.GetTeamArgs;
    import com.pulumi.pagerduty.inputs.GetUserArgs;
    import com.pulumi.pagerduty.User;
    import com.pulumi.pagerduty.UserArgs;
    import com.pulumi.pagerduty.TeamMembership;
    import com.pulumi.pagerduty.TeamMembershipArgs;
    import com.pulumi.pagerduty.inputs.GetUsersArgs;
    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) {
            final var devops = PagerdutyFunctions.getTeam(GetTeamArgs.builder()
                .name("devops")
                .build());
    
            final var me = PagerdutyFunctions.getUser(GetUserArgs.builder()
                .email("me@example.com")
                .build());
    
            var exampleWTeam = new User("exampleWTeam", UserArgs.builder()        
                .email("user-with-team@example.com")
                .build());
    
            var example = new TeamMembership("example", TeamMembershipArgs.builder()        
                .teamId(pagerduty_team.devops().id())
                .userId(exampleWTeam.id())
                .build());
    
            final var allUsers = PagerdutyFunctions.getUsers();
    
            final var fromDevopsTeam = PagerdutyFunctions.getUsers(GetUsersArgs.builder()
                .teamIds(pagerduty_team.devops().id())
                .build());
    
        }
    }
    
    import * as pulumi from "@pulumi/pulumi";
    import * as pagerduty from "@pulumi/pagerduty";
    
    const devops = pagerduty.getTeam({
        name: "devops",
    });
    const me = pagerduty.getUser({
        email: "me@example.com",
    });
    const exampleWTeam = new pagerduty.User("exampleWTeam", {email: "user-with-team@example.com"});
    const example = new pagerduty.TeamMembership("example", {
        teamId: pagerduty_team.devops.id,
        userId: exampleWTeam.id,
    });
    const allUsers = pagerduty.getUsers({});
    const fromDevopsTeam = pagerduty.getUsers({
        teamIds: [pagerduty_team.devops.id],
    });
    
    import pulumi
    import pulumi_pagerduty as pagerduty
    
    devops = pagerduty.get_team(name="devops")
    me = pagerduty.get_user(email="me@example.com")
    example_w_team = pagerduty.User("exampleWTeam", email="user-with-team@example.com")
    example = pagerduty.TeamMembership("example",
        team_id=pagerduty_team["devops"]["id"],
        user_id=example_w_team.id)
    all_users = pagerduty.get_users()
    from_devops_team = pagerduty.get_users(team_ids=[pagerduty_team["devops"]["id"]])
    
    resources:
      exampleWTeam:
        type: pagerduty:User
        properties:
          email: user-with-team@example.com
      example:
        type: pagerduty:TeamMembership
        properties:
          teamId: ${pagerduty_team.devops.id}
          userId: ${exampleWTeam.id}
    variables:
      devops:
        fn::invoke:
          Function: pagerduty:getTeam
          Arguments:
            name: devops
      me:
        fn::invoke:
          Function: pagerduty:getUser
          Arguments:
            email: me@example.com
      allUsers:
        fn::invoke:
          Function: pagerduty:getUsers
          Arguments: {}
      fromDevopsTeam:
        fn::invoke:
          Function: pagerduty:getUsers
          Arguments:
            teamIds:
              - ${pagerduty_team.devops.id}
    

    Using getUsers

    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 getUsers(args: GetUsersArgs, opts?: InvokeOptions): Promise<GetUsersResult>
    function getUsersOutput(args: GetUsersOutputArgs, opts?: InvokeOptions): Output<GetUsersResult>
    def get_users(team_ids: Optional[Sequence[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> GetUsersResult
    def get_users_output(team_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetUsersResult]
    func GetUsers(ctx *Context, args *GetUsersArgs, opts ...InvokeOption) (*GetUsersResult, error)
    func GetUsersOutput(ctx *Context, args *GetUsersOutputArgs, opts ...InvokeOption) GetUsersResultOutput

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

    public static class GetUsers 
    {
        public static Task<GetUsersResult> InvokeAsync(GetUsersArgs args, InvokeOptions? opts = null)
        public static Output<GetUsersResult> Invoke(GetUsersInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetUsersResult> getUsers(GetUsersArgs args, InvokeOptions options)
    public static Output<GetUsersResult> getUsers(GetUsersArgs args, InvokeOptions options)
    
    fn::invoke:
      function: pagerduty:index/getUsers:getUsers
      arguments:
        # arguments dictionary

    The following arguments are supported:

    TeamIds List<string>
    List of team IDs. Only results related to these teams will be returned. Account must have the teams ability to use this parameter.
    TeamIds []string
    List of team IDs. Only results related to these teams will be returned. Account must have the teams ability to use this parameter.
    teamIds List<String>
    List of team IDs. Only results related to these teams will be returned. Account must have the teams ability to use this parameter.
    teamIds string[]
    List of team IDs. Only results related to these teams will be returned. Account must have the teams ability to use this parameter.
    team_ids Sequence[str]
    List of team IDs. Only results related to these teams will be returned. Account must have the teams ability to use this parameter.
    teamIds List<String>
    List of team IDs. Only results related to these teams will be returned. Account must have the teams ability to use this parameter.

    getUsers Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Users List<GetUsersUser>
    List of users queried.
    TeamIds List<string>
    Id string
    The provider-assigned unique ID for this managed resource.
    Users []GetUsersUser
    List of users queried.
    TeamIds []string
    id String
    The provider-assigned unique ID for this managed resource.
    users List<GetUsersUser>
    List of users queried.
    teamIds List<String>
    id string
    The provider-assigned unique ID for this managed resource.
    users GetUsersUser[]
    List of users queried.
    teamIds string[]
    id str
    The provider-assigned unique ID for this managed resource.
    users Sequence[GetUsersUser]
    List of users queried.
    team_ids Sequence[str]
    id String
    The provider-assigned unique ID for this managed resource.
    users List<Property Map>
    List of users queried.
    teamIds List<String>

    Supporting Types

    GetUsersUser

    Email string
    The email to use to find a user in the PagerDuty API.
    Id string
    The ID of the found user.
    Name string
    The short name of the found user.
    Email string
    The email to use to find a user in the PagerDuty API.
    Id string
    The ID of the found user.
    Name string
    The short name of the found user.
    email String
    The email to use to find a user in the PagerDuty API.
    id String
    The ID of the found user.
    name String
    The short name of the found user.
    email string
    The email to use to find a user in the PagerDuty API.
    id string
    The ID of the found user.
    name string
    The short name of the found user.
    email str
    The email to use to find a user in the PagerDuty API.
    id str
    The ID of the found user.
    name str
    The short name of the found user.
    email String
    The email to use to find a user in the PagerDuty API.
    id String
    The ID of the found user.
    name String
    The short name of the found user.

    Package Details

    Repository
    PagerDuty pulumi/pulumi-pagerduty
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the pagerduty Terraform Provider.
    pagerduty logo
    Viewing docs for PagerDuty v3.11.2 (Older version)
    published on Monday, Mar 9, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.