github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/rds/roleAssociation.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 rds
     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  // Manages an RDS DB Instance association with an IAM Role. Example use cases:
    16  //
    17  // * [Amazon RDS Oracle integration with Amazon S3](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/oracle-s3-integration.html)
    18  // * [Importing Amazon S3 Data into an RDS PostgreSQL DB Instance](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PostgreSQL.S3Import.html)
    19  //
    20  // > To manage the RDS DB Instance IAM Role for [Enhanced Monitoring](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Monitoring.OS.html), see the `rds.Instance` resource `monitoringRoleArn` argument instead.
    21  //
    22  // ## Example Usage
    23  //
    24  // <!--Start PulumiCodeChooser -->
    25  // ```go
    26  // package main
    27  //
    28  // import (
    29  //
    30  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/rds"
    31  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    32  //
    33  // )
    34  //
    35  //	func main() {
    36  //		pulumi.Run(func(ctx *pulumi.Context) error {
    37  //			_, err := rds.NewRoleAssociation(ctx, "example", &rds.RoleAssociationArgs{
    38  //				DbInstanceIdentifier: pulumi.Any(exampleAwsDbInstance.Identifier),
    39  //				FeatureName:          pulumi.String("S3_INTEGRATION"),
    40  //				RoleArn:              pulumi.Any(exampleAwsIamRole.Arn),
    41  //			})
    42  //			if err != nil {
    43  //				return err
    44  //			}
    45  //			return nil
    46  //		})
    47  //	}
    48  //
    49  // ```
    50  // <!--End PulumiCodeChooser -->
    51  //
    52  // ## Import
    53  //
    54  // Using `pulumi import`, import `aws_db_instance_role_association` using the DB Instance Identifier and IAM Role ARN separated by a comma (`,`). For example:
    55  //
    56  // ```sh
    57  // $ pulumi import aws:rds/roleAssociation:RoleAssociation example my-db-instance,arn:aws:iam::123456789012:role/my-role
    58  // ```
    59  type RoleAssociation struct {
    60  	pulumi.CustomResourceState
    61  
    62  	// DB Instance Identifier to associate with the IAM Role.
    63  	DbInstanceIdentifier pulumi.StringOutput `pulumi:"dbInstanceIdentifier"`
    64  	// Name of the feature for association. This can be found in the AWS documentation relevant to the integration or a full list is available in the `SupportedFeatureNames` list returned by [AWS CLI rds describe-db-engine-versions](https://docs.aws.amazon.com/cli/latest/reference/rds/describe-db-engine-versions.html).
    65  	FeatureName pulumi.StringOutput `pulumi:"featureName"`
    66  	// Amazon Resource Name (ARN) of the IAM Role to associate with the DB Instance.
    67  	RoleArn pulumi.StringOutput `pulumi:"roleArn"`
    68  }
    69  
    70  // NewRoleAssociation registers a new resource with the given unique name, arguments, and options.
    71  func NewRoleAssociation(ctx *pulumi.Context,
    72  	name string, args *RoleAssociationArgs, opts ...pulumi.ResourceOption) (*RoleAssociation, error) {
    73  	if args == nil {
    74  		return nil, errors.New("missing one or more required arguments")
    75  	}
    76  
    77  	if args.DbInstanceIdentifier == nil {
    78  		return nil, errors.New("invalid value for required argument 'DbInstanceIdentifier'")
    79  	}
    80  	if args.FeatureName == nil {
    81  		return nil, errors.New("invalid value for required argument 'FeatureName'")
    82  	}
    83  	if args.RoleArn == nil {
    84  		return nil, errors.New("invalid value for required argument 'RoleArn'")
    85  	}
    86  	opts = internal.PkgResourceDefaultOpts(opts)
    87  	var resource RoleAssociation
    88  	err := ctx.RegisterResource("aws:rds/roleAssociation:RoleAssociation", name, args, &resource, opts...)
    89  	if err != nil {
    90  		return nil, err
    91  	}
    92  	return &resource, nil
    93  }
    94  
    95  // GetRoleAssociation gets an existing RoleAssociation resource's state with the given name, ID, and optional
    96  // state properties that are used to uniquely qualify the lookup (nil if not required).
    97  func GetRoleAssociation(ctx *pulumi.Context,
    98  	name string, id pulumi.IDInput, state *RoleAssociationState, opts ...pulumi.ResourceOption) (*RoleAssociation, error) {
    99  	var resource RoleAssociation
   100  	err := ctx.ReadResource("aws:rds/roleAssociation:RoleAssociation", name, id, state, &resource, opts...)
   101  	if err != nil {
   102  		return nil, err
   103  	}
   104  	return &resource, nil
   105  }
   106  
   107  // Input properties used for looking up and filtering RoleAssociation resources.
   108  type roleAssociationState struct {
   109  	// DB Instance Identifier to associate with the IAM Role.
   110  	DbInstanceIdentifier *string `pulumi:"dbInstanceIdentifier"`
   111  	// Name of the feature for association. This can be found in the AWS documentation relevant to the integration or a full list is available in the `SupportedFeatureNames` list returned by [AWS CLI rds describe-db-engine-versions](https://docs.aws.amazon.com/cli/latest/reference/rds/describe-db-engine-versions.html).
   112  	FeatureName *string `pulumi:"featureName"`
   113  	// Amazon Resource Name (ARN) of the IAM Role to associate with the DB Instance.
   114  	RoleArn *string `pulumi:"roleArn"`
   115  }
   116  
   117  type RoleAssociationState struct {
   118  	// DB Instance Identifier to associate with the IAM Role.
   119  	DbInstanceIdentifier pulumi.StringPtrInput
   120  	// Name of the feature for association. This can be found in the AWS documentation relevant to the integration or a full list is available in the `SupportedFeatureNames` list returned by [AWS CLI rds describe-db-engine-versions](https://docs.aws.amazon.com/cli/latest/reference/rds/describe-db-engine-versions.html).
   121  	FeatureName pulumi.StringPtrInput
   122  	// Amazon Resource Name (ARN) of the IAM Role to associate with the DB Instance.
   123  	RoleArn pulumi.StringPtrInput
   124  }
   125  
   126  func (RoleAssociationState) ElementType() reflect.Type {
   127  	return reflect.TypeOf((*roleAssociationState)(nil)).Elem()
   128  }
   129  
   130  type roleAssociationArgs struct {
   131  	// DB Instance Identifier to associate with the IAM Role.
   132  	DbInstanceIdentifier string `pulumi:"dbInstanceIdentifier"`
   133  	// Name of the feature for association. This can be found in the AWS documentation relevant to the integration or a full list is available in the `SupportedFeatureNames` list returned by [AWS CLI rds describe-db-engine-versions](https://docs.aws.amazon.com/cli/latest/reference/rds/describe-db-engine-versions.html).
   134  	FeatureName string `pulumi:"featureName"`
   135  	// Amazon Resource Name (ARN) of the IAM Role to associate with the DB Instance.
   136  	RoleArn string `pulumi:"roleArn"`
   137  }
   138  
   139  // The set of arguments for constructing a RoleAssociation resource.
   140  type RoleAssociationArgs struct {
   141  	// DB Instance Identifier to associate with the IAM Role.
   142  	DbInstanceIdentifier pulumi.StringInput
   143  	// Name of the feature for association. This can be found in the AWS documentation relevant to the integration or a full list is available in the `SupportedFeatureNames` list returned by [AWS CLI rds describe-db-engine-versions](https://docs.aws.amazon.com/cli/latest/reference/rds/describe-db-engine-versions.html).
   144  	FeatureName pulumi.StringInput
   145  	// Amazon Resource Name (ARN) of the IAM Role to associate with the DB Instance.
   146  	RoleArn pulumi.StringInput
   147  }
   148  
   149  func (RoleAssociationArgs) ElementType() reflect.Type {
   150  	return reflect.TypeOf((*roleAssociationArgs)(nil)).Elem()
   151  }
   152  
   153  type RoleAssociationInput interface {
   154  	pulumi.Input
   155  
   156  	ToRoleAssociationOutput() RoleAssociationOutput
   157  	ToRoleAssociationOutputWithContext(ctx context.Context) RoleAssociationOutput
   158  }
   159  
   160  func (*RoleAssociation) ElementType() reflect.Type {
   161  	return reflect.TypeOf((**RoleAssociation)(nil)).Elem()
   162  }
   163  
   164  func (i *RoleAssociation) ToRoleAssociationOutput() RoleAssociationOutput {
   165  	return i.ToRoleAssociationOutputWithContext(context.Background())
   166  }
   167  
   168  func (i *RoleAssociation) ToRoleAssociationOutputWithContext(ctx context.Context) RoleAssociationOutput {
   169  	return pulumi.ToOutputWithContext(ctx, i).(RoleAssociationOutput)
   170  }
   171  
   172  // RoleAssociationArrayInput is an input type that accepts RoleAssociationArray and RoleAssociationArrayOutput values.
   173  // You can construct a concrete instance of `RoleAssociationArrayInput` via:
   174  //
   175  //	RoleAssociationArray{ RoleAssociationArgs{...} }
   176  type RoleAssociationArrayInput interface {
   177  	pulumi.Input
   178  
   179  	ToRoleAssociationArrayOutput() RoleAssociationArrayOutput
   180  	ToRoleAssociationArrayOutputWithContext(context.Context) RoleAssociationArrayOutput
   181  }
   182  
   183  type RoleAssociationArray []RoleAssociationInput
   184  
   185  func (RoleAssociationArray) ElementType() reflect.Type {
   186  	return reflect.TypeOf((*[]*RoleAssociation)(nil)).Elem()
   187  }
   188  
   189  func (i RoleAssociationArray) ToRoleAssociationArrayOutput() RoleAssociationArrayOutput {
   190  	return i.ToRoleAssociationArrayOutputWithContext(context.Background())
   191  }
   192  
   193  func (i RoleAssociationArray) ToRoleAssociationArrayOutputWithContext(ctx context.Context) RoleAssociationArrayOutput {
   194  	return pulumi.ToOutputWithContext(ctx, i).(RoleAssociationArrayOutput)
   195  }
   196  
   197  // RoleAssociationMapInput is an input type that accepts RoleAssociationMap and RoleAssociationMapOutput values.
   198  // You can construct a concrete instance of `RoleAssociationMapInput` via:
   199  //
   200  //	RoleAssociationMap{ "key": RoleAssociationArgs{...} }
   201  type RoleAssociationMapInput interface {
   202  	pulumi.Input
   203  
   204  	ToRoleAssociationMapOutput() RoleAssociationMapOutput
   205  	ToRoleAssociationMapOutputWithContext(context.Context) RoleAssociationMapOutput
   206  }
   207  
   208  type RoleAssociationMap map[string]RoleAssociationInput
   209  
   210  func (RoleAssociationMap) ElementType() reflect.Type {
   211  	return reflect.TypeOf((*map[string]*RoleAssociation)(nil)).Elem()
   212  }
   213  
   214  func (i RoleAssociationMap) ToRoleAssociationMapOutput() RoleAssociationMapOutput {
   215  	return i.ToRoleAssociationMapOutputWithContext(context.Background())
   216  }
   217  
   218  func (i RoleAssociationMap) ToRoleAssociationMapOutputWithContext(ctx context.Context) RoleAssociationMapOutput {
   219  	return pulumi.ToOutputWithContext(ctx, i).(RoleAssociationMapOutput)
   220  }
   221  
   222  type RoleAssociationOutput struct{ *pulumi.OutputState }
   223  
   224  func (RoleAssociationOutput) ElementType() reflect.Type {
   225  	return reflect.TypeOf((**RoleAssociation)(nil)).Elem()
   226  }
   227  
   228  func (o RoleAssociationOutput) ToRoleAssociationOutput() RoleAssociationOutput {
   229  	return o
   230  }
   231  
   232  func (o RoleAssociationOutput) ToRoleAssociationOutputWithContext(ctx context.Context) RoleAssociationOutput {
   233  	return o
   234  }
   235  
   236  // DB Instance Identifier to associate with the IAM Role.
   237  func (o RoleAssociationOutput) DbInstanceIdentifier() pulumi.StringOutput {
   238  	return o.ApplyT(func(v *RoleAssociation) pulumi.StringOutput { return v.DbInstanceIdentifier }).(pulumi.StringOutput)
   239  }
   240  
   241  // Name of the feature for association. This can be found in the AWS documentation relevant to the integration or a full list is available in the `SupportedFeatureNames` list returned by [AWS CLI rds describe-db-engine-versions](https://docs.aws.amazon.com/cli/latest/reference/rds/describe-db-engine-versions.html).
   242  func (o RoleAssociationOutput) FeatureName() pulumi.StringOutput {
   243  	return o.ApplyT(func(v *RoleAssociation) pulumi.StringOutput { return v.FeatureName }).(pulumi.StringOutput)
   244  }
   245  
   246  // Amazon Resource Name (ARN) of the IAM Role to associate with the DB Instance.
   247  func (o RoleAssociationOutput) RoleArn() pulumi.StringOutput {
   248  	return o.ApplyT(func(v *RoleAssociation) pulumi.StringOutput { return v.RoleArn }).(pulumi.StringOutput)
   249  }
   250  
   251  type RoleAssociationArrayOutput struct{ *pulumi.OutputState }
   252  
   253  func (RoleAssociationArrayOutput) ElementType() reflect.Type {
   254  	return reflect.TypeOf((*[]*RoleAssociation)(nil)).Elem()
   255  }
   256  
   257  func (o RoleAssociationArrayOutput) ToRoleAssociationArrayOutput() RoleAssociationArrayOutput {
   258  	return o
   259  }
   260  
   261  func (o RoleAssociationArrayOutput) ToRoleAssociationArrayOutputWithContext(ctx context.Context) RoleAssociationArrayOutput {
   262  	return o
   263  }
   264  
   265  func (o RoleAssociationArrayOutput) Index(i pulumi.IntInput) RoleAssociationOutput {
   266  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *RoleAssociation {
   267  		return vs[0].([]*RoleAssociation)[vs[1].(int)]
   268  	}).(RoleAssociationOutput)
   269  }
   270  
   271  type RoleAssociationMapOutput struct{ *pulumi.OutputState }
   272  
   273  func (RoleAssociationMapOutput) ElementType() reflect.Type {
   274  	return reflect.TypeOf((*map[string]*RoleAssociation)(nil)).Elem()
   275  }
   276  
   277  func (o RoleAssociationMapOutput) ToRoleAssociationMapOutput() RoleAssociationMapOutput {
   278  	return o
   279  }
   280  
   281  func (o RoleAssociationMapOutput) ToRoleAssociationMapOutputWithContext(ctx context.Context) RoleAssociationMapOutput {
   282  	return o
   283  }
   284  
   285  func (o RoleAssociationMapOutput) MapIndex(k pulumi.StringInput) RoleAssociationOutput {
   286  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *RoleAssociation {
   287  		return vs[0].(map[string]*RoleAssociation)[vs[1].(string)]
   288  	}).(RoleAssociationOutput)
   289  }
   290  
   291  func init() {
   292  	pulumi.RegisterInputType(reflect.TypeOf((*RoleAssociationInput)(nil)).Elem(), &RoleAssociation{})
   293  	pulumi.RegisterInputType(reflect.TypeOf((*RoleAssociationArrayInput)(nil)).Elem(), RoleAssociationArray{})
   294  	pulumi.RegisterInputType(reflect.TypeOf((*RoleAssociationMapInput)(nil)).Elem(), RoleAssociationMap{})
   295  	pulumi.RegisterOutputType(RoleAssociationOutput{})
   296  	pulumi.RegisterOutputType(RoleAssociationArrayOutput{})
   297  	pulumi.RegisterOutputType(RoleAssociationMapOutput{})
   298  }