Closed natemarks closed 10 months ago
I was able to reproduce the problem. I tested the same config on a subnet in an account that has a default vpc/subnet and it worked. Then I moved back to the subnet in the account without a default vpc/subnet and it failed. then i created a default vpc/subnet and it worked.
I think the AWS best practices recommend deleting default VPC/subnets, so this should probably only look for them as a fallback
I too am running into this issue with the driver. I have created a default vpc which has worked around the problem but it would be great to see if the process can be skipped if VPC information is provided, as it is a best practice to delete all default vpcs (especially if they are not in use).
having the same issue
What I have just found on 0.4 is that you are supposed to only pass vpc_subnet_id
if you want to use a custom subnet id. Adding on top vpc_id
will make it fail, because it will assume that you want to auto-create it in that case. Just removing vpc_id
did work for me.
For reference, this is where in the code this hits.
if not module.params.get("vpc_subnet_id"):
if module.params.get("network"):
# grab AZ from one of the ENIs
ints = module.params.get("network").get("interfaces")
if ints:
filters["network-interface.network-interface-id"] = []
for i in ints:
if isinstance(i, dict):
i = i["id"]
filters["network-interface.network-interface-id"].append(i)
else:
sub = get_default_subnet(get_default_vpc(), availability_zone=module.params.get("availability_zone"))
filters["subnet-id"] = sub["SubnetId"]
I was starting to do an overcomplicated fix, but seems all we need to do is ensure we pass the subnet_id and this will never get called.
We always require it regardless, so this is ok. Submitting a PR now.
I think it's failing because my account has neither a default vpc nor a default subnet - even though I do provide a vpc id and subnet id
My molecule yaml looks like this (redacted IDs):