#2877 - Ensure NetworkInterfaces are assigned to the default Subnet
This commit is contained in:
parent
7419f527d4
commit
5c7e0b56af
3 changed files with 56 additions and 2 deletions
|
|
@ -775,7 +775,14 @@ class Instance(TaggedEC2Resource, BotoInstance):
|
|||
if "SubnetId" in nic:
|
||||
subnet = self.ec2_backend.get_subnet(nic["SubnetId"])
|
||||
else:
|
||||
subnet = None
|
||||
# Get default Subnet
|
||||
subnet = [
|
||||
subnet
|
||||
for subnet in self.ec2_backend.get_all_subnets(
|
||||
filters={"availabilityZone": self._placement.zone}
|
||||
)
|
||||
if subnet.default_for_az
|
||||
][0]
|
||||
|
||||
group_id = nic.get("SecurityGroupId")
|
||||
group_ids = [group_id] if group_id else []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue