From 98d63b74e2bbaa53201496e5fbe863d214eba428 Mon Sep 17 00:00:00 2001 From: Federico Maleh Date: Thu, 3 Sep 2026 15:01:07 -0300 Subject: [PATCH 1/3] fix(service_definition): honrar dimensions del template y admitir la forma required --- nullplatform/service_definition/README.md | 2 +- nullplatform/service_definition/main.tf | 2 +- nullplatform/service_definition/variables.tf | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nullplatform/service_definition/README.md b/nullplatform/service_definition/README.md index 3a76ad273..59ec4ea90 100644 --- a/nullplatform/service_definition/README.md +++ b/nullplatform/service_definition/README.md @@ -72,7 +72,7 @@ resource "example_resource" "this" { | [available\_actions](#input\_available\_actions) | List of action template names to fetch from the service spec repository | `list(string)` | `[]` | no | | [available\_links](#input\_available\_links) | List of link template names to fetch from the service spec repository | `list(string)` |
[
"connect"
]
| no | | [bitbucket\_email](#input\_bitbucket\_email) | Bitbucket account email, used only when git\_provider = "bitbucket". Set it when repository\_token is an Atlassian API token: those authenticate ONLY via HTTP Basic "email:api\_token" and return 401 with a Bearer header. Leave null when repository\_token is a Bitbucket workspace/repository access token, which is sent as a Bearer token. | `string` | `null` | no | -| [dimensions](#input\_dimensions) | Key-value pairs for dimensions to be associated with the service specification | `map(string)` | `{}` | no | +| [dimensions](#input\_dimensions) | Dimensions for the service specification, used when the spec template does not declare its own. The API accepts both a map of values and the required-flag form, e.g. {"environment": {"required": true}}, so this is intentionally untyped. | `any` | `{}` | no | | [extra\_visibile\_to\_nrns](#input\_extra\_visibile\_to\_nrns) | Additional NRNs that should have visibility to the created service specification | `list(string)` | `[]` | no | | [git\_provider](#input\_git\_provider) | Git provider to fetch service specs from. Supported values: "github", "gitlab", "bitbucket", "local". | `string` | `"github"` | no | | [gitlab\_host](#input\_gitlab\_host) | GitLab host. Only used when git\_provider = "gitlab". Override for self-hosted instances (e.g. "gitlab.mycompany.com"). | `string` | `"gitlab.com"` | no | diff --git a/nullplatform/service_definition/main.tf b/nullplatform/service_definition/main.tf index b0696d777..0a781d4ea 100644 --- a/nullplatform/service_definition/main.tf +++ b/nullplatform/service_definition/main.tf @@ -11,7 +11,7 @@ resource "nullplatform_service_specification" "from_template" { provider = local.service_spec_parsed.selectors.provider sub_category = local.service_spec_parsed.selectors.sub_category } - dimensions = jsonencode(var.dimensions) + dimensions = jsonencode(try(local.service_spec_parsed.dimensions, var.dimensions)) } resource "nullplatform_action_specification" "from_templates" { diff --git a/nullplatform/service_definition/variables.tf b/nullplatform/service_definition/variables.tf index a4cbaf844..2dd0615ff 100644 --- a/nullplatform/service_definition/variables.tf +++ b/nullplatform/service_definition/variables.tf @@ -95,9 +95,9 @@ variable "extra_visibile_to_nrns" { } variable "dimensions" { - type = map(string) + type = any default = {} - description = "Key-value pairs for dimensions to be associated with the service specification" + description = "Dimensions for the service specification, used when the spec template does not declare its own. The API accepts both a map of values and the required-flag form, e.g. {\"environment\": {\"required\": true}}, so this is intentionally untyped." } variable "repository_ref_type" { From 704209a98bdddad7eee331db66dcd9c55b4fb750 Mon Sep 17 00:00:00 2001 From: Federico Maleh Date: Mon, 7 Sep 2026 15:38:48 -0300 Subject: [PATCH 2/3] =?UTF-8?q?fix(service=5Fdefinition):=20template=20vac?= =?UTF-8?q?=C3=ADo=20no=20pisa=20var.dimensions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nullplatform/service_definition/locals.tf | 3 +++ nullplatform/service_definition/main.tf | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/nullplatform/service_definition/locals.tf b/nullplatform/service_definition/locals.tf index 9a3dcdeac..389f0da5a 100644 --- a/nullplatform/service_definition/locals.tf +++ b/nullplatform/service_definition/locals.tf @@ -49,6 +49,9 @@ locals { jsondecode(data.http.service_spec_template[0].response_body) ) + template_dimensions = try(local.service_spec_parsed.dimensions, {}) + effective_dimensions = length(local.template_dimensions) > 0 ? local.template_dimensions : var.dimensions + available_actions = var.available_actions available_links = var.available_links visible_to_nrns = concat([var.nrn], var.extra_visibile_to_nrns) diff --git a/nullplatform/service_definition/main.tf b/nullplatform/service_definition/main.tf index 0a781d4ea..e9a8e0cf6 100644 --- a/nullplatform/service_definition/main.tf +++ b/nullplatform/service_definition/main.tf @@ -11,7 +11,7 @@ resource "nullplatform_service_specification" "from_template" { provider = local.service_spec_parsed.selectors.provider sub_category = local.service_spec_parsed.selectors.sub_category } - dimensions = jsonencode(try(local.service_spec_parsed.dimensions, var.dimensions)) + dimensions = jsonencode(local.effective_dimensions) } resource "nullplatform_action_specification" "from_templates" { From df33a51434e5d89f50449ea691569a607f3d000b Mon Sep 17 00:00:00 2001 From: Federico Maleh Date: Mon, 7 Sep 2026 15:38:50 -0300 Subject: [PATCH 3/3] fix(service_definition): eximir git_provider local del ref pinneado --- nullplatform/service_definition/variables.tf | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nullplatform/service_definition/variables.tf b/nullplatform/service_definition/variables.tf index 2dd0615ff..2c171c4c2 100644 --- a/nullplatform/service_definition/variables.tf +++ b/nullplatform/service_definition/variables.tf @@ -39,11 +39,16 @@ variable "repository_branch" { points at is its own choice, so there is no version anyone could pick for it. Combine with repository_ref_type, which selects the namespace this name lives in. + + Not read when git_provider = "local": specs come from local_specs_path and no + spec repository is fetched, so the pinned-ref rule below does not apply there. EOT validation { - condition = var.repository_branch != "" && !contains(["main", "master", "head", "latest"], lower(var.repository_branch)) - error_message = "repository_branch must be a non-empty pinned ref, not empty and not a moving branch." + condition = var.git_provider == "local" || ( + var.repository_branch != "" && !contains(["main", "master", "head", "latest"], lower(var.repository_branch)) + ) + error_message = "repository_branch must be a non-empty pinned ref, not empty and not a moving branch. Only git_provider = \"local\" is exempt, since it reads no spec repository." } }