# ec2\_vpc runnable without subnets specified?

**URL:** <https://forum.ansible.com/t/ec2-vpc-runnable-without-subnets-specified/17976>\
**Category:** Ansible Project\
**Created:** [April 14, 2015, 3:02pm UTC](https://forum.ansible.com/t/ec2-vpc-runnable-without-subnets-specified/17976 "2015-04-14T15:02:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Niko\_Felger](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@Niko\_Felger](https://forum.ansible.com/u/Niko_Felger)\
**Post date:** [April 14, 2015, 3:02pm UTC](https://forum.ansible.com/t/ec2-vpc-runnable-without-subnets-specified/17976/1 "2015-04-14T15:02:15Z")

</div>

Hi there,

I’ve run into a small problem with the ec2\_vpc module.

It _looks_ like it should be possible to run the ec2\_vpc module without specifying subnets. This useful e.g. when you want to:

- (1) first define the subnets, then
- (2) set up an instance in one of the subnets, and then
- (3) define the VPC’s route tables, routing some traffic to the instance from step 2.

For step 1, I can use ec2\_vpc with subnets but no route\_tables; for step 3, I can use ec2\_vpc with route\_tables but no subnets.

Unfortunately, the module breaks if no subnets are specified at this point: [https://github.com/ansible/ansible-modules-core/blob/devel/cloud/amazon/ec2\_vpc.py#L491](https://github.com/ansible/ansible-modules-core/blob/devel/cloud/amazon/ec2_vpc.py#L491) (“TypeError: ‘NoneType’ object is not iterable”).

I would have expected that either this was wrapped in a “if subnets is not None:”, or that subnets would be a required argument. Is this a bug or am I holding it wrong?

Thanks!
