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 8eca14e712..7305d34415 100644 --- a/plugins/modules/cloud/misc/terraform.py +++ b/plugins/modules/cloud/misc/terraform.py @@ -324,7 +324,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']