11{% include 'header.j2' %}
22
33
4- from ansible_collections.amazon.cloud.plugins.module_utils.core import AnsibleAWSModule
4+ from ansible_collections.amazon.cloud.plugins.module_utils.core import AnsibleAmazonCloudModule
55from ansible_collections.amazon.cloud.plugins.module_utils.core import CloudControlResource
66from ansible_collections.amazon.cloud.plugins.module_utils.core import ansible_dict_to_boto3_tag_list
77from ansible_collections.amazon.cloud.plugins.module_utils.core import scrub_none_parameters
@@ -23,14 +23,22 @@ def main():
2323 {{ mutually_exclusive|join(",") }}
2424 ]
2525
26- module = AnsibleAWSModule (argument_spec=argument_spec, required_if=required_if, mutually_exclusive=mutually_exclusive, supports_check_mode=True)
26+ module = AnsibleAmazonCloudModule (argument_spec=argument_spec, required_if=required_if, mutually_exclusive=mutually_exclusive, supports_check_mode=True)
2727 cloud = CloudControlResource(module)
2828
2929 {% set type_name =resource_type %}
3030 type_name = {{ type_name }}
3131
3232 params = {}
3333 {{params}}
34+
35+ {% if 'AWS::RDS::DBInstance' in type_name %}
36+ if module.params.get("engine") not in ("aurora", "aurora-postgresql", "aurora-mysql"):
37+ # It can only be used when engine is one of ("aurora", "aurora-postgresql", "aurora-mysql").
38+ # Since the CloudFormation template assigns 'default: 1', it is always set to 1.
39+ params.pop("promotion_tier")
40+ {% endif %}
41+
3442 # The DesiredState we pass to AWS must be a JSONArray of non-null values
3543 _params_to_set = scrub_none_parameters(params)
3644
@@ -54,13 +62,6 @@ def main():
5462 {{ ensure_all_identifiers_defined }}
5563 results = {"changed": False, "result": {}}
5664
57- {% if 'AWS::RDS::DBInstance' in type_name %}
58- if module.params.get("engine") not in ("aurora", "aurora-postgresql", "aurora-mysql"):
59- # It can only be used when engine is one of ("aurora", "aurora-postgresql", "aurora-mysql").
60- # Since the CloudFormation template assigns 'default: 1', it is always set to 1.
61- params.pop("promotion_tier")
62- {% endif %}
63-
6465 if state == "list":
6566 if "list" not in handlers:
6667 module.exit_json(**results, msg=f"Resource type {type_name} cannot be listed.")
0 commit comments