Skip to content
79 changes: 78 additions & 1 deletion apis/rds/v1alpha1/custom_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,72 @@ type CustomDBInstanceParameters struct {
// +optional
SkipFinalSnapshot bool `json:"skipFinalSnapshot,omitempty"`

// The identifier of the Multi-AZ DB cluster that will act as the source for
// the read replica. Each DB cluster can have up to 15 read replicas.
//
// Constraints:
//
// * Must be the identifier of an existing Multi-AZ DB cluster.
//
// * Can't be specified if the SourceDBInstanceIdentifier parameter is also
// specified.
//
// * The specified DB cluster must have automatic backups enabled, that is,
// its backup retention period must be greater than 0.
//
// * The source DB cluster must be in the same Amazon Web Services Region
// as the read replica. Cross-Region replication isn't supported.
// +immutable
// +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-aws/apis/rds/v1alpha1.DBCluster
ReplicateSourceDBClusterID *string `json:"replicateSourceDBClusterID,omitempty"`

// ReplicateSourceDBClusterIDRef is a reference to a DBCluster used to set
// ReplicateSourceDBClusterID.
// +optional
ReplicateSourceDBClusterIDRef *xpv1.Reference `json:"replicateSourceDBClusterIDRef,omitempty"`

// ReplicateSourceDBClusterIDSelector selects a reference to a DBCluster used to
// set ReplicateSourceDBClusterID.
// +optional
ReplicateSourceDBClusterIDSelector *xpv1.Selector `json:"replicateSourceDBClusterIDSelector,omitempty"`

// The identifier of the DB instance that will act as the source for the read
// replica. Each DB instance can have up to 15 read replicas, with the exception of
// Oracle and SQL Server, which can have up to five.
//
// Constraints:
//
// - Must be the identifier of an existing Db2, MariaDB, MySQL, Oracle,
// PostgreSQL, or SQL Server DB instance.
//
// * Can't be specified if the SourceDBClusterIdentifier parameter is also
// specified.
//
// - For the limitations of Oracle read replicas, see [Version and licensing considerations for RDS for Oracle replicas]in the Amazon RDS User
// Guide.
//
// - For the limitations of SQL Server read replicas, see [Read replica limitations with SQL Server]in the Amazon RDS User
// Guide.
//
// - The specified DB instance must have automatic backups enabled, that is, its
// backup retention period must be greater than 0.
//
// [Read replica limitations with SQL Server]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.ReadReplicas.html#SQLServer.ReadReplicas.Limitations
// [Version and licensing considerations for RDS for Oracle replicas]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/oracle-read-replicas.limitations.html#oracle-read-replicas.limitations.versions-and-licenses
// +immutable
// +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-aws/apis/rds/v1alpha1.DBInstance
ReplicateSourceDBInstanceID *string `json:"replicateSourceDBInstanceID,omitempty"`

// ReplicateSourceDBInstanceIDRef is a reference to a DBInstance used to set
// ReplicateSourceDBInstanceID.
// +optional
ReplicateSourceDBInstanceIDRef *xpv1.Reference `json:"replicateSourceDBInstanceIDRef,omitempty"`

// ReplicateSourceDBInstanceIDSelector selects a reference to a DBInstance used to
// set ReplicateSourceDBInstanceID.
// +optional
ReplicateSourceDBInstanceIDSelector *xpv1.Selector `json:"replicateSourceDBInstanceIDSelector,omitempty"`

// A list of Amazon EC2 VPC security groups to authorize on this DB instance.
// This change is asynchronously applied as soon as possible.
//
Expand Down Expand Up @@ -741,10 +807,21 @@ type CustomDBInstanceParameters struct {
// deleted.
// +optional
DeleteAutomatedBackups *bool `json:"deleteAutomatedBackups,omitempty"`

// TagIgnorePrefixes defines a list of tag key prefixes that should be ignored
// during tag comparison and updates by the reconciler.
// +optional
TagIgnorePrefixes []string `json:"tagIgnorePrefixes,omitempty"`
}

// CustomDBInstanceObservation includes the custom status fields of DBInstance.
type CustomDBInstanceObservation struct{}
type CustomDBInstanceObservation struct {
// AWS API calls don't return any field which explicitly indicates the role of database, which would be really convenient.
// DatabaseRole works on the similar principle as the Role field in AWS UI("Aurora and RDS" > "Databases").

// The database role may be Standalone, Primary or Replica.
DatabaseRole *string `json:"databaseRole,omitempty"`
}

// CustomDBInstanceRoleAssociationParameters are custom parameters for the DBInstanceRoleAssociation
type CustomDBInstanceRoleAssociationParameters struct {
Expand Down
42 changes: 41 additions & 1 deletion apis/rds/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions examples/rds/db-instance-read-replica.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
apiVersion: rds.aws.crossplane.io/v1alpha1
kind: DBInstance
metadata:
name: example-read-replica-1
spec:
forProvider:
region: eu-central-1
replicateSourceDBInstanceID: example-dbinstance
engine: mariadb
dbInstanceClass: db.t3.micro
autoMinorVersionUpgrade: true
allowMajorVersionUpgrade: true # unset per default (Note: supported dbInstanceClass and dbParameterGroup with correct dbParameterGroupFamily needed, before majorVersion upgrade possible; applyImmediately matters)
applyImmediately: true
skipFinalSnapshot: true
# masterUserPasswordSecretRef:
# key: password
# name: replica-test
# namespace: default
writeConnectionSecretToRef:
name: example-read-replica-1
namespace: default
providerConfigRef:
name: provider-aws

# By default, the read replica has the master user credentials as the source database.
#---
#apiVersion: v1
#kind: Secret
#metadata:
# name: replica-test
# namespace: default
#type: Opaque
#data:
# password: dGVzdFBhc3N3b3JkITEyMw== # testPassword!123
Loading
Loading