ec2_vpc runnable without subnets specified?

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 (“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!