# ec2\_vpc module not idempotent

**URL:** <https://forum.ansible.com/t/ec2-vpc-module-not-idempotent/22824>\
**Category:** Ansible Project\
**Created:** [October 18, 2016, 10:15pm UTC](https://forum.ansible.com/t/ec2-vpc-module-not-idempotent/22824 "2016-10-18T22:15:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Colin\_Byrne](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@Colin\_Byrne](https://forum.ansible.com/u/Colin_Byrne)\
**Post date:** [October 18, 2016, 10:15pm UTC](https://forum.ansible.com/t/ec2-vpc-module-not-idempotent/22824/1 "2016-10-18T22:15:37Z")

</div>

this module does not seem to be idempotent. Here is the documentation: [http://docs.ansible.com/ansible/ec2\_vpc\_module.html](http://docs.ansible.com/ansible/ec2_vpc_module.html), which seems to indicate that VPC’s will NOT be created if a VPC already exists with equivalent resource\_tags and cidr\_block values.

Unfortunately, as many times as I run this role, it will create a new VPC.

Here is my usage:  
`

- name: create vpcs  
ec2\_vpc:  
state: ‘{{ item.state }}’

region: ‘{{ item.region }}’  
vpc\_id: ‘{{ item.vpc\_id }}’  
cidr\_block: ‘{{ item.cidr\_block }}’  
resource\_tags: { “Name”: “{{item.name}}” }  
subnets: ‘{{ item.subnets }}’  
internet\_gateway: ‘{{ item.internet\_gateway }}’  
route\_tables:

- subnets: ‘{{ item.route\_tables.private\_subnets.subnets }}’  
routes:
- dest: ‘{{ item.route\_tables.private\_subnets.routes.dest }}’  
gw: ‘{{ item.route\_tables.private\_subnets.routes.gw }}’
- subnets: ‘{{ item.route\_tables.public\_subnets.subnets }}’  
routes:
- dest: ‘{{ item.route\_tables.public\_subnets.routes.dest }}’  
gw: ‘{{ item.route\_tables.private\_subnets.routes.gw }}’  
with\_items: vpcs  
register: vpc

`

Thanks for any help/guidance.
