From e583db5d7f25587e1a100db321942b51c32714ac Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Wed, 17 Jun 2026 11:35:59 +0100 Subject: [PATCH] docs: use a generic example workspace name in cloud-tag docs/tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the example tag value in the colon-form cloud-block tag docs, docstring, and parser tests with a generic placeholder (`web-app`). No behaviour change — example string only. --- docs/migration.md | 2 +- services/terrapod/api/routers/tfe_v2.py | 2 +- services/tests/api/test_workspaces.py | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/migration.md b/docs/migration.md index 6e6e1b9..95883d1 100644 --- a/docs/migration.md +++ b/docs/migration.md @@ -201,7 +201,7 @@ terrapod-migrate rewrite --state-file migration-state.json --source-dir ~/code/a against each repo (locally cloned, on the operator's own machine). The tool walks the directory tree and mechanically rewrites: -- `terraform { cloud { hostname = "app.terraform.io", organization = "acme" ... } }` blocks → Terrapod hostname + `"default"` organization. Both `workspaces { name = "..." }` and `workspaces { tags = [...] }` forms are supported — only `hostname` and `organization` change; the workspace selection inside stays as-is (Terrapod's `tfe_v2` endpoint accepts the same `tags = [...]` syntax and translates internally). Tags are matched against workspace **labels**: a bare tag (`"core"`) matches any workspace with that label key, and a `key:value` tag (`"repo:tf-aws-core"`) matches that exact label. Use the colon form to select by key+value — OpenTofu rejects the Terraform 1.10+ map form (`tags = { repo = "..." }`), so `tags = ["repo:tf-aws-core"]` is the portable equivalent. +- `terraform { cloud { hostname = "app.terraform.io", organization = "acme" ... } }` blocks → Terrapod hostname + `"default"` organization. Both `workspaces { name = "..." }` and `workspaces { tags = [...] }` forms are supported — only `hostname` and `organization` change; the workspace selection inside stays as-is (Terrapod's `tfe_v2` endpoint accepts the same `tags = [...]` syntax and translates internally). Tags are matched against workspace **labels**: a bare tag (`"core"`) matches any workspace with that label key, and a `key:value` tag (`"repo:web-app"`) matches that exact label. Use the colon form to select by key+value — OpenTofu rejects the Terraform 1.10+ map form (`tags = { repo = "..." }`), so `tags = ["repo:web-app"]` is the portable equivalent. - `terraform { backend "remote" { hostname = "app.terraform.io", organization = "acme" ... } }` blocks → same destination as `cloud {}`. - `source = "app.terraform.io/acme/"` private-module references → `"/default/"`. diff --git a/services/terrapod/api/routers/tfe_v2.py b/services/terrapod/api/routers/tfe_v2.py index a21bcb3..c4c766a 100644 --- a/services/terrapod/api/routers/tfe_v2.py +++ b/services/terrapod/api/routers/tfe_v2.py @@ -760,7 +760,7 @@ def _parse_tag_filters(request: Request) -> list[tuple[str, str | None]]: # List form: search[tags]=a,b,c=d,e:f # A token is a bare `key`, or `key=value` / `key:value`. tofu's cloud # block emits the COLON form for set-of-string tags - # (`tags = ["repo:tf-aws-core"]`) because `=` is not a legal tofu/TFC + # (`tags = ["repo:web-app"]`) because `=` is not a legal tofu/TFC # tag character and the map form isn't supported in OpenTofu; the `=` # form comes from go-tfe / direct API callers. Split on whichever # separator appears first so both map to an exact key=value label. diff --git a/services/tests/api/test_workspaces.py b/services/tests/api/test_workspaces.py index 998407c..c445ec1 100644 --- a/services/tests/api/test_workspaces.py +++ b/services/tests/api/test_workspaces.py @@ -695,9 +695,9 @@ def test_list_form_colon_key_value(self): from terrapod.api.routers.tfe_v2 import _parse_tag_filters # OpenTofu's cloud block emits `key:value` for set-of-string tags - # (`tags = ["repo:tf-aws-core"]`) — map tags aren't supported there. - out = _parse_tag_filters(self._req("search%5Btags%5D=repo:tf-aws-core")) - assert out == [("repo", "tf-aws-core")] + # (`tags = ["repo:web-app"]`) — map tags aren't supported there. + out = _parse_tag_filters(self._req("search%5Btags%5D=repo:web-app")) + assert out == [("repo", "web-app")] def test_list_form_colon_value_with_hyphens(self): from terrapod.api.routers.tfe_v2 import _parse_tag_filters @@ -710,8 +710,8 @@ def test_list_form_mixed_colon_equals_and_bare(self): from terrapod.api.routers.tfe_v2 import _parse_tag_filters # Colon, equals, and bare tokens coexist; earliest separator wins. - out = _parse_tag_filters(self._req("search%5Btags%5D=core,repo:tf-aws-core,env=prod")) - assert out == [("core", None), ("repo", "tf-aws-core"), ("env", "prod")] + out = _parse_tag_filters(self._req("search%5Btags%5D=core,repo:web-app,env=prod")) + assert out == [("core", None), ("repo", "web-app"), ("env", "prod")] def test_list_form_colon_empty_key_skipped(self): from terrapod.api.routers.tfe_v2 import _parse_tag_filters