GetRole

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

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var example = Output.Create(Aws.Iam.GetRole.InvokeAsync(new Aws.Iam.GetRoleArgs
        {
            Name = "an_example_role_name",
        }));
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/iam"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := iam.LookupRole(ctx, &iam.LookupRoleArgs{
            Name: "an_example_role_name",
        }, nil)
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

example = aws.iam.get_role(name="an_example_role_name")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = pulumi.output(aws.iam.getRole({
    name: "an_example_role_name",
}, { async: true }));

Using GetRole

function getRole(args: GetRoleArgs, opts?: InvokeOptions): Promise<GetRoleResult>
function  get_role(name=None, tags=None, opts=None)
func LookupRole(ctx *Context, args *LookupRoleArgs, opts ...InvokeOption) (*LookupRoleResult, error)

Note: This function is named LookupRole in the Go SDK.

public static class GetRole {
    public static Task<GetRoleResult> InvokeAsync(GetRoleArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Name string

The friendly IAM role name to match.

Tags Dictionary<string, string>

The tags attached to the role.

Name string

The friendly IAM role name to match.

Tags map[string]string

The tags attached to the role.

name string

The friendly IAM role name to match.

tags {[key: string]: string}

The tags attached to the role.

name str

The friendly IAM role name to match.

tags Dict[str, str]

The tags attached to the role.

GetRole Result

The following output properties are available:

Arn string

The Amazon Resource Name (ARN) specifying the role.

AssumeRolePolicy string

The policy document associated with the role.

CreateDate string

Creation date of the role in RFC 3339 format.

Description string

Description for the role.

Id string

The provider-assigned unique ID for this managed resource.

MaxSessionDuration int

Maximum session duration.

Name string
Path string

The path to the role.

PermissionsBoundary string

The ARN of the policy that is used to set the permissions boundary for the role.

Tags Dictionary<string, string>

The tags attached to the role.

UniqueId string

The stable and unique string identifying the role.

Arn string

The Amazon Resource Name (ARN) specifying the role.

AssumeRolePolicy string

The policy document associated with the role.

CreateDate string

Creation date of the role in RFC 3339 format.

Description string

Description for the role.

Id string

The provider-assigned unique ID for this managed resource.

MaxSessionDuration int

Maximum session duration.

Name string
Path string

The path to the role.

PermissionsBoundary string

The ARN of the policy that is used to set the permissions boundary for the role.

Tags map[string]string

The tags attached to the role.

UniqueId string

The stable and unique string identifying the role.

arn string

The Amazon Resource Name (ARN) specifying the role.

assumeRolePolicy string

The policy document associated with the role.

createDate string

Creation date of the role in RFC 3339 format.

description string

Description for the role.

id string

The provider-assigned unique ID for this managed resource.

maxSessionDuration number

Maximum session duration.

name string
path string

The path to the role.

permissionsBoundary string

The ARN of the policy that is used to set the permissions boundary for the role.

tags {[key: string]: string}

The tags attached to the role.

uniqueId string

The stable and unique string identifying the role.

arn str

The Amazon Resource Name (ARN) specifying the role.

assume_role_policy str

The policy document associated with the role.

create_date str

Creation date of the role in RFC 3339 format.

description str

Description for the role.

id str

The provider-assigned unique ID for this managed resource.

max_session_duration float

Maximum session duration.

name str
path str

The path to the role.

permissions_boundary str

The ARN of the policy that is used to set the permissions boundary for the role.

tags Dict[str, str]

The tags attached to the role.

unique_id str

The stable and unique string identifying the role.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.