Skip to content

Commit

Permalink
handle error on show --json
Browse files Browse the repository at this point in the history
  • Loading branch information
Nilsty committed Aug 6, 2024
1 parent 46cba92 commit db85d38
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions TerraformLibrary/terraformlibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,9 @@ def get_terraform_state(self, script_path: str):
"""
command = f"{self.exec} -chdir={script_path} show --json"
rc, output = self._run_command(command)
output_json = json.loads(output)
return output_json
if rc > 0:
logger.write(f"error = {output}")
return output
else:
output_json = json.loads(output)
return output_json

0 comments on commit db85d38

Please sign in to comment.