private void bestEffortCheckWhetherCommandIsNotFound()

in TerraformCustomResourceHandler/src/main/java/com/amazon/servicecatalog/terraform/customresource/fulfillment/CommandSender.java [110:127]


    private void bestEffortCheckWhetherCommandIsNotFound(String commandId, String instanceId) {
        try {
            TimeUnit.SECONDS.sleep(30);
        } catch (InterruptedException e) {
            log.warn("Sleep before getting SSM command interrupted.");
        }

        try {
            GetCommandInvocationResult commandResult = ssmFacade.getCommand(commandId, instanceId);
            if ("FAILED".equals(commandResult.getStatus()) && commandResult.getResponseCode() == 127) {
                String message = String.format("Terraform wrapper script not found at %s on instance %s. SSM command ID: %s",
                                               TERRAFORM_COMMAND, instanceId, commandId);
                ResponsePoster.postFailure(request, message);
            }
        } catch (RuntimeException e) {
            log.warn("Encountered exception while trying to determine whether command is not found on Terraform server.", e);
        }
    }