From 48ae8dae42d5af09ca4f189613c5b9af5aa466da Mon Sep 17 00:00:00 2001 From: Jill Rouleau Date: Fri, 5 Mar 2021 11:34:32 -0700 Subject: [PATCH] Return dhcp_config from ec2_vpc_dhcp_option and deprecate new_config. --- .../fragments/252_boto3_refactor_ec2_vpc_dhcp_option.yaml | 6 ++++-- plugins/modules/ec2_vpc_dhcp_option.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/changelogs/fragments/252_boto3_refactor_ec2_vpc_dhcp_option.yaml b/changelogs/fragments/252_boto3_refactor_ec2_vpc_dhcp_option.yaml index 072c90b009f..7f6d76546bd 100644 --- a/changelogs/fragments/252_boto3_refactor_ec2_vpc_dhcp_option.yaml +++ b/changelogs/fragments/252_boto3_refactor_ec2_vpc_dhcp_option.yaml @@ -2,5 +2,7 @@ breaking_changes: - ec2_vpc_dhcp_option_info - Now preserves case for tag keys in return value. (https://github.com/ansible-collections/amazon.aws/pull/252) - ec2_vpc_dhcp_option - The module has been refactored to use boto3. Keys and value types returned by the module are now consistent, which is a change from the previous behaviour. A ``purge_tags`` option has been added, which defaults to ``True``. (https://github.com/ansible-collections/amazon.aws/pull/252) minor_changes: - - ec2_vpc_dhcp_option - Now also returns a boto3-style resource description in the ``dhcp_options`` result key. This includes any tags for the ``dhcp_options_id`` and has the same format as the current return value of ``ec2_vpc_dhcp_option_info``. - - ec2_vpc_dhcp_option_info - Now also returns a user-friendly ``dhcp_config`` key that matches the historical ``new_config`` key from ec2_vpc_dhcp_option, and alleviates the need to use ``items2dict(key_name='key', value_name='values')`` when parsing the output of the module. \ No newline at end of file + - ec2_vpc_dhcp_option - Now also returns a boto3-style resource description in the ``dhcp_options`` result key. This includes any tags for the ``dhcp_options_id`` and has the same format as the current return value of ``ec2_vpc_dhcp_option_info``. (https://github.com/ansible-collections/amazon.aws/pull/252) + - ec2_vpc_dhcp_option_info - Now also returns a user-friendly ``dhcp_config`` key that matches the historical ``new_config`` key from ec2_vpc_dhcp_option, and alleviates the need to use ``items2dict(key_name='key', value_name='values')`` when parsing the output of the module. (https://github.com/ansible-collections/amazon.aws/pull/252) +deprecated_features: + - ec2_vpc_dhcp_option - The ``new_config`` return key has been deprecated and will be removed in a future release. It will be replaced by ``dhcp_config``. Both values are returned in the interim. (https://github.com/ansible-collections/amazon.aws/pull/252) diff --git a/plugins/modules/ec2_vpc_dhcp_option.py b/plugins/modules/ec2_vpc_dhcp_option.py index 75421c6c83e..d2c02efb284 100644 --- a/plugins/modules/ec2_vpc_dhcp_option.py +++ b/plugins/modules/ec2_vpc_dhcp_option.py @@ -143,7 +143,7 @@ description: The aws resource id of the primary DCHP options set created, found or removed type: str returned: when available -new_options: +dhcp_config: description: The boto2-style DHCP options created, associated or found returned: when available type: dict @@ -512,6 +512,8 @@ def main(): client = module.client('ec2', retry_decorator=AWSRetry.jittered_backoff()) + module.deprecate("The 'new_config' return key is deprecated and will be replaced by 'dhcp_config'. Both values are returned for now.", + date='2022-12-01', collection_name='amazon.aws') if state == 'absent': if not dhcp_options_id: # Look up the option id first by matching the supplied options @@ -570,7 +572,7 @@ def main(): return_config = normalize_ec2_vpc_dhcp_config(new_config) results = get_dhcp_options_info(client, module, dhcp_options_id) - module.exit_json(changed=changed, new_options=return_config, dhcp_options_id=dhcp_options_id, dhcp_options=results) + module.exit_json(changed=changed, new_options=return_config, dhcp_options_id=dhcp_options_id, dhcp_options=results, dhcp_config=return_config) if __name__ == '__main__':