Skip to content

xelon_template data source cannot find HQ custom templates by name #73

Description

@arminzaugg

Summary

Custom templates created in Xelon HQ are usable to create devices, but the xelon_template data source cannot discover them by name because the provider uses GET /templates / Templates.List, which appears to return the built-in catalog only.

Environment

  • Terraform: 1.14.8
  • Provider: Xelon-AG/xelon v1.3.2
  • Platform: darwin_arm64
  • Cloud: Zurich public cloud

Reproduction

  1. Create a VM from an uploaded ISO in Xelon HQ.
  2. Shut down the VM.
  3. In the HQ UI, create a custom template from the VM named vyos-manual-iso-template.
  4. Create a test VM from that custom template in the HQ UI.
  5. Query the device details through the API.

The device details include a template object similar to:

{
  "template": {
    "identifier": "<custom-template-id>",
    "type": "Custom",
    "hasServiceUser": false,
    "extendPartitionAllowed": false,
    "editNetworkAllowed": false
  }
}

This confirms the custom template exists and can be used.

However, searching/listing templates does not return it:

curl -H "Authorization: Bearer <token>" \
  -H "X-User-Id: <client-id>" \
  "https://hq.xelon.ch/api/v2/templates?search=vyos-manual-iso-template&perPage=100"

The response contains no matching custom template. Similar searches with search=vyos, search=manual, type=Custom, and type=custom also did not return the UI-created custom template.

Terraform Impact

The xelon_template data source searches by name using Templates.List:

data "xelon_template" "vyos" {
  name = "vyos-manual-iso-template"
}

Expected: the custom template is found by name.

Actual: the data source cannot find the custom template, so Terraform users must discover the custom template ID indirectly through a device created from it or through the UI.

Expected Behavior

One of these would make the provider usable for custom templates:

  • GET /templates includes custom templates visible to the tenant, or
  • the provider uses an endpoint that includes custom templates for the current tenant, or
  • the provider documents that data.xelon_template only supports catalog templates and not HQ custom templates.

Workaround

Create a device manually from the custom template, query that device's API details, and copy template.identifier into Terraform as a variable:

variable "vyos_template_id" {
  default = "<custom-template-id>"
}

resource "xelon_device" "vyos" {
  template_id = var.vyos_template_id
  # ...
}

Impact

This breaks a natural Terraform workflow for custom ISO/template users:

  1. create custom template in HQ,
  2. look it up by name with data.xelon_template,
  3. create devices from it.

The template is real and usable, but not discoverable through the provider's data source.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions