Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PR #1331/ed4165d6 backport][stable-4] ec2_vpc_vgw_info - update to not throw an error when run in check_mode #1336

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/137-ec2_vpc_vgw_info.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- ec2_vpc_vgw_info - updated to not throw an error when run in check_mode (https://github.com/ansible-collections/community.aws/issues/137).
7 changes: 3 additions & 4 deletions plugins/modules/ec2_vpc_vgw_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
version_added: 1.0.0
short_description: Gather information about virtual gateways in AWS
description:
- Gather information about virtual gateways in AWS.
- Gather information about virtual gateways (VGWs) in AWS.
options:
filters:
description:
Expand All @@ -21,7 +21,7 @@
type: dict
vpn_gateway_ids:
description:
- Get details of a specific Virtual Gateway ID. This value should be provided as a list.
- Get details of a specific Virtual Gateway ID.
type: list
elements: str
author:
Expand Down Expand Up @@ -151,7 +151,6 @@ def list_virtual_gateways(client, module):
params = dict()

params['Filters'] = ansible_dict_to_boto3_filter_list(module.params.get('filters'))
params['DryRun'] = module.check_mode

if module.params.get("vpn_gateway_ids"):
params['VpnGatewayIds'] = module.params.get("vpn_gateway_ids")
Expand All @@ -168,7 +167,7 @@ def list_virtual_gateways(client, module):
def main():
argument_spec = dict(
filters=dict(type='dict', default=dict()),
vpn_gateway_ids=dict(type='list', default=None, elements='str')
vpn_gateway_ids=dict(type='list', default=None, elements='str'),
)

module = AnsibleAWSModule(argument_spec=argument_spec, supports_check_mode=True)
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/targets/ec2_vpc_vgw/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@

# ============================================================

- name: get VPC VGW facts by ID
- name: get VPC VGW facts by ID (CHECK)
ec2_vpc_vgw_info:
vpn_gateway_ids: ['{{ vgw_id }}']
register: vgw_info
check_mode: True

- name: verify expected facts
vars:
Expand Down