1. Packages
  2. AWS Classic
  3. API Docs
  4. iam
  5. getUser

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

aws.iam.getUser

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

    This data source can be used to fetch information about a specific IAM user. By using this data source, you can reference IAM user properties without having to hard code ARNs or unique IDs as input.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = aws.iam.getUser({
        userName: "an_example_user_name",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.iam.get_user(user_name="an_example_user_name")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := iam.LookupUser(ctx, &iam.LookupUserArgs{
    			UserName: "an_example_user_name",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Aws.Iam.GetUser.Invoke(new()
        {
            UserName = "an_example_user_name",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.iam.IamFunctions;
    import com.pulumi.aws.iam.inputs.GetUserArgs;
    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 example = IamFunctions.getUser(GetUserArgs.builder()
                .userName("an_example_user_name")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: aws:iam:getUser
          Arguments:
            userName: an_example_user_name
    

    Using getUser

    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 getUser(args: GetUserArgs, opts?: InvokeOptions): Promise<GetUserResult>
    function getUserOutput(args: GetUserOutputArgs, opts?: InvokeOptions): Output<GetUserResult>
    def get_user(tags: Optional[Mapping[str, str]] = None,
                 user_name: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetUserResult
    def get_user_output(tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                 user_name: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetUserResult]
    func LookupUser(ctx *Context, args *LookupUserArgs, opts ...InvokeOption) (*LookupUserResult, error)
    func LookupUserOutput(ctx *Context, args *LookupUserOutputArgs, opts ...InvokeOption) LookupUserResultOutput

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

    public static class GetUser 
    {
        public static Task<GetUserResult> InvokeAsync(GetUserArgs args, InvokeOptions? opts = null)
        public static Output<GetUserResult> Invoke(GetUserInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetUserResult> getUser(GetUserArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:iam/getUser:getUser
      arguments:
        # arguments dictionary

    The following arguments are supported:

    UserName string
    Friendly IAM user name to match.
    Tags Dictionary<string, string>
    Map of key-value pairs associated with the user.
    UserName string
    Friendly IAM user name to match.
    Tags map[string]string
    Map of key-value pairs associated with the user.
    userName String
    Friendly IAM user name to match.
    tags Map<String,String>
    Map of key-value pairs associated with the user.
    userName string
    Friendly IAM user name to match.
    tags {[key: string]: string}
    Map of key-value pairs associated with the user.
    user_name str
    Friendly IAM user name to match.
    tags Mapping[str, str]
    Map of key-value pairs associated with the user.
    userName String
    Friendly IAM user name to match.
    tags Map<String>
    Map of key-value pairs associated with the user.

    getUser Result

    The following output properties are available:

    Arn string
    ARN assigned by AWS for this user.
    Id string
    The provider-assigned unique ID for this managed resource.
    Path string
    Path in which this user was created.
    PermissionsBoundary string
    The ARN of the policy that is used to set the permissions boundary for the user.
    Tags Dictionary<string, string>
    Map of key-value pairs associated with the user.
    UserId string
    Unique ID assigned by AWS for this user.
    UserName string
    Name associated to this User
    Arn string
    ARN assigned by AWS for this user.
    Id string
    The provider-assigned unique ID for this managed resource.
    Path string
    Path in which this user was created.
    PermissionsBoundary string
    The ARN of the policy that is used to set the permissions boundary for the user.
    Tags map[string]string
    Map of key-value pairs associated with the user.
    UserId string
    Unique ID assigned by AWS for this user.
    UserName string
    Name associated to this User
    arn String
    ARN assigned by AWS for this user.
    id String
    The provider-assigned unique ID for this managed resource.
    path String
    Path in which this user was created.
    permissionsBoundary String
    The ARN of the policy that is used to set the permissions boundary for the user.
    tags Map<String,String>
    Map of key-value pairs associated with the user.
    userId String
    Unique ID assigned by AWS for this user.
    userName String
    Name associated to this User
    arn string
    ARN assigned by AWS for this user.
    id string
    The provider-assigned unique ID for this managed resource.
    path string
    Path in which this user was created.
    permissionsBoundary string
    The ARN of the policy that is used to set the permissions boundary for the user.
    tags {[key: string]: string}
    Map of key-value pairs associated with the user.
    userId string
    Unique ID assigned by AWS for this user.
    userName string
    Name associated to this User
    arn str
    ARN assigned by AWS for this user.
    id str
    The provider-assigned unique ID for this managed resource.
    path str
    Path in which this user was created.
    permissions_boundary str
    The ARN of the policy that is used to set the permissions boundary for the user.
    tags Mapping[str, str]
    Map of key-value pairs associated with the user.
    user_id str
    Unique ID assigned by AWS for this user.
    user_name str
    Name associated to this User
    arn String
    ARN assigned by AWS for this user.
    id String
    The provider-assigned unique ID for this managed resource.
    path String
    Path in which this user was created.
    permissionsBoundary String
    The ARN of the policy that is used to set the permissions boundary for the user.
    tags Map<String>
    Map of key-value pairs associated with the user.
    userId String
    Unique ID assigned by AWS for this user.
    userName String
    Name associated to this User

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi