summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZadkiel <zadkiel.aharonian@gmail.com>2021-03-08 04:12:00 +0100
committerGitHub <noreply@github.com>2021-03-07 21:12:00 -0600
commitd3376f1b20f8b69a4ec8541764e858fa2b8ac55f (patch)
tree8a7ebf504801b228683e0b723647d6fd97122c6a
parent5a9f4f7bb395f4738d682c87e659267cc3929d76 (diff)
downloadansible-d3376f1b20f8b69a4ec8541764e858fa2b8ac55f.tar.gz
terraform: Remove line that is suppressing output being shown (#66322) (#73803)
* remove the line that is suppressing the output being shown when running terraform from ansible * Address #56934 and #57044 * added changelog for bug fix for missing terraform output Co-authored-by: Ric de France <41117503+ric-man@users.noreply.github.com> Co-authored-by: Adam <adam.lemanski@gmail.com>
-rw-r--r--changelogs/fragments/66322-moved_line_causing_terraform_output_suppression.yml3
-rw-r--r--lib/ansible/modules/cloud/misc/terraform.py3
2 files changed, 5 insertions, 1 deletions
diff --git a/changelogs/fragments/66322-moved_line_causing_terraform_output_suppression.yml b/changelogs/fragments/66322-moved_line_causing_terraform_output_suppression.yml
new file mode 100644
index 0000000000..4598270fbc
--- /dev/null
+++ b/changelogs/fragments/66322-moved_line_causing_terraform_output_suppression.yml
@@ -0,0 +1,3 @@
+---
+bugfixes:
+ - terraform - reset out and err before plan creation (https://github.com/ansible/ansible/issues/64369)
diff --git a/lib/ansible/modules/cloud/misc/terraform.py b/lib/ansible/modules/cloud/misc/terraform.py
index 90b47c5bcc..439d4752ae 100644
--- a/lib/ansible/modules/cloud/misc/terraform.py
+++ b/lib/ansible/modules/cloud/misc/terraform.py
@@ -347,6 +347,8 @@ def main():
# we aren't sure if this plan will result in changes, so assume yes
needs_application, changed = True, False
+ out, err = '', ''
+
if state == 'absent':
command.extend(variables_args)
elif state == 'present' and plan_file:
@@ -359,7 +361,6 @@ def main():
module.params.get('targets'), state, plan_file)
command.append(plan_file)
- out, err = '', ''
if needs_application and not module.check_mode and not state == 'planned':
rc, out, err = module.run_command(command, cwd=project_path)
# checks out to decide if changes were made during execution