Skip to content

Commit

Permalink
Return dhcp_config from ec2_vpc_dhcp_option and deprecate new_config.
Browse files Browse the repository at this point in the history
  • Loading branch information
jillr committed Mar 8, 2021
1 parent 3fd1c20 commit 48ae8da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
- 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)
6 changes: 4 additions & 2 deletions plugins/modules/ec2_vpc_dhcp_option.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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__':
Expand Down

0 comments on commit 48ae8da

Please sign in to comment.