Repository: crossplane-contrib/provider-aws (go)

Issue:
RDSInstance.forProvider.caCertificateIdentifier should be set when CreateDBInstance is run.
### What problem are you facing?
`RDSInstance.forProvider.caCertificateIdentifier` will currently only be updated during a `ModifyDBInstance` call, see [#1889](https://github.com/crossplane-contrib/provider-aws/issues/1889) for more information.

This can be confusing if you have set`spec.forProvider.applyModificationsImmediately = false` and you miss your modification window.

### How could Crossplane help solve your problem?
The value of `RDSInstance.forProvider.caCertificateIdentifier` should be set during the createDBInstance call.
This value is supported as of [rds@v1.39.0](https://github.com/aws/aws-sdk-go-v2/blob/release-2023-10-18/service/rds/CHANGELOG.md#v1390-2023-01-05)




Pull request:
feat(database): Pass CACertificateIdentifier during instance creation
### Description of your changes

Updated github.com/aws/aws-sdk-go-v2/service/rds to v1.39.0  so that `CACertificateIdentifier` is set at `CreateDBInstance` time instead of having to wait for the first `ModifyDBInstance` window.

Fixes #1931

I have:

- [x] Read and followed Crossplane's [contribution process].
- [x] Run `make reviewable test` to ensure this PR is ready for review.

### How has this code been tested

Created a new RDS instance to check that it passes in `CACertificateIdentifier` as part of the CreateDBInstance API call.


[contribution process]: https://git.io/fj2m9


Patch:
diff --git a/go.mod b/go.mod
index 13b7b73df..c959072da 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,7 @@ go 1.21
 require (
 	github.com/aws-controllers-k8s/code-generator v0.26.1
 	github.com/aws/aws-sdk-go v1.44.334
-	github.com/aws/aws-sdk-go-v2 v1.16.16
+	github.com/aws/aws-sdk-go-v2 v1.17.3
 	github.com/aws/aws-sdk-go-v2/config v1.11.1
 	github.com/aws/aws-sdk-go-v2/credentials v1.6.5
 	github.com/aws/aws-sdk-go-v2/service/acm v1.10.0
@@ -19,7 +19,7 @@ require (
 	github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.10.0
 	github.com/aws/aws-sdk-go-v2/service/iam v1.14.0
 	github.com/aws/aws-sdk-go-v2/service/lambda v1.21.1
-	github.com/aws/aws-sdk-go-v2/service/rds v1.14.0
+	github.com/aws/aws-sdk-go-v2/service/rds v1.39.0
 	github.com/aws/aws-sdk-go-v2/service/redshift v1.17.0
 	github.com/aws/aws-sdk-go-v2/service/route53 v1.15.0
 	github.com/aws/aws-sdk-go-v2/service/route53resolver v1.10.2
@@ -27,7 +27,7 @@ require (
 	github.com/aws/aws-sdk-go-v2/service/sns v1.13.0
 	github.com/aws/aws-sdk-go-v2/service/sqs v1.14.0
 	github.com/aws/aws-sdk-go-v2/service/sts v1.12.0
-	github.com/aws/smithy-go v1.13.3
+	github.com/aws/smithy-go v1.13.5
 	github.com/crossplane/crossplane-runtime v1.13.0
 	github.com/crossplane/crossplane-tools v0.0.0-20230714144037-2684f4bc7638
 	github.com/evanphx/json-patch v4.12.0+incompatible
@@ -57,11 +57,11 @@ require (
 	github.com/aws-controllers-k8s/pkg v0.0.4 // indirect
 	github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.0.0 // indirect
 	github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.8.2 // indirect
-	github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.23 // indirect
-	github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.17 // indirect
+	github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.27 // indirect
+	github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.21 // indirect
 	github.com/aws/aws-sdk-go-v2/internal/ini v1.3.2 // indirect
 	github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.5.0 // indirect
-	github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.5.2 // indirect
+	github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.21 // indirect
 	github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.9.2 // indirect
 	github.com/aws/aws-sdk-go-v2/service/sso v1.7.0 // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
diff --git a/go.sum b/go.sum
index 2f4cbeb27..439a86a57 100644
--- a/go.sum
+++ b/go.sum
@@ -99,8 +99,9 @@ github.com/aws/aws-sdk-go-v2 v1.10.0/go.mod h1:U/EyyVvKtzmFeQQcca7eBotKdlpcP2zzU
 github.com/aws/aws-sdk-go-v2 v1.11.2/go.mod h1:SQfA+m2ltnu1cA0soUkj4dRSsmITiVQUJvBIZjzfPyQ=
 github.com/aws/aws-sdk-go-v2 v1.16.2/go.mod h1:ytwTPBG6fXTZLxxeeCCWj2/EMYp/xDUgX+OET6TLNNU=
 github.com/aws/aws-sdk-go-v2 v1.16.7/go.mod h1:6CpKuLXg2w7If3ABZCl/qZ6rEgwtjZTn4eAf4RcEyuw=
-github.com/aws/aws-sdk-go-v2 v1.16.16 h1:M1fj4FE2lB4NzRb9Y0xdWsn2P0+2UHVxwKyOa4YJNjk=
 github.com/aws/aws-sdk-go-v2 v1.16.16/go.mod h1:SwiyXi/1zTUZ6KIAmLK5V5ll8SiURNUYOqTerZPaF9k=
+github.com/aws/aws-sdk-go-v2 v1.17.3 h1:shN7NlnVzvDUgPQ+1rLMSxY8OWRNDRYtiqe0p/PgrhY=
+github.com/aws/aws-sdk-go-v2 v1.17.3/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw=
 github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.0.0 h1:yVUAwvJC/0WNPbyl0nA3j1L6CW1CN8wBubCRqtG7JLI=
 github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.0.0/go.mod h1:Xn6sxgRuIDflLRJFj5Ev7UxABIkNbccFPV/p8itDReM=
 github.com/aws/aws-sdk-go-v2/config v1.11.1 h1:KXSjb7ZMLRtjxClFptukTYibiOqJS9NwBO+9WD3UMto=
@@ -112,13 +113,15 @@ github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.8.2/go.mod h1:dF2F6tXEOgmW5X1ZF
 github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.2/go.mod h1:SgKKNBIoDC/E1ZCDhhMW3yalWjwuLjMcpLzsM/QQnWo=
 github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.9/go.mod h1:AnVH5pvai0pAF4lXRq0bmhbes1u9R8wTE+g+183bZNM=
 github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.14/go.mod h1:kdjrMwHwrC3+FsKhNcCMJ7tUVj/8uSD5CZXeQ4wV6fM=
-github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.23 h1:s4g/wnzMf+qepSNgTvaQQHNxyMLKSawNhKCPNy++2xY=
 github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.23/go.mod h1:2DFxAQ9pfIRy0imBCJv+vZ2X6RKxves6fbnEuSry6b4=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.27 h1:I3cakv2Uy1vNmmhRQmFptYDxOvBnwCdNwyw63N0RaRU=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.27/go.mod h1:a1/UpzeyBBerajpnP5nGZa9mGzsBn5cOKxm6NWQsvoI=
 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.0.2/go.mod h1:xT4XX6w5Sa3dhg50JrYyy3e4WPYo/+WjY/BXtqXVunU=
 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.3/go.mod h1:ssOhaLpRlh88H3UmEcsBoVKq309quMvm3Ds8e9d4eJM=
 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.8/go.mod h1:ZIV8GYoC6WLBW5KGs+o4rsc65/ozd+eQ0L31XF5VDwk=
-github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.17 h1:/K482T5A3623WJgWT8w1yRAFK4RzGzEl7y39yhtn9eA=
 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.17/go.mod h1:pRwaTYCJemADaqCbUAxltMoHKata7hmB5PjEXeu0kfg=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.21 h1:5NbbMrIzmUn/TXFqAle6mgrH5m9cOvMLRGL7pnG8tRE=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.21/go.mod h1:+Gxn8jYn5k9ebfHEqlhrMirFjSW0v0C9fI+KN5vk2kE=
 github.com/aws/aws-sdk-go-v2/internal/ini v1.3.2 h1:IQup8Q6lorXeiA/rK72PeToWoWK8h7VAPgHNWdSrtgE=
 github.com/aws/aws-sdk-go-v2/internal/ini v1.3.2/go.mod h1:VITe/MdW6EMXPb0o0txu/fsonXbMHUU2OC2Qp7ivU4o=
 github.com/aws/aws-sdk-go-v2/service/acm v1.10.0 h1:h00NJuGEVi36k1BkVMpJQRRyye2SaPaCv2tQD0rm/uE=
@@ -143,14 +146,15 @@ github.com/aws/aws-sdk-go-v2/service/iam v1.14.0 h1:j4rKVLd4ASdTCWqCxt/p99S6BpA6
 github.com/aws/aws-sdk-go-v2/service/iam v1.14.0/go.mod h1:O13Qz5IqQmrLCQYw8l4luBDLNxOIlCAYUS0i+0ySOTk=
 github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.5.0 h1:lPLbw4Gn59uoKqvOfSnkJr54XWk5Ak1NK20ZEiSWb3U=
 github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.5.0/go.mod h1:80NaCIH9YU3rzTTs/J/ECATjXuRqzo/wB6ukO6MZ0XY=
-github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.5.2 h1:CKdUNKmuilw/KNmO2Q53Av8u+ZyXMC2M9aX8Z+c/gzg=
 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.5.2/go.mod h1:FgR1tCsn8C6+Hf+N5qkfrE4IXvUL1RgW87sunJ+5J4I=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.21 h1:5C6XgTViSb0bunmU57b3CT+MhxULqHH2721FVA+/kDM=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.21/go.mod h1:lRToEJsn+DRA9lW4O9L9+/3hjTkUzlzyzHqn8MTds5k=
 github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.9.2 h1:GnPGH1FGc4fkn0Jbm/8r2+nPOwSJjYPyHSqFSvY1ii8=
 github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.9.2/go.mod h1:eDUYjOYt4Uio7xfHi5jOsO393ZG8TSfZB92a3ZNadWM=
 github.com/aws/aws-sdk-go-v2/service/lambda v1.21.1 h1:xS9qXT9z7w59VoK4XI3rxe+GkpDRHgVd4lxapEJW7bE=
 github.com/aws/aws-sdk-go-v2/service/lambda v1.21.1/go.mod h1:1/klj5RfSVnRVLC6qnZYnJqL8RcKhi4KHDm5BwnilOY=
-github.com/aws/aws-sdk-go-v2/service/rds v1.14.0 h1:5b2q6oYmh2pZA6Ys2kPnzlKfKT+Z7s5hn4RGHBDOTmg=
-github.com/aws/aws-sdk-go-v2/service/rds v1.14.0/go.mod h1:Dw97zw/NALZ7oB0NLSGbRNXO9aPkip5cDnjSgudHbCE=
+github.com/aws/aws-sdk-go-v2/service/rds v1.39.0 h1:SnusHwHQWMZxlS5gvRfzsg1Odq7gWl3STP4aUIqzRGE=
+github.com/aws/aws-sdk-go-v2/service/rds v1.39.0/go.mod h1:Ume9NHqT871hUdxIRojWtWsPFyCswQmSjHHhyGot7v0=
 github.com/aws/aws-sdk-go-v2/service/redshift v1.17.0 h1:MhHapcuStJuX86Pk9+H6d3pk46xUpdV48NkEItRMyOc=
 github.com/aws/aws-sdk-go-v2/service/redshift v1.17.0/go.mod h1:MFxHzFKSXjT0CUjOpTaeeuqxcP6+uuQMvzkhTEdIEUM=
 github.com/aws/aws-sdk-go-v2/service/route53 v1.15.0 h1:TtL2aQTyJ/6HOpySI81wUcz5CaLNLCblBEprVYemK/g=
@@ -171,8 +175,9 @@ github.com/aws/smithy-go v1.8.1/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAm
 github.com/aws/smithy-go v1.9.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E=
 github.com/aws/smithy-go v1.11.2/go.mod h1:3xHYmszWVx2c0kIwQeEVf9uSm4fYZt67FBJnwub1bgM=
 github.com/aws/smithy-go v1.12.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
-github.com/aws/smithy-go v1.13.3 h1:l7LYxGuzK6/K+NzJ2mC+VvLUbae0sL3bXU//04MkmnA=
 github.com/aws/smithy-go v1.13.3/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
+github.com/aws/smithy-go v1.13.5 h1:hgz0X/DX0dGqTYpGALqXJoRKRj5oQ7150i5FdTePzO8=
+github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
 github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
 github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
 github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
diff --git a/pkg/clients/database/rds.go b/pkg/clients/database/rds.go
index 8511b6866..e59564215 100644
--- a/pkg/clients/database/rds.go
+++ b/pkg/clients/database/rds.go
@@ -82,6 +82,7 @@ func GenerateCreateRDSInstanceInput(name, password string, p *v1beta1.RDSInstanc
 		AutoMinorVersionUpgrade:            p.AutoMinorVersionUpgrade,
 		AvailabilityZone:                   p.AvailabilityZone,
 		BackupRetentionPeriod:              pointer.Int32Address(p.BackupRetentionPeriod),
+		CACertificateIdentifier:            p.CACertificateIdentifier,
 		CharacterSetName:                   p.CharacterSetName,
 		CopyTagsToSnapshot:                 p.CopyTagsToSnapshot,
 		DBClusterIdentifier:                p.DBClusterIdentifier,


Test patch:
diff --git a/pkg/clients/database/rds_test.go b/pkg/clients/database/rds_test.go
index be823826c..7adc8951c 100644
--- a/pkg/clients/database/rds_test.go
+++ b/pkg/clients/database/rds_test.go
@@ -43,6 +43,7 @@ import (
 )
 
 var (
+	allFieldsName                      = "allfieldsName"
 	allocatedStorage             int32 = 20
 	address                            = "address"
 	arn                                = "my:arn"
@@ -50,6 +51,7 @@ var (
 	characterSetName                   = "utf8"
 	clusterName                        = "testCluster"
 	dbName                             = "example-name"
+	dbSecurityGroups                   = []string{"test"}
 	description                        = "testDescription"
 	domain                             = "domain"
 	enableCloudwatchExports            = []string{"test"}
@@ -57,6 +59,7 @@ var (
 	enabledCloudwatchExportsNone       = []string{}
 	engine                             = "5.6.41"
 	falseFlag                          = false
+	iamRole                            = "iamRole"
 	instanceClass                      = "class"
 	kmsID                              = "kms"
 	monitoring                         = 3
@@ -79,6 +82,7 @@ var (
 	username                           = "username"
 	value                              = "testValue"
 	vpc                                = "vpc"
+	vpcIds                             = []string{"test"}
 	window                             = "window"
 	zone                               = "zone"
 
@@ -1255,11 +1259,7 @@ func TestLateInitialize(t *testing.T) {
 }
 
 func TestGenerateModifyDBInstanceInput(t *testing.T) {
-	dbSecurityGroups := []string{name}
-	allFieldsName := "allfieldsName"
 	emptyName := "emptyProcessor"
-	iamRole := "iamRole"
-	vpcIds := []string{name}
 
 	cases := map[string]struct {
 		name   string
@@ -1388,3 +1388,121 @@ func TestGenerateModifyDBInstanceInput(t *testing.T) {
 		})
 	}
 }
+
+func TestGenerateCreateRDSInstanceInput(t *testing.T) {
+	cases := map[string]struct {
+		name     string
+		password string
+		params   v1beta1.RDSInstanceParameters
+		want     rds.CreateDBInstanceInput
+	}{
+		"AllFields": {
+			name: allFieldsName,
+			params: v1beta1.RDSInstanceParameters{
+				AllocatedStorage:                   &storage,
+				DBInstanceClass:                    instanceClass,
+				ApplyModificationsImmediately:      &trueFlag,
+				Engine:                             engine,
+				EngineVersion:                      &engine,
+				AutoMinorVersionUpgrade:            &trueFlag,
+				AllowMajorVersionUpgrade:           &trueFlag,
+				AvailabilityZone:                   &az,
+				BackupRetentionPeriod:              &retention,
+				CACertificateIdentifier:            &name,
+				CharacterSetName:                   &name,
+				CopyTagsToSnapshot:                 &trueFlag,
+				DBClusterIdentifier:                &clusterName,
+				DBName:                             &name,
+				DBParameterGroupName:               &name,
+				DeletionProtection:                 &trueFlag,
+				Domain:                             &domain,
+				DomainIAMRoleName:                  &iamRole,
+				EnableIAMDatabaseAuthentication:    &trueFlag,
+				EnablePerformanceInsights:          &trueFlag,
+				IOPS:                               &storage,
+				KMSKeyID:                           &kmsID,
+				LicenseModel:                       &name,
+				MasterUsername:                     &username,
+				MonitoringInterval:                 &monitoring,
+				MonitoringRoleARN:                  &arn,
+				MultiAZ:                            &multiAZ,
+				OptionGroupName:                    &name,
+				PerformanceInsightsKMSKeyID:        &kmsID,
+				PerformanceInsightsRetentionPeriod: &retention,
+				Port:                               &port,
+				PreferredBackupWindow:              &window,
+				PreferredMaintenanceWindow:         &window,
+				PromotionTier:                      &tier,
+				PubliclyAccessible:                 &trueFlag,
+				StorageEncrypted:                   &trueFlag,
+				StorageType:                        &storageType,
+				Timezone:                           &zone,
+				DBSecurityGroups:                   dbSecurityGroups,
+				DBSubnetGroupName:                  &name,
+				EnableCloudwatchLogsExports:        enableCloudwatchExports,
+				ProcessorFeatures: []v1beta1.ProcessorFeature{{
+					Name:  name,
+					Value: value,
+				}},
+				VPCSecurityGroupIDs:         vpcIds,
+				UseDefaultProcessorFeatures: &trueFlag,
+			},
+			want: rds.CreateDBInstanceInput{
+				DBInstanceIdentifier:               &allFieldsName,
+				AvailabilityZone:                   &az,
+				AllocatedStorage:                   &storage32,
+				AutoMinorVersionUpgrade:            &trueFlag,
+				BackupRetentionPeriod:              &retention32,
+				CACertificateIdentifier:            &name,
+				CharacterSetName:                   &name,
+				CopyTagsToSnapshot:                 &trueFlag,
+				DBClusterIdentifier:                &clusterName,
+				DBInstanceClass:                    &instanceClass,
+				DBName:                             &name,
+				DBParameterGroupName:               &name,
+				DBSecurityGroups:                   dbSecurityGroups,
+				DBSubnetGroupName:                  &name,
+				DeletionProtection:                 &trueFlag,
+				Domain:                             &domain,
+				DomainIAMRoleName:                  &iamRole,
+				EnableIAMDatabaseAuthentication:    &trueFlag,
+				EnableCloudwatchLogsExports:        enableCloudwatchExports,
+				EnablePerformanceInsights:          &trueFlag,
+				Engine:                             &engine,
+				EngineVersion:                      &engine,
+				Iops:                               &storage32,
+				KmsKeyId:                           &kmsID,
+				LicenseModel:                       &name,
+				MasterUsername:                     &username,
+				MonitoringInterval:                 &monitoring32,
+				MonitoringRoleArn:                  &arn,
+				MultiAZ:                            &multiAZ,
+				OptionGroupName:                    &name,
+				PerformanceInsightsRetentionPeriod: &retention32,
+				PerformanceInsightsKMSKeyId:        &kmsID,
+				Port:                               &port32,
+				PreferredBackupWindow:              &window,
+				PreferredMaintenanceWindow:         &window,
+				PromotionTier:                      &tier32,
+				PubliclyAccessible:                 &trueFlag,
+				StorageEncrypted:                   &trueFlag,
+				StorageType:                        &storageType,
+				Timezone:                           &zone,
+				VpcSecurityGroupIds:                vpcIds,
+				ProcessorFeatures: []rdstypes.ProcessorFeature{{
+					Name:  &name,
+					Value: &value,
+				}},
+			},
+		},
+	}
+
+	for name, tc := range cases {
+		t.Run(name, func(t *testing.T) {
+			got := GenerateCreateRDSInstanceInput(tc.name, tc.password, &tc.params)
+			if diff := cmp.Diff(&tc.want, got, cmpopts.IgnoreTypes(document.NoSerde{})); diff != "" {
+				t.Errorf("r: -want, +got:\n%s", diff)
+			}
+		})
+	}
+}