Skip to content

Commit eb8e1c8

Browse files
authored
Merge pull request #2202 from crossplane-contrib/backport-2201-to-release-0.52
[Backport release-0.52] feat(rds): add kmsKeyId to status
2 parents ad04292 + d550d7b commit eb8e1c8

11 files changed

+68
-0
lines changed

apis/database/v1beta1/rdsinstance_types.go

+6
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,12 @@ type RDSInstanceObservation struct {
12451245
// VPCSecurityGroups provides a list of VPC security group elements that the DB instance belongs
12461246
// to.
12471247
VPCSecurityGroups []VPCSecurityGroupMembership `json:"vpcSecurityGroups,omitempty"`
1248+
// If StorageEncrypted is enabled, the Amazon Web Services KMS key identifier
1249+
// for the encrypted DB cluster.
1250+
//
1251+
// The Amazon Web Services KMS key identifier is the key ARN, key ID, alias
1252+
// ARN, or alias name for the KMS key.
1253+
KMSKeyID string `json:"kmsKeyID,omitempty"`
12481254
}
12491255

12501256
// An RDSInstanceStatus represents the observed state of an RDSInstance.

apis/rds/generator-config.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,22 @@ resources:
1818
from:
1919
operation: DescribeDBInstances
2020
path: DBInstances.DBClusterIdentifier
21+
KmsKeyId:
22+
is_read_only: true
23+
from:
24+
operation: DescribeDBInstances
25+
path: DBInstances.KmsKeyId
2126
DBCluster:
2227
fields:
2328
AllowMajorVersionUpgrade:
2429
from:
2530
operation: ModifyDBCluster
2631
path: AllowMajorVersionUpgrade
32+
KmsKeyId:
33+
is_read_only: true
34+
from:
35+
operation: DescribeDBClusters
36+
path: DBClusters.KmsKeyId
2737
DBInstanceRoleAssociation:
2838
exceptions:
2939
errors:

apis/rds/v1alpha1/zz_db_cluster.go

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/rds/v1alpha1/zz_db_instance.go

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/rds/v1alpha1/zz_generated.deepcopy.go

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package/crds/database.aws.crossplane.io_rdsinstances.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -1701,6 +1701,14 @@ spec:
17011701
DB instance was created.
17021702
format: date-time
17031703
type: string
1704+
kmsKeyID:
1705+
description: |-
1706+
If StorageEncrypted is enabled, the Amazon Web Services KMS key identifier
1707+
for the encrypted DB cluster.
1708+
1709+
The Amazon Web Services KMS key identifier is the key ARN, key ID, alias
1710+
ARN, or alias name for the KMS key.
1711+
type: string
17041712
latestRestorableTime:
17051713
description: |-
17061714
LatestRestorableTime specifies the latest time to which a database can be

package/crds/rds.aws.crossplane.io_dbclusters.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -1836,6 +1836,14 @@ spec:
18361836
Indicates whether the mapping of Amazon Web Services Identity and Access
18371837
Management (IAM) accounts to database accounts is enabled.
18381838
type: boolean
1839+
kmsKeyID:
1840+
description: |-
1841+
If StorageEncrypted is enabled, the Amazon Web Services KMS key identifier
1842+
for the encrypted DB cluster.
1843+
1844+
The Amazon Web Services KMS key identifier is the key ARN, key ID, alias
1845+
ARN, or alias name for the KMS key.
1846+
type: string
18391847
latestRestorableTime:
18401848
description: The latest time to which a database can be restored
18411849
with point-in-time restore.

package/crds/rds.aws.crossplane.io_dbinstances.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -2350,6 +2350,14 @@ spec:
23502350
For more information, see Upgrading the storage file system for a DB instance
23512351
(https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PIOPS.StorageTypes.html#USER_PIOPS.UpgradeFileSystem).
23522352
type: boolean
2353+
kmsKeyID:
2354+
description: |-
2355+
If StorageEncrypted is enabled, the Amazon Web Services KMS key identifier
2356+
for the encrypted DB instance.
2357+
2358+
The Amazon Web Services KMS key identifier is the key ARN, key ID, alias
2359+
ARN, or alias name for the KMS key.
2360+
type: string
23532361
latestRestorableTime:
23542362
description: |-
23552363
The latest time to which a database in this DB instance can be restored with

pkg/clients/database/rds.go

+1
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ func GenerateObservation(db rdstypes.DBInstance) v1beta1.RDSInstanceObservation
469469
ReadReplicaDBInstanceIdentifiers: db.ReadReplicaDBInstanceIdentifiers,
470470
ReadReplicaSourceDBInstanceIdentifier: aws.ToString(db.ReadReplicaSourceDBInstanceIdentifier),
471471
SecondaryAvailabilityZone: aws.ToString(db.SecondaryAvailabilityZone),
472+
KMSKeyID: aws.ToString(db.KmsKeyId),
472473
}
473474
if db.LatestRestorableTime != nil {
474475
t := metav1.NewTime(*db.LatestRestorableTime)

pkg/controller/rds/dbcluster/setup.go

+3
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ func (e *custom) postObserve(ctx context.Context, cr *svcapitypes.DBCluster, res
106106
if err != nil {
107107
return managed.ExternalObservation{}, err
108108
}
109+
110+
cr.Status.AtProvider.KMSKeyID = resp.DBClusters[0].KmsKeyId
111+
109112
switch pointer.StringValue(resp.DBClusters[0].Status) {
110113
case "available", "storage-optimization", "backing-up":
111114
cr.SetConditions(xpv1.Available())

pkg/controller/rds/dbinstance/setup.go

+2
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,8 @@ func (e *custom) postObserve(ctx context.Context, cr *svcapitypes.DBInstance, re
351351
return obs, err
352352
}
353353

354+
cr.Status.AtProvider.KMSKeyID = resp.DBInstances[0].KmsKeyId
355+
354356
cr.Spec.ForProvider.DBClusterIdentifier = resp.DBInstances[0].DBClusterIdentifier
355357

356358
switch pointer.StringValue(resp.DBInstances[0].DBInstanceStatus) {

0 commit comments

Comments
 (0)