diff --git a/src/main/java/com/google/jenkins/plugins/computeengine/ComputeEngineInstance.java b/src/main/java/com/google/jenkins/plugins/computeengine/ComputeEngineInstance.java index 6bf1bd8e..db3cbea5 100644 --- a/src/main/java/com/google/jenkins/plugins/computeengine/ComputeEngineInstance.java +++ b/src/main/java/com/google/jenkins/plugins/computeengine/ComputeEngineInstance.java @@ -134,16 +134,8 @@ protected void _terminate(TaskListener listener) throws IOException, Interrupted .createSnapshotSync(cloud.getProjectId(), this.zone, this.getNodeName(), createSnapshotTimeout); } - Map filterLabel = ImmutableMap.of(CLOUD_ID_LABEL_KEY, cloud.getInstanceId()); - var instanceExistsInCloud = - cloud.getClient().listInstancesWithLabel(cloud.getProjectId(), filterLabel).stream() - .anyMatch(instance -> instance.getName().equals(name)); - - // If the instance exists in the cloud, attempt to terminate it. This is an async call and we // return immediately, hoping for the best. - if (instanceExistsInCloud) { - cloud.getClient().terminateInstanceAsync(cloud.getProjectId(), zone, name); - } + cloud.getClient().terminateInstanceAsync(cloud.getProjectId(), zone, name); } catch (CloudNotFoundException cnfe) { listener.error(cnfe.getMessage()); } catch (OperationException oe) {