From 8bd8ccd974f5eca0c8bda916e1bb195137be0d97 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Thu, 17 Sep 2020 19:23:43 +0200 Subject: [PATCH] Fix terraform changed status detection test (#561) (#563) (#908) * Fix terraform changed status detection test (#561) * Add changelog fragment * Update changelogs/fragments/563-update-terraform-status-test.yaml Co-authored-by: Felix Fontein Co-authored-by: Felix Fontein (cherry picked from commit 7e6bde2ce19c1022fe1bb28639d8d3badaf945a7) Co-authored-by: AdamGoldsmith --- changelogs/fragments/563-update-terraform-status-test.yaml | 4 ++++ plugins/modules/cloud/misc/terraform.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/563-update-terraform-status-test.yaml diff --git a/changelogs/fragments/563-update-terraform-status-test.yaml b/changelogs/fragments/563-update-terraform-status-test.yaml new file mode 100644 index 0000000000..40b0477bff --- /dev/null +++ b/changelogs/fragments/563-update-terraform-status-test.yaml @@ -0,0 +1,4 @@ +bugfixes: + - terraform - fix incorrectly reporting a status of unchanged when + number of resources added or destroyed are multiples of 10 + (https://github.com/ansible-collections/community.general/issues/561). diff --git a/plugins/modules/cloud/misc/terraform.py b/plugins/modules/cloud/misc/terraform.py index eb41a40c90..697517a44a 100644 --- a/plugins/modules/cloud/misc/terraform.py +++ b/plugins/modules/cloud/misc/terraform.py @@ -368,7 +368,7 @@ def main(): 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 - if '0 added, 0 changed' not in out and not state == "absent" or '0 destroyed' not in out: + if ' 0 added, 0 changed' not in out and not state == "absent" or ' 0 destroyed' not in out: changed = True if rc != 0: module.fail_json(