1. Packages
  2. Packages
  3. AWS
  4. API Docs
  5. iam
  6. getRolePolicies
Viewing docs for AWS v7.30.0
published on Thursday, May 14, 2026 by Pulumi
aws logo
Viewing docs for AWS v7.30.0
published on Thursday, May 14, 2026 by Pulumi

    Use this data source to get the names of inline policies associated with an IAM role.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = aws.iam.getRolePolicies({
        roleName: "my-role-name",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.iam.get_role_policies(role_name="my-role-name")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/iam"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := iam.GetRolePolicies(ctx, &iam.GetRolePoliciesArgs{
    			RoleName: "my-role-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.GetRolePolicies.Invoke(new()
        {
            RoleName = "my-role-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.GetRolePoliciesArgs;
    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) {
            final var example = IamFunctions.getRolePolicies(GetRolePoliciesArgs.builder()
                .roleName("my-role-name")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: aws:iam:getRolePolicies
          arguments:
            roleName: my-role-name
    
    Example coming soon!
    

    Using getRolePolicies

    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 getRolePolicies(args: GetRolePoliciesArgs, opts?: InvokeOptions): Promise<GetRolePoliciesResult>
    function getRolePoliciesOutput(args: GetRolePoliciesOutputArgs, opts?: InvokeOptions): Output<GetRolePoliciesResult>
    def get_role_policies(role_name: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetRolePoliciesResult
    def get_role_policies_output(role_name: pulumi.Input[Optional[str]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetRolePoliciesResult]
    func GetRolePolicies(ctx *Context, args *GetRolePoliciesArgs, opts ...InvokeOption) (*GetRolePoliciesResult, error)
    func GetRolePoliciesOutput(ctx *Context, args *GetRolePoliciesOutputArgs, opts ...InvokeOption) GetRolePoliciesResultOutput

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

    public static class GetRolePolicies 
    {
        public static Task<GetRolePoliciesResult> InvokeAsync(GetRolePoliciesArgs args, InvokeOptions? opts = null)
        public static Output<GetRolePoliciesResult> Invoke(GetRolePoliciesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetRolePoliciesResult> getRolePolicies(GetRolePoliciesArgs args, InvokeOptions options)
    public static Output<GetRolePoliciesResult> getRolePolicies(GetRolePoliciesArgs args, InvokeOptions options)
    
    fn::invoke:
      function: aws:iam/getRolePolicies:getRolePolicies
      arguments:
        # arguments dictionary
    data "aws_iam_getrolepolicies" "name" {
        # arguments
    }

    The following arguments are supported:

    RoleName string
    Name of the IAM role.
    RoleName string
    Name of the IAM role.
    role_name string
    Name of the IAM role.
    roleName String
    Name of the IAM role.
    roleName string
    Name of the IAM role.
    role_name str
    Name of the IAM role.
    roleName String
    Name of the IAM role.

    getRolePolicies Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    PolicyNames List<string>
    Set of inline policy names associated with the role.
    RoleName string
    Id string
    The provider-assigned unique ID for this managed resource.
    PolicyNames []string
    Set of inline policy names associated with the role.
    RoleName string
    id string
    The provider-assigned unique ID for this managed resource.
    policy_names list(string)
    Set of inline policy names associated with the role.
    role_name string
    id String
    The provider-assigned unique ID for this managed resource.
    policyNames List<String>
    Set of inline policy names associated with the role.
    roleName String
    id string
    The provider-assigned unique ID for this managed resource.
    policyNames string[]
    Set of inline policy names associated with the role.
    roleName string
    id str
    The provider-assigned unique ID for this managed resource.
    policy_names Sequence[str]
    Set of inline policy names associated with the role.
    role_name str
    id String
    The provider-assigned unique ID for this managed resource.
    policyNames List<String>
    Set of inline policy names associated with the role.
    roleName String

    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
    Viewing docs for AWS v7.30.0
    published on Thursday, May 14, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.