diff --git a/plugins/modules/ec2_vpc_vpn.py b/plugins/modules/ec2_vpc_vpn.py index 95b4a1b6f1b..ba488313415 100644 --- a/plugins/modules/ec2_vpc_vpn.py +++ b/plugins/modules/ec2_vpc_vpn.py @@ -239,8 +239,7 @@ description: If the VPN connection has changed. type: bool returned: always - sample: - changed: true + sample: true customer_gateway_configuration: description: The configuration of the VPN connection. returned: O(state=present) @@ -249,26 +248,22 @@ description: The customer gateway connected via the connection. type: str returned: O(state=present) - sample: - customer_gateway_id: "cgw-1220c87b" + sample: "cgw-1220c87b" gateway_association_state: description: The current state of the gateway association. type: str returned: O(state=present) - sample: - gateway_association_state: "associated" + sample: "associated" vpn_gateway_id: description: The virtual private gateway connected via the connection. type: str returned: O(state=present) - sample: - vpn_gateway_id: "vgw-cb0ae2a2" + sample: "vgw-cb0ae2a2" transit_gateway_id: description: The transit gateway id to which the vpn connection can be attached. type: str returned: O(state=present) - sample: - transit_gateway_id: "tgw-cb0ae2a2" + sample: "tgw-cb0ae2a2" options: description: The VPN connection options. type: list @@ -279,45 +274,38 @@ description: If the VPN connection only allows static routes. returned: O(state=present) type: bool - sample: - static_routes_only: true + sample: true enable_acceleration: description: Indicates whether acceleration is enabled for the VPN connection. returned: O(state=present) type: bool - sample: - enable_acceleration: false + sample: false local_ipv4_network_cidr: description: The IPv4 CIDR on the customer gateway (on-premises) side of the VPN connection. returned: O(state=present) type: str - sample: - local_ipv4_network_cidr: "0.0.0.0/0" + sample: "0.0.0.0/0" outside_ip_address_type: description: The external IP address of the VPN tunnel. returned: O(state=present) type: str - sample: - outside_ip_address_type: "PublicIpv4" + sample: "PublicIpv4" remote_ipv4_network_cidr: description: The IPv4 CIDR on the Amazon Web Services side of the VPN connection. returned: O(state=present) type: str - sample: - remote_ipv4_network_cidr: "0.0.0.0/0" + sample: "0.0.0.0/0" tunnel_inside_ip_version: description: Indicates whether the VPN tunnels process IPv4 or IPv6 traffic. returned: O(state=present) type: str - sample: - tunnel_inside_ip_version: "ipv4" + sample: "ipv4" tunnel_options: description: Indicates the VPN tunnel options. returned: O(state=present) type: list elements: dict - sample: - tunnel_inside_ip_version: [ + sample: [ { "log_options": { "cloud_watch_log_options": { @@ -357,8 +345,7 @@ description: The routes of the VPN connection. type: list returned: O(state=present) - sample: - routes: [{ + sample: [{ "destination_cidr_block": "192.168.1.0/24", "state": "available" }] @@ -380,28 +367,25 @@ description: The status of the VPN connection. type: str returned: O(state=present) - sample: - state: "available" + sample: "available" tags: description: The tags associated with the connection. type: dict returned:O(state=present) - sample: - tags: - name: "ansible-test" - other: "tag" + sample: { + "name": "ansible-test" + "other": "tag" + } type: description: The type of VPN connection (currently only ipsec.1 is available). type: str returned: V(state=present) - sample: - type: "ipsec.1" + sample: "ipsec.1" vgw_telemetry: type: list returned: O(state=present) description: The telemetry for the VPN tunnel. - sample: - vgw_telemetry: [ + sample: [ { "accepted_route_count": 0, "last_status_change": "2024-09-30T13:12:33+00:00", @@ -440,8 +424,7 @@ description: The identifier for the VPN connection. type: str returned: O(state=present) - sample: - vpn_connection_id: "vpn-781e0e19" + sample: "vpn-781e0e19" """ try: @@ -733,15 +716,15 @@ def check_for_routes_update(client, module: AnsibleAWSModule, vpn_connection_id: if attribute in ("tags", "routes", "state"): continue elif attribute == "options": - will_be = module.params.get("static_only", None) + will_be = module.params.get("static_only") is_now = bool(current_attrs[attribute]["static_routes_only"]) attribute = "static_only" elif attribute == "type": - will_be = module.params.get("connection_type", None) + will_be = module.params.get("connection_type") is_now = current_attrs[attribute] else: is_now = current_attrs[attribute] - will_be = module.params.get(attribute, None) + will_be = module.params.get(attribute) if will_be is not None and to_text(will_be) != to_text(is_now): module.fail_json( diff --git a/plugins/modules/ec2_vpc_vpn_info.py b/plugins/modules/ec2_vpc_vpn_info.py index c9f53294235..10eb02fea59 100644 --- a/plugins/modules/ec2_vpc_vpn_info.py +++ b/plugins/modules/ec2_vpc_vpn_info.py @@ -87,45 +87,38 @@ description: If the VPN connection only allows static routes. returned: O(state=present) type: bool - sample: - static_routes_only: true + sample: true enable_acceleration: description: Indicates whether acceleration is enabled for the VPN connection. returned: O(state=present) type: bool - sample: - enable_acceleration: false + sample: false local_ipv4_network_cidr: description: The IPv4 CIDR on the customer gateway (on-premises) side of the VPN connection. returned: O(state=present) type: str - sample: - local_ipv4_network_cidr: "0.0.0.0/0" + sample: "0.0.0.0/0" outside_ip_address_type: description: The external IP address of the VPN tunnel. returned: O(state=present) type: str - sample: - outside_ip_address_type: "PublicIpv4" + sample: "PublicIpv4" remote_ipv4_network_cidr: description: The IPv4 CIDR on the Amazon Web Services side of the VPN connection. returned: O(state=present) type: str - sample: - remote_ipv4_network_cidr: "0.0.0.0/0" + sample: "0.0.0.0/0" tunnel_inside_ip_version: description: Indicates whether the VPN tunnels process IPv4 or IPv6 traffic. returned: O(state=present) type: str - sample: - tunnel_inside_ip_version: "ipv4" + sample: "ipv4" tunnel_options: description: Indicates the VPN tunnel options. returned: O(state=present) type: list elements: dict - sample: - tunnel_inside_ip_version: [ + sample: [ { "log_options": { "cloud_watch_log_options": { @@ -180,7 +173,7 @@ state: description: The current state of the static route. type: str - returned: O(state=present) + returned: O(state=present) state: description: The current state of the VPN connection. returned: always @@ -189,8 +182,7 @@ tags: description: Any tags assigned to the VPN connection. returned: always - type: dict - sample: { + type: { "Name": "test-conn" } type: diff --git a/tests/integration/targets/ec2_vpc_vpn/tasks/main.yml b/tests/integration/targets/ec2_vpc_vpn/tasks/main.yml index 83897f08a5f..6a9f9125688 100644 --- a/tests/integration/targets/ec2_vpc_vpn/tasks/main.yml +++ b/tests/integration/targets/ec2_vpc_vpn/tasks/main.yml @@ -55,7 +55,6 @@ - result is failed - result.msg == "parameters are mutually exclusive: vpn_gateway_id|transit_gateway_id" - - name: Create EC2 VPN Connection, with customer gateway and transit_gateway community.aws.ec2_vpc_vpn: customer_gateway_id: '{{ cgw.gateway.customer_gateway.customer_gateway_id }}' @@ -141,7 +140,8 @@ register: result check_mode: true - - ansible.builtin.assert: + - name: Assert EC2 VPN Connection is deleted (check_mode) + ansible.builtin.assert: that: - result is changed @@ -151,7 +151,8 @@ vpn_connection_id: '{{ vpn_id }}' register: result - - ansible.builtin.assert: + - name: Assert EC2 VPN Connection is deleted + ansible.builtin.assert: that: - result is changed @@ -162,7 +163,8 @@ register: result check_mode: true - - ansible.builtin.assert: + - name: Assert result has not changed (idempotency check_mode) + ansible.builtin.assert: that: - result is not changed @@ -172,7 +174,8 @@ vpn_connection_id: '{{ vpn_id }}' register: result - - ansible.builtin.assert: + - name: Assert result has not changed (idempotency) + ansible.builtin.assert: that: - result is not changed