published on Thursday, May 14, 2026 by Pulumi
published on Thursday, May 14, 2026 by Pulumi
Provides details about the managed policies attached to an AWS IAM Role.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.iam.getRolePolicyAttachments({
roleName: "example-role",
});
import pulumi
import pulumi_aws as aws
example = aws.iam.get_role_policy_attachments(role_name="example-role")
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.GetRolePolicyAttachments(ctx, &iam.GetRolePolicyAttachmentsArgs{
RoleName: "example-role",
}, 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.GetRolePolicyAttachments.Invoke(new()
{
RoleName = "example-role",
});
});
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.GetRolePolicyAttachmentsArgs;
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.getRolePolicyAttachments(GetRolePolicyAttachmentsArgs.builder()
.roleName("example-role")
.build());
}
}
variables:
example:
fn::invoke:
function: aws:iam:getRolePolicyAttachments
arguments:
roleName: example-role
Example coming soon!
Using getRolePolicyAttachments
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 getRolePolicyAttachments(args: GetRolePolicyAttachmentsArgs, opts?: InvokeOptions): Promise<GetRolePolicyAttachmentsResult>
function getRolePolicyAttachmentsOutput(args: GetRolePolicyAttachmentsOutputArgs, opts?: InvokeOptions): Output<GetRolePolicyAttachmentsResult>def get_role_policy_attachments(path_prefix: Optional[str] = None,
role_name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetRolePolicyAttachmentsResult
def get_role_policy_attachments_output(path_prefix: pulumi.Input[Optional[str]] = None,
role_name: pulumi.Input[Optional[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetRolePolicyAttachmentsResult]func GetRolePolicyAttachments(ctx *Context, args *GetRolePolicyAttachmentsArgs, opts ...InvokeOption) (*GetRolePolicyAttachmentsResult, error)
func GetRolePolicyAttachmentsOutput(ctx *Context, args *GetRolePolicyAttachmentsOutputArgs, opts ...InvokeOption) GetRolePolicyAttachmentsResultOutput> Note: This function is named GetRolePolicyAttachments in the Go SDK.
public static class GetRolePolicyAttachments
{
public static Task<GetRolePolicyAttachmentsResult> InvokeAsync(GetRolePolicyAttachmentsArgs args, InvokeOptions? opts = null)
public static Output<GetRolePolicyAttachmentsResult> Invoke(GetRolePolicyAttachmentsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetRolePolicyAttachmentsResult> getRolePolicyAttachments(GetRolePolicyAttachmentsArgs args, InvokeOptions options)
public static Output<GetRolePolicyAttachmentsResult> getRolePolicyAttachments(GetRolePolicyAttachmentsArgs args, InvokeOptions options)
fn::invoke:
function: aws:iam/getRolePolicyAttachments:getRolePolicyAttachments
arguments:
# arguments dictionarydata "aws_iam_getrolepolicyattachments" "name" {
# arguments
}The following arguments are supported:
- Role
Name string Name of the IAM role.
The following arguments are optional:
- Path
Prefix string - Path prefix for filtering the results.
- Role
Name string Name of the IAM role.
The following arguments are optional:
- Path
Prefix string - Path prefix for filtering the results.
- role_
name string Name of the IAM role.
The following arguments are optional:
- path_
prefix string - Path prefix for filtering the results.
- role
Name String Name of the IAM role.
The following arguments are optional:
- path
Prefix String - Path prefix for filtering the results.
- role
Name string Name of the IAM role.
The following arguments are optional:
- path
Prefix string - Path prefix for filtering the results.
- role_
name str Name of the IAM role.
The following arguments are optional:
- path_
prefix str - Path prefix for filtering the results.
- role
Name String Name of the IAM role.
The following arguments are optional:
- path
Prefix String - Path prefix for filtering the results.
getRolePolicyAttachments Result
The following output properties are available:
- Attached
Policies List<GetRole Policy Attachments Attached Policy> - List of attached managed policies. See below.
- Id string
- The provider-assigned unique ID for this managed resource.
- Role
Name string - Path
Prefix string
- Attached
Policies []GetRole Policy Attachments Attached Policy - List of attached managed policies. See below.
- Id string
- The provider-assigned unique ID for this managed resource.
- Role
Name string - Path
Prefix string
- attached_
policies list(object) - List of attached managed policies. See below.
- id string
- The provider-assigned unique ID for this managed resource.
- role_
name string - path_
prefix string
- attached
Policies List<GetRole Policy Attachments Attached Policy> - List of attached managed policies. See below.
- id String
- The provider-assigned unique ID for this managed resource.
- role
Name String - path
Prefix String
- attached
Policies GetRole Policy Attachments Attached Policy[] - List of attached managed policies. See below.
- id string
- The provider-assigned unique ID for this managed resource.
- role
Name string - path
Prefix string
- attached_
policies Sequence[GetRole Policy Attachments Attached Policy] - List of attached managed policies. See below.
- id str
- The provider-assigned unique ID for this managed resource.
- role_
name str - path_
prefix str
- attached
Policies List<Property Map> - List of attached managed policies. See below.
- id String
- The provider-assigned unique ID for this managed resource.
- role
Name String - path
Prefix String
Supporting Types
GetRolePolicyAttachmentsAttachedPolicy
- Policy
Arn string - ARN of the attached managed policy.
- Policy
Name string - Name of the attached managed policy.
- Policy
Arn string - ARN of the attached managed policy.
- Policy
Name string - Name of the attached managed policy.
- policy_
arn string - ARN of the attached managed policy.
- policy_
name string - Name of the attached managed policy.
- policy
Arn String - ARN of the attached managed policy.
- policy
Name String - Name of the attached managed policy.
- policy
Arn string - ARN of the attached managed policy.
- policy
Name string - Name of the attached managed policy.
- policy_
arn str - ARN of the attached managed policy.
- policy_
name str - Name of the attached managed policy.
- policy
Arn String - ARN of the attached managed policy.
- policy
Name String - Name of the attached managed policy.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.
published on Thursday, May 14, 2026 by Pulumi
