terraform workspace list failure warns instead of fails (#65044)

* terraform workspace list failure warns instead of fails

Fixes #64788

* add a changelog fragment

(cherry picked from commit b580f2929d)
pull/66383/head
Christophe Drevet-Droguet 5 years ago committed by Matt Clay
parent 06044aa3b8
commit c3cd510770

@ -0,0 +1,2 @@
bugfixes:
- terraform module - fixes usage for providers not supporting workspaces

@ -209,7 +209,7 @@ def get_workspace_context(bin_path, project_path):
command = [bin_path, 'workspace', 'list', '-no-color'] command = [bin_path, 'workspace', 'list', '-no-color']
rc, out, err = module.run_command(command, cwd=project_path) rc, out, err = module.run_command(command, cwd=project_path)
if rc != 0: if rc != 0:
module.fail_json(msg="Failed to list Terraform workspaces:\r\n{0}".format(err)) module.warn("Failed to list Terraform workspaces:\r\n{0}".format(err))
for item in out.split('\n'): for item in out.split('\n'):
stripped_item = item.strip() stripped_item = item.strip()
if not stripped_item: if not stripped_item:

Loading…
Cancel
Save