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

* terraform workspace list failure warns instead of fails

Fixes #64788

* add a changelog fragment
This commit is contained in:
Christophe Drevet-Droguet 2019-12-21 12:50:31 +01:00 committed by Felix Fontein
parent e711d01ed1
commit b580f2929d
2 changed files with 3 additions and 1 deletions

View file

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

View file

@ -209,7 +209,7 @@ def get_workspace_context(bin_path, project_path):
command = [bin_path, 'workspace', 'list', '-no-color']
rc, out, err = module.run_command(command, cwd=project_path)
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'):
stripped_item = item.strip()
if not stripped_item: