From 17c8e274dcc5c2ab0a78e1735329f58927d4b3bb Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 25 Sep 2023 05:51:22 +0200 Subject: [PATCH] [PR #7301/7bf24eeb backport][stable-7] Fixing incorrect string encapsulation for -backend-config. (#7315) Fixing incorrect string encapsulation for -backend-config. (#7301) * Fixing incorrect string encapsulation for -backend-config. Removing shlex_quote. * Adding change log fragemnt for bugfix: - "terraform module - prevents `-backend-config` option double encapsulating with `shlex_quote` function. (https://github.com/ansible-collections/community.general/pull/7301)." * Update changelogs/fragments/7301-fix-backend-config-string-encapsulation.yml Co-authored-by: Felix Fontein --------- Co-authored-by: Felix Fontein (cherry picked from commit 7bf24eeb84bcd66b4bcdee832204cb4e2500be7f) Co-authored-by: Kosala Atapattu --- .../fragments/7301-fix-backend-config-string-encapsulation.yml | 2 ++ plugins/modules/terraform.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/7301-fix-backend-config-string-encapsulation.yml diff --git a/changelogs/fragments/7301-fix-backend-config-string-encapsulation.yml b/changelogs/fragments/7301-fix-backend-config-string-encapsulation.yml new file mode 100644 index 0000000000..f8d01450f4 --- /dev/null +++ b/changelogs/fragments/7301-fix-backend-config-string-encapsulation.yml @@ -0,0 +1,2 @@ +bugfixes: + - "terraform - prevents ``-backend-config`` option double encapsulating with ``shlex_quote`` function. (https://github.com/ansible-collections/community.general/pull/7301)." \ No newline at end of file diff --git a/plugins/modules/terraform.py b/plugins/modules/terraform.py index 925961a032..27870b5b7c 100644 --- a/plugins/modules/terraform.py +++ b/plugins/modules/terraform.py @@ -325,7 +325,7 @@ def init_plugins(bin_path, project_path, backend_config, backend_config_files, i for key, val in backend_config.items(): command.extend([ '-backend-config', - shlex_quote('{0}={1}'.format(key, val)) + '{0}={1}'.format(key, val) ]) if backend_config_files: for f in backend_config_files: