# AWS VPN is not taking IP address as defined in ansible VPN module

**URL:** <https://forum.ansible.com/t/aws-vpn-is-not-taking-ip-address-as-defined-in-ansible-vpn-module/36896>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [July 25, 2022, 5:04am UTC](https://forum.ansible.com/t/aws-vpn-is-not-taking-ip-address-as-defined-in-ansible-vpn-module/36896 "2022-07-25T05:04:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![maulik\_patel](https://avatars.discourse-cdn.com/v4/letter/m/ec9cab/32.png) [@maulik\_patel](https://forum.ansible.com/u/maulik_patel)\
**Post date:** [July 25, 2022, 5:04am UTC](https://forum.ansible.com/t/aws-vpn-is-not-taking-ip-address-as-defined-in-ansible-vpn-module/36896/1 "2022-07-25T05:04:02Z")

</div>

i’m looking for assistance for Tunnel IP address assignment defined by my own in aws for ‘ec2\_vpc\_vpn’ but somehow aws is taking its own address ( 169.254.87.200/30 & 169.254.164.108/30 ) rather than i have returned facts for tunnel ip… how can i override with custom returned value ?

ansible\_module: **[https://docs.ansible.com/ansible/latest/collections/community/aws/ec2\_vpc\_vpn\_module.html](https://docs.ansible.com/ansible/latest/collections/community/aws/ec2_vpc_vpn_module.html)**

**_- name: Create prefix within NetBox with only required information_**  
**_netbox\_prefix:_**  
**_netbox\_url: “{{ netbox\_url }}”_**  
**_netbox\_token: “{{ netbox\_token }}”_**  
**_data:_**  
**_parent: 169.254.0.0/16_**  
**_prefix\_length: 30_**  
**_site: DC_**  
**_tenant: ‘network’_**  
**_status: Reserved_**  
**_#state: present_**  
**_custom\_fields:_**  
**_prefix\_ticket\_number: “{{ ticket }}”_**  
**_prefix\_account\_id: “{{ account\_no }}”_**  
**_prefix\_role: ipsec-p2p_**  
**_description: “aws-{{ region }}-{{ account\_no }}-{{ application }}”_**  
**_state: present_**  
**_first\_available: “{{ item }}”_**  
**_validate\_certs: no_**  
**_register: prefixs_**  
**_with\_items:_**  
**_- yes_**  
**_- yes_**

**_- name: tunnel\_1\_cidr_**  
**_set\_fact:_**  
**_tunnel\_1\_cidr\_30: ‘{{ prefixs.results[0].prefix.prefix | ipmath(1) }}/30’_**

**_- name: debug tunnel1_**  
**_debug:_**  
**_msg: “{{ tunnel\_1\_cidr\_30 }}”_**

**_- name: tunnel\_2\_cidr_**  
**_set\_fact:_**  
**_tunnel\_2\_cidr\_30: ‘{{ prefixs.results[1].prefix.prefix | ipmath(1) }}/30’_**

**_- name: debug tunnel2_**  
**_debug:_**  
**_msg: “{{ tunnel\_2\_cidr\_30 }}”_**

**_- name: create a VPN connection_**  
**_ec2\_vpc\_vpn:_**  
**_state: present_**  
**_vpn\_gateway\_id: “vgw-xxxxxxxx”_**  
**_customer\_gateway\_id: ‘cgw-xxxxxxxx’_**  
**_static\_only: true_**  
**_region: ‘{{ region }}’_**  
**_routes:_**  
**_- 10.0.0.0/8_**  
**_aws\_access\_key: “{{ aws\_access\_key }}”_**  
**_aws\_secret\_key: “{{ aws\_secret\_key }}”_**  
**_tunnel\_options:_**
