Skip to content

Commit

Permalink
Support for AWS RDS Multi-Tenant CDB Databases
Browse files Browse the repository at this point in the history
  • Loading branch information
GomathiselviS committed Aug 31, 2024
1 parent 26d7243 commit 87091ae
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/rds_instance_multitenant.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- rds_instance - Add support for Multi-Tenant CDB Databases.
20 changes: 20 additions & 0 deletions plugins/modules/rds_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,15 @@
description:
- Specifies if the DB instance is a Multi-AZ deployment. Mutually exclusive with O(availability_zone).
type: bool
multi_tenant:
description:
- Specifies whether to use the multi-tenant configuration or the single-tenant configuration (default).
- This parameter only applies to RDS for Oracle container database (CDB) engines.
- The DB engine that you specify in the request must support the multi-tenant configuration.
- If the multi-tenant configuration is enabled during creation of the DB instance, it cannot be modified later.
type: bool
default: false
version_added: 9.1.0
new_db_instance_identifier:
description:
- The new DB instance (lowercase) identifier for the DB instance when renaming a DB instance. The identifier must contain
Expand Down Expand Up @@ -790,6 +799,12 @@
returned: always
type: bool
sample: false
multi_tenant:
description: Specifies whether to use the multi-tenant configuration or the single-tenant configuration (default).
returned: for Oracle container database (CDB) engines.
type: bool
version_added: 9.1.0
sample: false
option_group_memberships:
description: The list of option group memberships for this DB instance.
returned: always
Expand Down Expand Up @@ -1631,6 +1646,7 @@ def main():
monitoring_interval=dict(type="int"),
monitoring_role_arn=dict(),
multi_az=dict(type="bool"),
multi_tenant=dict(type="bool", default=False),
new_db_instance_identifier=dict(aliases=["new_instance_id", "new_id"]),
option_group_name=dict(),
performance_insights_kms_key_id=dict(),
Expand Down Expand Up @@ -1697,6 +1713,10 @@ def main():
module.require_botocore_at_least(
"1.29.44", reason="to use 'ca_certificate_identifier' while creating/updating rds instance"
)
if module.params["multi_tenant"]:
module.require_botocore_at_least(
"1.28.80", reason="to use 'multi_tenant' while creating rds instance"
)

# Sanitize instance identifiers
module.params["db_instance_identifier"] = module.params["db_instance_identifier"].lower()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dependencies:
- role: setup_botocore_pip
vars:
boto3_version: "1.28.80"
botocore_version: "1.31.80"
19 changes: 14 additions & 5 deletions tests/integration/targets/rds_instance_processor/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,37 @@
amazon.aws.rds_instance:
id: "{{ instance_id }}"
state: present
engine: oracle-ee
engine: oracle-ee-cdb
username: "{{ username }}"
password: "{{ password }}"
db_instance_class: "{{ oracle_ee_db_instance_class }}"
allocated_storage: "{{ allocated_storage }}"
storage_encrypted: true
processor_features: {}
multi_tenant: true
register: result
vars:
ansible_python_interpreter: "{{ botocore_virtualenv_interpreter }}"

- ansible.builtin.assert:
that:
- result.changed
- result.multi_tenant
- result.engine == "oracle-ee-cdb"

- name: Modify the processor features - check_mode
amazon.aws.rds_instance:
id: "{{ instance_id }}"
state: present
engine: oracle-ee
engine: oracle-ee-cdb
username: "{{ username }}"
password: "{{ password }}"
db_instance_class: "{{ oracle_ee_db_instance_class }}"
allocated_storage: "{{ allocated_storage }}"
storage_encrypted: true
processor_features: "{{ modified_processor_features }}"
apply_immediately: true
multi_tenant: true
register: result
check_mode: true

Expand All @@ -61,14 +67,15 @@
amazon.aws.rds_instance:
id: "{{ instance_id }}"
state: present
engine: oracle-ee
engine: oracle-ee-cdb
username: "{{ username }}"
password: "{{ password }}"
db_instance_class: "{{ oracle_ee_db_instance_class }}"
allocated_storage: "{{ allocated_storage }}"
storage_encrypted: true
processor_features: "{{ modified_processor_features }}"
apply_immediately: true
multi_tenant: true
register: result

- ansible.builtin.assert:
Expand All @@ -81,14 +88,15 @@
amazon.aws.rds_instance:
id: "{{ instance_id }}"
state: present
engine: oracle-ee
engine: oracle-ee-cdb
username: "{{ username }}"
password: "{{ password }}"
db_instance_class: "{{ oracle_ee_db_instance_class }}"
allocated_storage: "{{ allocated_storage }}"
storage_encrypted: true
processor_features: "{{ modified_processor_features }}"
apply_immediately: true
multi_tenant: true
register: result
check_mode: true

Expand All @@ -100,14 +108,15 @@
amazon.aws.rds_instance:
id: "{{ instance_id }}"
state: present
engine: oracle-ee
engine: oracle-ee-cdb
username: "{{ username }}"
password: "{{ password }}"
db_instance_class: "{{ oracle_ee_db_instance_class }}"
allocated_storage: "{{ allocated_storage }}"
storage_encrypted: true
processor_features: "{{ modified_processor_features }}"
apply_immediately: true
multi_tenant: true
register: result

# Check if processor features either are pending or already changed
Expand Down

0 comments on commit 87091ae

Please sign in to comment.