Skip to content

armgit / floci

Public Imported from GitHub
0

Light, fluffy, and always free - The AWS Local Emulator alternative

fix(ec2): skip terminated instances in DescribeNetworkInterfaces (#1074)

nblomquist9b436e6c67bb
diff --git a/src/main/java/io/github/hectorvent/floci/services/ec2/Ec2Service.java b/src/main/java/io/github/hectorvent/floci/services/ec2/Ec2Service.java
index b5b8e565c0..b10c79d253 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ec2/Ec2Service.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ec2/Ec2Service.java
@@ -1558,6 +1558,11 @@ public class Ec2Service {
Set<String> foundIds = new HashSet<>();
for (Instance inst : instances.values()) {
if (!inst.getRegion().equals(region)) continue;
+ if (inst.getState() != null
+ && inst.getState().getName() != null
+ && "terminated".equals(inst.getState().getName())) {
+ continue;
+ }
for (InstanceNetworkInterface eni : inst.getNetworkInterfaces()) {
if (!networkInterfaceIds.isEmpty()
&& !networkInterfaceIds.contains(eni.getNetworkInterfaceId())) {