Skip to content

Commit

Permalink
fix - handle when tfstate file is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
swaroopar committed Dec 22, 2023
1 parent 9dbcc32 commit ea1b6b4
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,19 @@ private void handleTerraformExecuteResult(TerraformExecutor executor, DeployTask
result.setState(failedState);
result.setMessage(tfEx.getMessage());
}
if (StringUtils.isNotEmpty(tfState)) {
result.getPrivateProperties().put(STATE_FILE_NAME, tfState);
}
if (Objects.nonNull(tfState)) {
if (StringUtils.isNotEmpty(tfState)) {
result.getPrivateProperties().put(STATE_FILE_NAME, tfState);
}

if (Objects.nonNull(task.getDeployResourceHandler())) {
try {
task.getDeployResourceHandler().handler(result);
} catch (TerraformExecutorException tfEx) {
log.error("Handle terraform resources failed. {}", tfEx.getMessage());
result.setState(TerraformExecState.DEPLOY_FAILED);
result.setMessage(tfEx.getMessage());
if (Objects.nonNull(task.getDeployResourceHandler())) {
try {
task.getDeployResourceHandler().handler(result);
} catch (TerraformExecutorException tfEx) {
log.error("Handle terraform resources failed. {}", tfEx.getMessage());
result.setState(TerraformExecState.DEPLOY_FAILED);
result.setMessage(tfEx.getMessage());
}
}
}
}
Expand Down

0 comments on commit ea1b6b4

Please sign in to comment.