diff --git a/changelogs/fragments/65044-fix-terraform-no-workspace.yaml b/changelogs/fragments/65044-fix-terraform-no-workspace.yaml new file mode 100644 index 0000000000..3fc9f5918d --- /dev/null +++ b/changelogs/fragments/65044-fix-terraform-no-workspace.yaml @@ -0,0 +1,2 @@ +bugfixes: +- terraform module - fixes usage for providers not supporting workspaces diff --git a/lib/ansible/modules/cloud/misc/terraform.py b/lib/ansible/modules/cloud/misc/terraform.py index 3b7ad647d6..90b47c5bcc 100644 --- a/lib/ansible/modules/cloud/misc/terraform.py +++ b/lib/ansible/modules/cloud/misc/terraform.py @@ -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: