Skip to content

Commit

Permalink
Deprecate list-style Boards (#365)
Browse files Browse the repository at this point in the history
Today's Board announcements prompted me to deprecate the `style`
attribute on Boards to update the behaviour to match both the product
and the API.

All Boards are `visual` now ✨
  • Loading branch information
jharley authored Sep 14, 2023
1 parent 7eb05a3 commit 56589b9
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 42 deletions.
3 changes: 2 additions & 1 deletion client/board.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ type Board struct {
//
// n.b. 'list' style boards cannot specify a column layout
ColumnLayout BoardColumnStyle `json:"column_layout,omitempty"`
// How the board should be displayed in the UI, defaults to "list".
// How the board should be displayed in the UI, defaults to "visual".
// Deprecated: All Boards are visual now. This field is ignored.
Style BoardStyle `json:"style,omitempty"`
// Links returned by the board API for the Board
Links BoardLinks `json:"links,omitempty"`
Expand Down
7 changes: 3 additions & 4 deletions docs/resources/board.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ resource "honeycombio_query_annotation" "latency_by_userid" {
resource "honeycombio_board" "overview" {
name = "Service Overview"
style = "visual"
query {
caption = "Latency by User"
Expand All @@ -97,17 +96,17 @@ resource "honeycombio_board" "overview" {
The following arguments are supported:

* `name` - (Required) Name of the board.
* `description` - (Optional) Description of the board. Supports markdown.
* `description` - (Optional) Description of the board. Supports Markdown.
* `column_layout` - (Optional) the number of columns to layout on the board, either `multi` (the default) or `single`. Only `visual` style boards (see below) have a column layout.
* `style` - (Optional) How the board should be displayed in the UI, either `list` (the default) or `visual`.
* `style` - (Optional) Deprecated: All Boards are now displayed as `visual` style. How the board should be displayed in the UI, either `visual` (the default) or `list`.
* `query` - (Optional) Zero or more configurations blocks (described below) with the queries of the board.

Each board configuration may have zero or more `query` blocks, which accepts the following arguments:

* `query_id` - (Required) The ID of the Query to run.
* `query_annotation_id` - (Optional) The ID of the Query Annotation to associate with this query.
* `dataset` - (Deprecated) The dataset this query is associated with.
* `caption` - (Optional) A description of the query that will be displayed on the board. Supports markdown.
* `caption` - (Optional) Descriptive text to contextualize the Query within the Board. Supports Markdown.
* `graph_settings` - (Optional) A map of boolean toggles to manages the settings for this query's graph on the board.
If a value is unspecified, it is assumed to be false.
Currently supported toggles are:
Expand Down
1 change: 0 additions & 1 deletion example/board/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ resource "honeycombio_query" "query" {
resource "honeycombio_board" "board" {
name = "Request Latency"
description = "Latencies of all requests by Tenant for the last 15 minutes."
style = "list"

query {
caption = "Latency"
Expand Down
1 change: 0 additions & 1 deletion example/board_with_annotations/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ resource "honeycombio_query_annotation" "latency_by_userid" {

resource "honeycombio_board" "overview" {
name = "Service Overview"
style = "visual"
description = <<EOT
Helpful queries to get an overview of our service overall health and performance.
Useful as a jumping off point for BubbleUp or a quick investigation.
Expand Down
42 changes: 27 additions & 15 deletions honeycombio/resource_board.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,45 +24,54 @@ func newBoard() *schema.Resource {
"name": {
Type: schema.TypeString,
Required: true,
Description: "The name of the Board.",
ValidateFunc: validation.StringLenBetween(1, 255),
},
"description": {
Type: schema.TypeString,
Optional: true,
Description: "A description for the Board. Supports Markdown.",
ValidateFunc: validation.StringLenBetween(1, 1023),
},
"column_layout": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "The number of columns to layout on the Board.",
ValidateFunc: validation.StringInSlice([]string{"multi", "single"}, false),
},
"style": {
Type: schema.TypeString,
Optional: true,
Default: "list",
Default: "visual",
Description: "How the Board should be displayed in the UI.",
Deprecated: "All Boards now are displayed visually in the UI. Setting this value will have no effect.",
ValidateFunc: validation.StringInSlice(boardStyleStrings(), false),
},
"board_url": {
Type: schema.TypeString,
Required: false,
Optional: false,
Computed: true,
Type: schema.TypeString,
Description: "The URL to the Board in the Honeycomb UI.",
Required: false,
Optional: false,
Computed: true,
},
"query": {
Type: schema.TypeList,
Optional: true,
Type: schema.TypeList,
Optional: true,
Description: "A Query to be added to the Board.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"caption": {
Type: schema.TypeString,
Optional: true,
Description: "Descriptive text to contextualize the Query within the Board. Supports Markdown.",
ValidateFunc: validation.StringLenBetween(1, 1023),
},
"query_style": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "How the Query should be displayed within the Board.",
ValidateFunc: validation.StringInSlice(boardQueryStyleStrings(), false),
},
"graph_settings": {
Expand Down Expand Up @@ -115,18 +124,21 @@ See [Graph Settings](https://docs.honeycomb.io/working-with-your-data/graph-sett
},
},
"dataset": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Deprecated: "Board Queries no longer require the dataset as they rely on the provided Query ID's dataset.",
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "The Dataset this Query is associated with.",
Deprecated: "Board Queries no longer require the dataset as they rely on the provided Query ID's dataset.",
},
"query_id": {
Type: schema.TypeString,
Required: true,
Type: schema.TypeString,
Required: true,
Description: "The ID of the Query to run.",
},
"query_annotation_id": {
Type: schema.TypeString,
Optional: true,
Type: schema.TypeString,
Optional: true,
Description: "The ID of the Query Annotation to associate with this Query.",
},
},
},
Expand Down
21 changes: 1 addition & 20 deletions honeycombio/resource_board_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package honeycombio
import (
"context"
"fmt"
"regexp"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
Expand All @@ -22,7 +21,7 @@ func TestAccHoneycombioBoard_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckBoardExists(t, "honeycombio_board.test"),
resource.TestCheckResourceAttr("honeycombio_board.test", "name", "Test board from terraform-provider-honeycombio"),
resource.TestCheckResourceAttr("honeycombio_board.test", "style", "list"),
resource.TestCheckResourceAttr("honeycombio_board.test", "style", "visual"),
resource.TestCheckResourceAttr("honeycombio_board.test", "description", ""),
resource.TestCheckResourceAttr("honeycombio_board.test", "query.#", "2"),
resource.TestCheckResourceAttr("honeycombio_board.test", "query.0.caption", "test query 0"),
Expand Down Expand Up @@ -62,7 +61,6 @@ resource "honeycombio_query" "test" {
resource "honeycombio_board" "test" {
name = "simple board"
style = "visual"
column_layout = "single"
query {
Expand All @@ -85,22 +83,6 @@ resource "honeycombio_board" "test" {
},
},
})
resource.Test(t, resource.TestCase{
PreCheck: testAccPreCheck(t),
ProviderFactories: testAccProviderFactories,
Steps: []resource.TestStep{
{
Config: `
resource "honeycombio_board" "test" {
name = "error board"
style = "list"
column_layout = "multi"
}
`,
ExpectError: regexp.MustCompile(`list style boards cannot specify a column layout`),
},
},
})
}

func testAccBoardConfig(dataset string) string {
Expand Down Expand Up @@ -140,7 +122,6 @@ resource "honeycombio_query_annotation" "test" {
resource "honeycombio_board" "test" {
name = "Test board from terraform-provider-honeycombio"
style = "list"
query {
caption = "test query 0"
Expand Down

0 comments on commit 56589b9

Please sign in to comment.