Skip to content

Extract Board Query blocks into a query_board resource #482

Open
@erikologic

Description

@erikologic

Is your feature request related to a problem? Please describe.
Working on rewriting a bunch of boards using the terraform provider.
So far so good but I find annoying for the query block in the honecombio_board resource to have to be defined in the board resource itself rather than being referenced from somewhere else.

I'm creating one module for one board:

  • main.tf -> board definition
  • [name].tf -> [name] query definition

If there are special visualisations I need to make for one query widget (e.g. stacked graph), I need to edit main.tf
I think this mixes things up and add confusion.
On top of it, is a different journey than the UI one cause in the UI you would edit in the query page, not the board one.

Describe the solution you'd like
I'd like to maintain separation.
My suggestion is create a honeycombio_query_visualisation resource which ID can be referenced in the honeycombio_board resource much like honeycombio_query_annotation:

resource "honeycombio_query_visualisation" "latency_by_userid" {
    query_id  = honeycombio_query.latency_by_userid.id

    graph_settings {
      utc_xaxis = true
    }
}

resource "honeycombio_board" "overview" {
  name = "Service Overview"

  query {
    query_id  = honeycombio_query.latency_by_userid.id
    query_annotation_id = honeycombio_query_annotation.latency_by_userid.id
    query_visualisation_id = honeycombio_query_visualisation.latency_by_userid.id
  }
}

Ideally I'd be able to do something like this in a main.tf file:

locals {
  queries = toset(["query1", "query2", ...])
}
resource "honeycombio_board" "board" {
  name = "The Board"

  dynamic "query" {
    for_each = local.queries
    content {
      query_id = query.value.query_id
      query_annotation_id = query.value.annotation_id
      query_visualisation_id = query.value.query_visualisation_id
    }
  }
}

and have a number of files each containing the detail of a query including the visualisation options.

Describe alternatives you've considered
Dynamic magic which would only make things more confusing IMO.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedThis issue is blocked by something external.featureThis issue wants to add new functionality.needs Honeycomb APIThis resource/data source requires an API that does not exist yet!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions