getInstanceProfiles

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

Example Usage

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = Aws.Iam.GetInstanceProfiles.Invoke(new()
    {
        RoleName = "an_example_iam_role_name",
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err = iam.GetInstanceProfiles(ctx, &iam.GetInstanceProfilesArgs{
			RoleName: "an_example_iam_role_name",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
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.GetInstanceProfilesArgs;
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.getInstanceProfiles(GetInstanceProfilesArgs.builder()
            .roleName("an_example_iam_role_name")
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example = aws.iam.get_instance_profiles(role_name="an_example_iam_role_name")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = aws.iam.getInstanceProfiles({
    roleName: "an_example_iam_role_name",
});
variables:
  example:
    fn::invoke:
      Function: aws:iam:getInstanceProfiles
      Arguments:
        roleName: an_example_iam_role_name

Using getInstanceProfiles

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 getInstanceProfiles(args: GetInstanceProfilesArgs, opts?: InvokeOptions): Promise<GetInstanceProfilesResult>
function getInstanceProfilesOutput(args: GetInstanceProfilesOutputArgs, opts?: InvokeOptions): Output<GetInstanceProfilesResult>
def get_instance_profiles(role_name: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetInstanceProfilesResult
def get_instance_profiles_output(role_name: Optional[pulumi.Input[str]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetInstanceProfilesResult]
func GetInstanceProfiles(ctx *Context, args *GetInstanceProfilesArgs, opts ...InvokeOption) (*GetInstanceProfilesResult, error)
func GetInstanceProfilesOutput(ctx *Context, args *GetInstanceProfilesOutputArgs, opts ...InvokeOption) GetInstanceProfilesResultOutput

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

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

The following arguments are supported:

RoleName string

IAM role name.

RoleName string

IAM role name.

roleName String

IAM role name.

roleName string

IAM role name.

role_name str

IAM role name.

roleName String

IAM role name.

getInstanceProfiles Result

The following output properties are available:

Arns List<string>

Set of ARNs of instance profiles.

Id string

The provider-assigned unique ID for this managed resource.

Names List<string>

Set of IAM instance profile names.

Paths List<string>

Set of IAM instance profile paths.

RoleName string
Arns []string

Set of ARNs of instance profiles.

Id string

The provider-assigned unique ID for this managed resource.

Names []string

Set of IAM instance profile names.

Paths []string

Set of IAM instance profile paths.

RoleName string
arns List<String>

Set of ARNs of instance profiles.

id String

The provider-assigned unique ID for this managed resource.

names List<String>

Set of IAM instance profile names.

paths List<String>

Set of IAM instance profile paths.

roleName String
arns string[]

Set of ARNs of instance profiles.

id string

The provider-assigned unique ID for this managed resource.

names string[]

Set of IAM instance profile names.

paths string[]

Set of IAM instance profile paths.

roleName string
arns Sequence[str]

Set of ARNs of instance profiles.

id str

The provider-assigned unique ID for this managed resource.

names Sequence[str]

Set of IAM instance profile names.

paths Sequence[str]

Set of IAM instance profile paths.

role_name str
arns List<String>

Set of ARNs of instance profiles.

id String

The provider-assigned unique ID for this managed resource.

names List<String>

Set of IAM instance profile names.

paths List<String>

Set of IAM instance profile paths.

roleName String

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.