github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/iam/getInstanceProfile.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package iam
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // This data source can be used to fetch information about a specific
    15  // IAM instance profile. By using this data source, you can reference IAM
    16  // instance profile properties without having to hard code ARNs as input.
    17  //
    18  // ## Example Usage
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			_, err := iam.LookupInstanceProfile(ctx, &iam.LookupInstanceProfileArgs{
    34  //				Name: "an_example_instance_profile_name",
    35  //			}, nil)
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			return nil
    40  //		})
    41  //	}
    42  //
    43  // ```
    44  // <!--End PulumiCodeChooser -->
    45  func LookupInstanceProfile(ctx *pulumi.Context, args *LookupInstanceProfileArgs, opts ...pulumi.InvokeOption) (*LookupInstanceProfileResult, error) {
    46  	opts = internal.PkgInvokeDefaultOpts(opts)
    47  	var rv LookupInstanceProfileResult
    48  	err := ctx.Invoke("aws:iam/getInstanceProfile:getInstanceProfile", args, &rv, opts...)
    49  	if err != nil {
    50  		return nil, err
    51  	}
    52  	return &rv, nil
    53  }
    54  
    55  // A collection of arguments for invoking getInstanceProfile.
    56  type LookupInstanceProfileArgs struct {
    57  	// Friendly IAM instance profile name to match.
    58  	Name string `pulumi:"name"`
    59  }
    60  
    61  // A collection of values returned by getInstanceProfile.
    62  type LookupInstanceProfileResult struct {
    63  	// ARN.
    64  	Arn string `pulumi:"arn"`
    65  	// String representation of the date the instance profile was created.
    66  	CreateDate string `pulumi:"createDate"`
    67  	// The provider-assigned unique ID for this managed resource.
    68  	Id   string `pulumi:"id"`
    69  	Name string `pulumi:"name"`
    70  	// Path to the instance profile.
    71  	Path string `pulumi:"path"`
    72  	// Role ARN associated with this instance profile.
    73  	RoleArn string `pulumi:"roleArn"`
    74  	// Role ID associated with this instance profile.
    75  	RoleId string `pulumi:"roleId"`
    76  	// Role name associated with this instance profile.
    77  	RoleName string `pulumi:"roleName"`
    78  }
    79  
    80  func LookupInstanceProfileOutput(ctx *pulumi.Context, args LookupInstanceProfileOutputArgs, opts ...pulumi.InvokeOption) LookupInstanceProfileResultOutput {
    81  	return pulumi.ToOutputWithContext(context.Background(), args).
    82  		ApplyT(func(v interface{}) (LookupInstanceProfileResult, error) {
    83  			args := v.(LookupInstanceProfileArgs)
    84  			r, err := LookupInstanceProfile(ctx, &args, opts...)
    85  			var s LookupInstanceProfileResult
    86  			if r != nil {
    87  				s = *r
    88  			}
    89  			return s, err
    90  		}).(LookupInstanceProfileResultOutput)
    91  }
    92  
    93  // A collection of arguments for invoking getInstanceProfile.
    94  type LookupInstanceProfileOutputArgs struct {
    95  	// Friendly IAM instance profile name to match.
    96  	Name pulumi.StringInput `pulumi:"name"`
    97  }
    98  
    99  func (LookupInstanceProfileOutputArgs) ElementType() reflect.Type {
   100  	return reflect.TypeOf((*LookupInstanceProfileArgs)(nil)).Elem()
   101  }
   102  
   103  // A collection of values returned by getInstanceProfile.
   104  type LookupInstanceProfileResultOutput struct{ *pulumi.OutputState }
   105  
   106  func (LookupInstanceProfileResultOutput) ElementType() reflect.Type {
   107  	return reflect.TypeOf((*LookupInstanceProfileResult)(nil)).Elem()
   108  }
   109  
   110  func (o LookupInstanceProfileResultOutput) ToLookupInstanceProfileResultOutput() LookupInstanceProfileResultOutput {
   111  	return o
   112  }
   113  
   114  func (o LookupInstanceProfileResultOutput) ToLookupInstanceProfileResultOutputWithContext(ctx context.Context) LookupInstanceProfileResultOutput {
   115  	return o
   116  }
   117  
   118  // ARN.
   119  func (o LookupInstanceProfileResultOutput) Arn() pulumi.StringOutput {
   120  	return o.ApplyT(func(v LookupInstanceProfileResult) string { return v.Arn }).(pulumi.StringOutput)
   121  }
   122  
   123  // String representation of the date the instance profile was created.
   124  func (o LookupInstanceProfileResultOutput) CreateDate() pulumi.StringOutput {
   125  	return o.ApplyT(func(v LookupInstanceProfileResult) string { return v.CreateDate }).(pulumi.StringOutput)
   126  }
   127  
   128  // The provider-assigned unique ID for this managed resource.
   129  func (o LookupInstanceProfileResultOutput) Id() pulumi.StringOutput {
   130  	return o.ApplyT(func(v LookupInstanceProfileResult) string { return v.Id }).(pulumi.StringOutput)
   131  }
   132  
   133  func (o LookupInstanceProfileResultOutput) Name() pulumi.StringOutput {
   134  	return o.ApplyT(func(v LookupInstanceProfileResult) string { return v.Name }).(pulumi.StringOutput)
   135  }
   136  
   137  // Path to the instance profile.
   138  func (o LookupInstanceProfileResultOutput) Path() pulumi.StringOutput {
   139  	return o.ApplyT(func(v LookupInstanceProfileResult) string { return v.Path }).(pulumi.StringOutput)
   140  }
   141  
   142  // Role ARN associated with this instance profile.
   143  func (o LookupInstanceProfileResultOutput) RoleArn() pulumi.StringOutput {
   144  	return o.ApplyT(func(v LookupInstanceProfileResult) string { return v.RoleArn }).(pulumi.StringOutput)
   145  }
   146  
   147  // Role ID associated with this instance profile.
   148  func (o LookupInstanceProfileResultOutput) RoleId() pulumi.StringOutput {
   149  	return o.ApplyT(func(v LookupInstanceProfileResult) string { return v.RoleId }).(pulumi.StringOutput)
   150  }
   151  
   152  // Role name associated with this instance profile.
   153  func (o LookupInstanceProfileResultOutput) RoleName() pulumi.StringOutput {
   154  	return o.ApplyT(func(v LookupInstanceProfileResult) string { return v.RoleName }).(pulumi.StringOutput)
   155  }
   156  
   157  func init() {
   158  	pulumi.RegisterOutputType(LookupInstanceProfileResultOutput{})
   159  }