AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi
aws.iam.getUser
Explore with Pulumi AI
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:
- User
Name string - Friendly IAM user name to match.
- Dictionary<string, string>
- Map of key-value pairs associated with the user.
- User
Name string - Friendly IAM user name to match.
- map[string]string
- Map of key-value pairs associated with the user.
- user
Name String - Friendly IAM user name to match.
- Map<String,String>
- Map of key-value pairs associated with the user.
- user
Name string - Friendly IAM user name to match.
- {[key: string]: string}
- Map of key-value pairs associated with the user.
- user_
name str - Friendly IAM user name to match.
- Mapping[str, str]
- Map of key-value pairs associated with the user.
- user
Name String - Friendly IAM user name to match.
- 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.
- Permissions
Boundary string - The ARN of the policy that is used to set the permissions boundary for the user.
- Dictionary<string, string>
- Map of key-value pairs associated with the user.
- User
Id string - Unique ID assigned by AWS for this user.
- User
Name 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.
- Permissions
Boundary string - The ARN of the policy that is used to set the permissions boundary for the user.
- map[string]string
- Map of key-value pairs associated with the user.
- User
Id string - Unique ID assigned by AWS for this user.
- User
Name 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.
- permissions
Boundary String - The ARN of the policy that is used to set the permissions boundary for the user.
- Map<String,String>
- Map of key-value pairs associated with the user.
- user
Id String - Unique ID assigned by AWS for this user.
- user
Name 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.
- permissions
Boundary string - The ARN of the policy that is used to set the permissions boundary for the user.
- {[key: string]: string}
- Map of key-value pairs associated with the user.
- user
Id string - Unique ID assigned by AWS for this user.
- user
Name 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.
- 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.
- permissions
Boundary String - The ARN of the policy that is used to set the permissions boundary for the user.
- Map<String>
- Map of key-value pairs associated with the user.
- user
Id String - Unique ID assigned by AWS for this user.
- user
Name 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.