Make sure subnets and route_tables are initialized before using

Fixes #7712