Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFE: Add Resource for Telemetry Collector #1034

Open
gneville-ot opened this issue Feb 6, 2025 · 1 comment
Open

RFE: Add Resource for Telemetry Collector #1034

gneville-ot opened this issue Feb 6, 2025 · 1 comment

Comments

@gneville-ot
Copy link

Add Resource for Telemetry Collector

There is currently a service registry apstra_telemetry_service_registry_entry resource but no collector resource.

Image

@chrismarget-j
Copy link
Collaborator

Hi @gneville-ot, thank you for opening this issue.

Indeed, there's no terraform resource for instantiating a collector.

As it happens, I created a collector using terraform for the first time yesterday using the low-level apstra_raw_json resource which was released yesterday with v0.83.1 of the provider.

The apstra_raw_json resource is an experiment. It naively sends the payload attribute to the specified url in the create phase and makes assumptions about how to execute read, update and delete operations. Most Apstra APIs work pretty much the same way, so its assumptions are reasonable-ish. For telemetry collectors, the optional id attribute must be configured, and it must match the service_name attribute inside of payload.

The apstra_raw_json resource makes no guarantees about compatibility with future Apstra releases (the payload attribute will need to change).

The configuration I used looked like this:

resource "apstra_raw_json" "collector" {
  url = "/api/telemetry/collectors"
  id  = local.collector_name
  payload = jsonencode({
    "collectors" = [
      {
        "cli" = "show loop-detect enhanced interface"
        "platform" = {
          "family"     = "junos,junos-ex,junos-qfx"
          "model"      = ""
          "os_type"    = "junos"
          "os_version" = "22.2r2"
        }
        "query" = {
          "accessors" = {
            "LocalIF"    = "/loop-detect-enhanced-interface-information/loop-detect-enhanced-interface-entry/ld-interface-name"
            "RemoteHost" = "/loop-detect-enhanced-interface-information/loop-detect-enhanced-interface-entry/ld-remote-host"
            "RemoteIF"   = "/loop-detect-enhanced-interface-information/loop-detect-enhanced-interface-entry/ld-remote-interface"
            "value"      = "/loop-detect-enhanced-interface-information/loop-detect-enhanced-interface-entry/ld-interface-state"
          }
          "filter" = ""
          "keys" = {
            "LocalIF"    = "LocalIF"
            "RemoteHost" = "RemoteHost"
            "RemoteIF"   = "RemoteIF"
          }
          "value" = "value"
        }
        "relaxed_schema_validation" = true
        "source_type"               = "cli"
      },
    ]
    "relaxed_schema_validation" = true
    "service_name"              = local.collector_name
  })
}

I'll leave this issue open until we've got a proper resource for telemetry collectors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants