From e0c3862348d71cd102963a9e114c7c542529f3f7 Mon Sep 17 00:00:00 2001 From: Bert Blommers Date: Wed, 14 Dec 2022 16:47:43 -0100 Subject: [PATCH] RDS: Extend valid option group engines (#5770) --- moto/rds/models.py | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/moto/rds/models.py b/moto/rds/models.py index 37c7f3f30..b55c97025 100644 --- a/moto/rds/models.py +++ b/moto/rds/models.py @@ -1594,17 +1594,29 @@ class RDSBackend(BaseBackend): def create_option_group(self, option_group_kwargs): option_group_id = option_group_kwargs["name"] + # This list was verified against the AWS Console on 14 Dec 2022 + # Having an automated way (using the CLI) would be nice, but AFAICS that's not possible + # + # Some options that are allowed in the CLI, but that do now show up in the Console: + # - Mysql 5.5 + # - All postgres-versions + # - oracle-se and oracle-se1 - I could not deduct the available versions + # `Cannot find major version 19 for oracle-se` + # (The engines do exist, otherwise the error would be `Invalid DB engine` valid_option_group_engines = { - "mariadb": ["10.0", "10.1", "10.2", "10.3"], + "mariadb": ["10.0", "10.1", "10.2", "10.3", "10.4", "10.5", "10.6"], "mysql": ["5.5", "5.6", "5.7", "8.0"], - "oracle-se2": ["11.2", "12.1", "12.2"], - "oracle-se1": ["11.2", "12.1", "12.2"], - "oracle-se": ["11.2", "12.1", "12.2"], - "oracle-ee": ["11.2", "12.1", "12.2"], - "sqlserver-se": ["10.50", "11.00"], - "sqlserver-ee": ["10.50", "11.00"], - "sqlserver-ex": ["10.50", "11.00"], - "sqlserver-web": ["10.50", "11.00"], + "oracle-ee": ["19"], + "oracle-ee-cdb": ["19", "21"], + "oracle-se": [], + "oracle-se1": [], + "oracle-se2": ["19"], + "oracle-se2-cdb": ["19", "21"], + "postgres": ["10", "11", "12", "13"], + "sqlserver-ee": ["11.00", "12.00", "13.00", "14.00", "15.00"], + "sqlserver-ex": ["11.00", "12.00", "13.00", "14.00", "15.00"], + "sqlserver-se": ["11.00", "12.00", "13.00", "14.00", "15.00"], + "sqlserver-web": ["11.00", "12.00", "13.00", "14.00", "15.00"], } if option_group_id in self.option_groups: raise RDSClientError( @@ -1631,6 +1643,18 @@ class RDSBackend(BaseBackend): "InvalidParameterCombination", f"Cannot find major version {option_group_kwargs['major_engine_version']} for {option_group_kwargs['engine_name']}", ) + # AWS also creates default option groups, if they do not yet exist, when creating an option group in the CLI + # Maybe we should do the same + # { + # "OptionGroupName": "default:postgres-10", + # "OptionGroupDescription": "Default option group for postgres 10", + # "EngineName": "postgres", + # "MajorEngineVersion": "10", + # "Options": [], + # "AllowsVpcAndNonVpcInstanceMemberships": true, + # "OptionGroupArn": "arn:aws:rds:us-east-1:{account}:og:default:postgres-10" + # } + # The CLI does not allow deletion of default groups option_group = OptionGroup(**option_group_kwargs) self.option_groups[option_group_id] = option_group return option_group