github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/iam/serviceLinkedRole.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  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Provides an [IAM service-linked role](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html).
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			_, err := iam.NewServiceLinkedRole(ctx, "elasticbeanstalk", &iam.ServiceLinkedRoleArgs{
    33  //				AwsServiceName: pulumi.String("elasticbeanstalk.amazonaws.com"),
    34  //			})
    35  //			if err != nil {
    36  //				return err
    37  //			}
    38  //			return nil
    39  //		})
    40  //	}
    41  //
    42  // ```
    43  // <!--End PulumiCodeChooser -->
    44  //
    45  // ## Import
    46  //
    47  // Using `pulumi import`, import IAM service-linked roles using role ARN. For example:
    48  //
    49  // ```sh
    50  // $ pulumi import aws:iam/serviceLinkedRole:ServiceLinkedRole elasticbeanstalk arn:aws:iam::123456789012:role/aws-service-role/elasticbeanstalk.amazonaws.com/AWSServiceRoleForElasticBeanstalk
    51  // ```
    52  type ServiceLinkedRole struct {
    53  	pulumi.CustomResourceState
    54  
    55  	// The Amazon Resource Name (ARN) specifying the role.
    56  	Arn pulumi.StringOutput `pulumi:"arn"`
    57  	// The AWS service to which this role is attached. You use a string similar to a URL but without the `http://` in front. For example: `elasticbeanstalk.amazonaws.com`. To find the full list of services that support service-linked roles, check [the docs](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html).
    58  	AwsServiceName pulumi.StringOutput `pulumi:"awsServiceName"`
    59  	// The creation date of the IAM role.
    60  	CreateDate pulumi.StringOutput `pulumi:"createDate"`
    61  	// Additional string appended to the role name. Not all AWS services support custom suffixes.
    62  	CustomSuffix pulumi.StringPtrOutput `pulumi:"customSuffix"`
    63  	// The description of the role.
    64  	Description pulumi.StringPtrOutput `pulumi:"description"`
    65  	// The name of the role.
    66  	Name pulumi.StringOutput `pulumi:"name"`
    67  	// The path of the role.
    68  	Path pulumi.StringOutput `pulumi:"path"`
    69  	// Key-value mapping of tags for the IAM role. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    70  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    71  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    72  	//
    73  	// Deprecated: Please use `tags` instead.
    74  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    75  	// The stable and unique string identifying the role.
    76  	UniqueId pulumi.StringOutput `pulumi:"uniqueId"`
    77  }
    78  
    79  // NewServiceLinkedRole registers a new resource with the given unique name, arguments, and options.
    80  func NewServiceLinkedRole(ctx *pulumi.Context,
    81  	name string, args *ServiceLinkedRoleArgs, opts ...pulumi.ResourceOption) (*ServiceLinkedRole, error) {
    82  	if args == nil {
    83  		return nil, errors.New("missing one or more required arguments")
    84  	}
    85  
    86  	if args.AwsServiceName == nil {
    87  		return nil, errors.New("invalid value for required argument 'AwsServiceName'")
    88  	}
    89  	opts = internal.PkgResourceDefaultOpts(opts)
    90  	var resource ServiceLinkedRole
    91  	err := ctx.RegisterResource("aws:iam/serviceLinkedRole:ServiceLinkedRole", name, args, &resource, opts...)
    92  	if err != nil {
    93  		return nil, err
    94  	}
    95  	return &resource, nil
    96  }
    97  
    98  // GetServiceLinkedRole gets an existing ServiceLinkedRole resource's state with the given name, ID, and optional
    99  // state properties that are used to uniquely qualify the lookup (nil if not required).
   100  func GetServiceLinkedRole(ctx *pulumi.Context,
   101  	name string, id pulumi.IDInput, state *ServiceLinkedRoleState, opts ...pulumi.ResourceOption) (*ServiceLinkedRole, error) {
   102  	var resource ServiceLinkedRole
   103  	err := ctx.ReadResource("aws:iam/serviceLinkedRole:ServiceLinkedRole", name, id, state, &resource, opts...)
   104  	if err != nil {
   105  		return nil, err
   106  	}
   107  	return &resource, nil
   108  }
   109  
   110  // Input properties used for looking up and filtering ServiceLinkedRole resources.
   111  type serviceLinkedRoleState struct {
   112  	// The Amazon Resource Name (ARN) specifying the role.
   113  	Arn *string `pulumi:"arn"`
   114  	// The AWS service to which this role is attached. You use a string similar to a URL but without the `http://` in front. For example: `elasticbeanstalk.amazonaws.com`. To find the full list of services that support service-linked roles, check [the docs](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html).
   115  	AwsServiceName *string `pulumi:"awsServiceName"`
   116  	// The creation date of the IAM role.
   117  	CreateDate *string `pulumi:"createDate"`
   118  	// Additional string appended to the role name. Not all AWS services support custom suffixes.
   119  	CustomSuffix *string `pulumi:"customSuffix"`
   120  	// The description of the role.
   121  	Description *string `pulumi:"description"`
   122  	// The name of the role.
   123  	Name *string `pulumi:"name"`
   124  	// The path of the role.
   125  	Path *string `pulumi:"path"`
   126  	// Key-value mapping of tags for the IAM role. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   127  	Tags map[string]string `pulumi:"tags"`
   128  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   129  	//
   130  	// Deprecated: Please use `tags` instead.
   131  	TagsAll map[string]string `pulumi:"tagsAll"`
   132  	// The stable and unique string identifying the role.
   133  	UniqueId *string `pulumi:"uniqueId"`
   134  }
   135  
   136  type ServiceLinkedRoleState struct {
   137  	// The Amazon Resource Name (ARN) specifying the role.
   138  	Arn pulumi.StringPtrInput
   139  	// The AWS service to which this role is attached. You use a string similar to a URL but without the `http://` in front. For example: `elasticbeanstalk.amazonaws.com`. To find the full list of services that support service-linked roles, check [the docs](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html).
   140  	AwsServiceName pulumi.StringPtrInput
   141  	// The creation date of the IAM role.
   142  	CreateDate pulumi.StringPtrInput
   143  	// Additional string appended to the role name. Not all AWS services support custom suffixes.
   144  	CustomSuffix pulumi.StringPtrInput
   145  	// The description of the role.
   146  	Description pulumi.StringPtrInput
   147  	// The name of the role.
   148  	Name pulumi.StringPtrInput
   149  	// The path of the role.
   150  	Path pulumi.StringPtrInput
   151  	// Key-value mapping of tags for the IAM role. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   152  	Tags pulumi.StringMapInput
   153  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   154  	//
   155  	// Deprecated: Please use `tags` instead.
   156  	TagsAll pulumi.StringMapInput
   157  	// The stable and unique string identifying the role.
   158  	UniqueId pulumi.StringPtrInput
   159  }
   160  
   161  func (ServiceLinkedRoleState) ElementType() reflect.Type {
   162  	return reflect.TypeOf((*serviceLinkedRoleState)(nil)).Elem()
   163  }
   164  
   165  type serviceLinkedRoleArgs struct {
   166  	// The AWS service to which this role is attached. You use a string similar to a URL but without the `http://` in front. For example: `elasticbeanstalk.amazonaws.com`. To find the full list of services that support service-linked roles, check [the docs](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html).
   167  	AwsServiceName string `pulumi:"awsServiceName"`
   168  	// Additional string appended to the role name. Not all AWS services support custom suffixes.
   169  	CustomSuffix *string `pulumi:"customSuffix"`
   170  	// The description of the role.
   171  	Description *string `pulumi:"description"`
   172  	// Key-value mapping of tags for the IAM role. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   173  	Tags map[string]string `pulumi:"tags"`
   174  }
   175  
   176  // The set of arguments for constructing a ServiceLinkedRole resource.
   177  type ServiceLinkedRoleArgs struct {
   178  	// The AWS service to which this role is attached. You use a string similar to a URL but without the `http://` in front. For example: `elasticbeanstalk.amazonaws.com`. To find the full list of services that support service-linked roles, check [the docs](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html).
   179  	AwsServiceName pulumi.StringInput
   180  	// Additional string appended to the role name. Not all AWS services support custom suffixes.
   181  	CustomSuffix pulumi.StringPtrInput
   182  	// The description of the role.
   183  	Description pulumi.StringPtrInput
   184  	// Key-value mapping of tags for the IAM role. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   185  	Tags pulumi.StringMapInput
   186  }
   187  
   188  func (ServiceLinkedRoleArgs) ElementType() reflect.Type {
   189  	return reflect.TypeOf((*serviceLinkedRoleArgs)(nil)).Elem()
   190  }
   191  
   192  type ServiceLinkedRoleInput interface {
   193  	pulumi.Input
   194  
   195  	ToServiceLinkedRoleOutput() ServiceLinkedRoleOutput
   196  	ToServiceLinkedRoleOutputWithContext(ctx context.Context) ServiceLinkedRoleOutput
   197  }
   198  
   199  func (*ServiceLinkedRole) ElementType() reflect.Type {
   200  	return reflect.TypeOf((**ServiceLinkedRole)(nil)).Elem()
   201  }
   202  
   203  func (i *ServiceLinkedRole) ToServiceLinkedRoleOutput() ServiceLinkedRoleOutput {
   204  	return i.ToServiceLinkedRoleOutputWithContext(context.Background())
   205  }
   206  
   207  func (i *ServiceLinkedRole) ToServiceLinkedRoleOutputWithContext(ctx context.Context) ServiceLinkedRoleOutput {
   208  	return pulumi.ToOutputWithContext(ctx, i).(ServiceLinkedRoleOutput)
   209  }
   210  
   211  // ServiceLinkedRoleArrayInput is an input type that accepts ServiceLinkedRoleArray and ServiceLinkedRoleArrayOutput values.
   212  // You can construct a concrete instance of `ServiceLinkedRoleArrayInput` via:
   213  //
   214  //	ServiceLinkedRoleArray{ ServiceLinkedRoleArgs{...} }
   215  type ServiceLinkedRoleArrayInput interface {
   216  	pulumi.Input
   217  
   218  	ToServiceLinkedRoleArrayOutput() ServiceLinkedRoleArrayOutput
   219  	ToServiceLinkedRoleArrayOutputWithContext(context.Context) ServiceLinkedRoleArrayOutput
   220  }
   221  
   222  type ServiceLinkedRoleArray []ServiceLinkedRoleInput
   223  
   224  func (ServiceLinkedRoleArray) ElementType() reflect.Type {
   225  	return reflect.TypeOf((*[]*ServiceLinkedRole)(nil)).Elem()
   226  }
   227  
   228  func (i ServiceLinkedRoleArray) ToServiceLinkedRoleArrayOutput() ServiceLinkedRoleArrayOutput {
   229  	return i.ToServiceLinkedRoleArrayOutputWithContext(context.Background())
   230  }
   231  
   232  func (i ServiceLinkedRoleArray) ToServiceLinkedRoleArrayOutputWithContext(ctx context.Context) ServiceLinkedRoleArrayOutput {
   233  	return pulumi.ToOutputWithContext(ctx, i).(ServiceLinkedRoleArrayOutput)
   234  }
   235  
   236  // ServiceLinkedRoleMapInput is an input type that accepts ServiceLinkedRoleMap and ServiceLinkedRoleMapOutput values.
   237  // You can construct a concrete instance of `ServiceLinkedRoleMapInput` via:
   238  //
   239  //	ServiceLinkedRoleMap{ "key": ServiceLinkedRoleArgs{...} }
   240  type ServiceLinkedRoleMapInput interface {
   241  	pulumi.Input
   242  
   243  	ToServiceLinkedRoleMapOutput() ServiceLinkedRoleMapOutput
   244  	ToServiceLinkedRoleMapOutputWithContext(context.Context) ServiceLinkedRoleMapOutput
   245  }
   246  
   247  type ServiceLinkedRoleMap map[string]ServiceLinkedRoleInput
   248  
   249  func (ServiceLinkedRoleMap) ElementType() reflect.Type {
   250  	return reflect.TypeOf((*map[string]*ServiceLinkedRole)(nil)).Elem()
   251  }
   252  
   253  func (i ServiceLinkedRoleMap) ToServiceLinkedRoleMapOutput() ServiceLinkedRoleMapOutput {
   254  	return i.ToServiceLinkedRoleMapOutputWithContext(context.Background())
   255  }
   256  
   257  func (i ServiceLinkedRoleMap) ToServiceLinkedRoleMapOutputWithContext(ctx context.Context) ServiceLinkedRoleMapOutput {
   258  	return pulumi.ToOutputWithContext(ctx, i).(ServiceLinkedRoleMapOutput)
   259  }
   260  
   261  type ServiceLinkedRoleOutput struct{ *pulumi.OutputState }
   262  
   263  func (ServiceLinkedRoleOutput) ElementType() reflect.Type {
   264  	return reflect.TypeOf((**ServiceLinkedRole)(nil)).Elem()
   265  }
   266  
   267  func (o ServiceLinkedRoleOutput) ToServiceLinkedRoleOutput() ServiceLinkedRoleOutput {
   268  	return o
   269  }
   270  
   271  func (o ServiceLinkedRoleOutput) ToServiceLinkedRoleOutputWithContext(ctx context.Context) ServiceLinkedRoleOutput {
   272  	return o
   273  }
   274  
   275  // The Amazon Resource Name (ARN) specifying the role.
   276  func (o ServiceLinkedRoleOutput) Arn() pulumi.StringOutput {
   277  	return o.ApplyT(func(v *ServiceLinkedRole) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   278  }
   279  
   280  // The AWS service to which this role is attached. You use a string similar to a URL but without the `http://` in front. For example: `elasticbeanstalk.amazonaws.com`. To find the full list of services that support service-linked roles, check [the docs](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html).
   281  func (o ServiceLinkedRoleOutput) AwsServiceName() pulumi.StringOutput {
   282  	return o.ApplyT(func(v *ServiceLinkedRole) pulumi.StringOutput { return v.AwsServiceName }).(pulumi.StringOutput)
   283  }
   284  
   285  // The creation date of the IAM role.
   286  func (o ServiceLinkedRoleOutput) CreateDate() pulumi.StringOutput {
   287  	return o.ApplyT(func(v *ServiceLinkedRole) pulumi.StringOutput { return v.CreateDate }).(pulumi.StringOutput)
   288  }
   289  
   290  // Additional string appended to the role name. Not all AWS services support custom suffixes.
   291  func (o ServiceLinkedRoleOutput) CustomSuffix() pulumi.StringPtrOutput {
   292  	return o.ApplyT(func(v *ServiceLinkedRole) pulumi.StringPtrOutput { return v.CustomSuffix }).(pulumi.StringPtrOutput)
   293  }
   294  
   295  // The description of the role.
   296  func (o ServiceLinkedRoleOutput) Description() pulumi.StringPtrOutput {
   297  	return o.ApplyT(func(v *ServiceLinkedRole) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   298  }
   299  
   300  // The name of the role.
   301  func (o ServiceLinkedRoleOutput) Name() pulumi.StringOutput {
   302  	return o.ApplyT(func(v *ServiceLinkedRole) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   303  }
   304  
   305  // The path of the role.
   306  func (o ServiceLinkedRoleOutput) Path() pulumi.StringOutput {
   307  	return o.ApplyT(func(v *ServiceLinkedRole) pulumi.StringOutput { return v.Path }).(pulumi.StringOutput)
   308  }
   309  
   310  // Key-value mapping of tags for the IAM role. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   311  func (o ServiceLinkedRoleOutput) Tags() pulumi.StringMapOutput {
   312  	return o.ApplyT(func(v *ServiceLinkedRole) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   313  }
   314  
   315  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   316  //
   317  // Deprecated: Please use `tags` instead.
   318  func (o ServiceLinkedRoleOutput) TagsAll() pulumi.StringMapOutput {
   319  	return o.ApplyT(func(v *ServiceLinkedRole) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   320  }
   321  
   322  // The stable and unique string identifying the role.
   323  func (o ServiceLinkedRoleOutput) UniqueId() pulumi.StringOutput {
   324  	return o.ApplyT(func(v *ServiceLinkedRole) pulumi.StringOutput { return v.UniqueId }).(pulumi.StringOutput)
   325  }
   326  
   327  type ServiceLinkedRoleArrayOutput struct{ *pulumi.OutputState }
   328  
   329  func (ServiceLinkedRoleArrayOutput) ElementType() reflect.Type {
   330  	return reflect.TypeOf((*[]*ServiceLinkedRole)(nil)).Elem()
   331  }
   332  
   333  func (o ServiceLinkedRoleArrayOutput) ToServiceLinkedRoleArrayOutput() ServiceLinkedRoleArrayOutput {
   334  	return o
   335  }
   336  
   337  func (o ServiceLinkedRoleArrayOutput) ToServiceLinkedRoleArrayOutputWithContext(ctx context.Context) ServiceLinkedRoleArrayOutput {
   338  	return o
   339  }
   340  
   341  func (o ServiceLinkedRoleArrayOutput) Index(i pulumi.IntInput) ServiceLinkedRoleOutput {
   342  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ServiceLinkedRole {
   343  		return vs[0].([]*ServiceLinkedRole)[vs[1].(int)]
   344  	}).(ServiceLinkedRoleOutput)
   345  }
   346  
   347  type ServiceLinkedRoleMapOutput struct{ *pulumi.OutputState }
   348  
   349  func (ServiceLinkedRoleMapOutput) ElementType() reflect.Type {
   350  	return reflect.TypeOf((*map[string]*ServiceLinkedRole)(nil)).Elem()
   351  }
   352  
   353  func (o ServiceLinkedRoleMapOutput) ToServiceLinkedRoleMapOutput() ServiceLinkedRoleMapOutput {
   354  	return o
   355  }
   356  
   357  func (o ServiceLinkedRoleMapOutput) ToServiceLinkedRoleMapOutputWithContext(ctx context.Context) ServiceLinkedRoleMapOutput {
   358  	return o
   359  }
   360  
   361  func (o ServiceLinkedRoleMapOutput) MapIndex(k pulumi.StringInput) ServiceLinkedRoleOutput {
   362  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ServiceLinkedRole {
   363  		return vs[0].(map[string]*ServiceLinkedRole)[vs[1].(string)]
   364  	}).(ServiceLinkedRoleOutput)
   365  }
   366  
   367  func init() {
   368  	pulumi.RegisterInputType(reflect.TypeOf((*ServiceLinkedRoleInput)(nil)).Elem(), &ServiceLinkedRole{})
   369  	pulumi.RegisterInputType(reflect.TypeOf((*ServiceLinkedRoleArrayInput)(nil)).Elem(), ServiceLinkedRoleArray{})
   370  	pulumi.RegisterInputType(reflect.TypeOf((*ServiceLinkedRoleMapInput)(nil)).Elem(), ServiceLinkedRoleMap{})
   371  	pulumi.RegisterOutputType(ServiceLinkedRoleOutput{})
   372  	pulumi.RegisterOutputType(ServiceLinkedRoleArrayOutput{})
   373  	pulumi.RegisterOutputType(ServiceLinkedRoleMapOutput{})
   374  }