diff --git a/TerraformLibrary/terraformlibrary.py b/TerraformLibrary/terraformlibrary.py index 5df85fd..0e9a81d 100644 --- a/TerraformLibrary/terraformlibrary.py +++ b/TerraformLibrary/terraformlibrary.py @@ -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