terrakube: Workspaces don't show up in workspace list if extra tags added

Bug description 🐞

If you have a cloud block using tags to find the workspace in Terrakube, similar to the following:

terraform {
  cloud {
    organization = "my-org"
    hostname     = "terrakube-api.example.com"
    workspaces {
      tags = ["iam"]
    }
  }
}

Terraform is only able to find the workspace in Terrakube if only the iam tag exists. If there are any additional tags added for sorting or other purposes in Terrakube, Terraform fails to discover the workspace, even though it has a tag matching the cloud block.

Steps to reproduce

Works with the above cloud block if the tag matches exactly: works

If you add a second tag, Terraform fails to find the workspace, even though it has a tag that matches the configuration in the cloud-block: nowork

Expected behavior

Terrakube should allow Terraform to match on individual tags and ignore any other tags that might be present on a workspace.

Example repository

No response

Anything else?

No response

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

Yes! This fixed the issue. Thanks so much! I tested typing in a tag in a workspace that already existed. It used the one that already existed in the DB (and in the dropdown list) successfully without throwing an error.

Try version 2.15.2

I sent #480 to fix the issue in the UI when adding tags.

I fixed the logic when searching tags, I will try to see if I can fix the database issue before releasing a hotfix version 2.15.1

Yes, if I have 2 tags in the cloud-block the workspace needs to have both tags to match (but it shouldn’t matter if it has additional ones).

Yeah in that case I will have to change the logic a little bit, thank you for your feedback