terraform: Remove line that is suppressing output being shown (#66322)

* 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: Adam <adam.lemanski@gmail.com>
This commit is contained in:
Ric de France 2020-01-15 15:12:58 +11:00 committed by Abhijeet Kasurde
parent 73d343b7aa
commit 62991a8bdd
2 changed files with 5 additions and 1 deletions

View file

@ -0,0 +1,3 @@
---
bugfixes:
- terraform - reset out and err before plan creation (https://github.com/ansible/ansible/issues/64369)

View file

@ -347,6 +347,8 @@ def main():
# we aren't sure if this plan will result in changes, so assume yes # we aren't sure if this plan will result in changes, so assume yes
needs_application, changed = True, False needs_application, changed = True, False
out, err = '', ''
if state == 'absent': if state == 'absent':
command.extend(variables_args) command.extend(variables_args)
elif state == 'present' and plan_file: elif state == 'present' and plan_file:
@ -359,7 +361,6 @@ def main():
module.params.get('targets'), state, plan_file) module.params.get('targets'), state, plan_file)
command.append(plan_file) command.append(plan_file)
out, err = '', ''
if needs_application and not module.check_mode and not state == 'planned': if needs_application and not module.check_mode and not state == 'planned':
rc, out, err = module.run_command(command, cwd=project_path) rc, out, err = module.run_command(command, cwd=project_path)
# checks out to decide if changes were made during execution # checks out to decide if changes were made during execution