From 4b0245355eb0713421a293d4637d49c42efdb824 Mon Sep 17 00:00:00 2001 From: Andrea Tartaglia Date: Sun, 8 May 2022 07:45:15 +0100 Subject: [PATCH] change list.copy() with list[:] for py2 compat in terraform module (#4621) * change list.copy() with list[:] for py2 compat in terraform module * add changelog fragment * Update changelogs/fragments/4621-terraform-py2-compat.yml Co-authored-by: Felix Fontein Co-authored-by: Felix Fontein --- changelogs/fragments/4621-terraform-py2-compat.yml | 2 ++ plugins/modules/cloud/misc/terraform.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/4621-terraform-py2-compat.yml diff --git a/changelogs/fragments/4621-terraform-py2-compat.yml b/changelogs/fragments/4621-terraform-py2-compat.yml new file mode 100644 index 0000000000..4bceafba6c --- /dev/null +++ b/changelogs/fragments/4621-terraform-py2-compat.yml @@ -0,0 +1,2 @@ +bugfixes: + - terraform - fix list initialization to support both Python 2 and Python 3 (https://github.com/ansible-collections/community.general/issues/4531). diff --git a/plugins/modules/cloud/misc/terraform.py b/plugins/modules/cloud/misc/terraform.py index 3c3662c6d2..4bdf559511 100644 --- a/plugins/modules/cloud/misc/terraform.py +++ b/plugins/modules/cloud/misc/terraform.py @@ -332,7 +332,7 @@ def build_plan(command, project_path, variables_args, state_file, targets, state if plan_path is None: f, plan_path = tempfile.mkstemp(suffix='.tfplan') - local_command = command.copy() + local_command = command[:] plan_command = [command[0], 'plan']