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