Repository: honeycombio/terraform-provider-honeycombio (language: python)

Issue:
RFC: Provider Breaking Changes
# Overview

Honeycomb has recently taken ownership of the Terraform Provider which was originally developed and maintained by community member Koenraad Verheyden (thank you! 🙏🏻 ).

Leading up to the first Honeycomb-owned release of the Provider there are three breaking changes we feel need to be made:

1. The `honeycombio_query` data source will be renamed to `honeycombio_query_specification`. Initially raised in #65.
1. The `honeycombio_board` resource will no longer support inline Query JSON and instead require that you create a `honeycombio_query` resource and pass the ID in the list of queries on the Board. Initially raised in #55, and currently blocking #84 and #82.
1. The `honeycombio_trigger` resource will no longer support inline Query JSON and instead require that you create a `honeycombio_query` resource and pass the ID to the Trigger resource. Also raised in #55.

As the move to the Honeycomb-maintained version of the provider will require that you update the namespace used in your `required_providers` configuration from `kvrhdn` to `honeycombio` we hope that these changes will be more easily managed.

This informal RFC was written to offer transparency around these changes and give the provider's user community a chance to comment on the changes.

## honeycombio_query data source change

This datasource never allowed you to fetch an existing Query object, but instead helped you form a valid Query Specification in HCL. Renaming this to `honeycombio_query_specification` seems most accurate and the change should easily be handled by a simple ‘find and replace’.

## honeycombio_board resource change

The Provider currently supports providing one or more inline queries (as Query Spec JSON `query_json`) to a Board resource to create a Board. This was created before either of the Query API or Query Annotations API existed, but both customers and the field team are looking to be able to build Boards via Terraform made up of fully annotated queries managed in code.

Inline queries are problematic because providing the query JSON to the API makes a Query object for you which is then difficult to track in Terraform as it’s a “computed sometimes” attribute of the resource. The explicit creation of a Query resource also feels more declarative and ✨ Terraform-ish ✨ .

Boards with Terraform today look something like this:

```
resource “honeycombio_board” “myboard” {
    name  = "Test board managed by Terraform"
    style = "list"

    query {
      caption       = "test query"
      dataset       = var.dataset
      query_json    = data.honeycombio_query.test.json
    }
    query {
      caption        = "my verbose query"
      query_style    = "combo"
      dataset        = var.dataset
      // Inline query
      query_json  = <<EOH
{
    "time_range": 604800,
<truncated for brevity>
}
EOH
    }
}
```

The current Board resource implementation ignores the returned `query_id` completely.

### Proposed change

The change to the Board resource’s schema will remove the ability to provide a Query Specification directly and instead require that you make use of the existing Query resource to construct Queries – with the recommendation that you do so with the assistance of the (newly renamed) Query Specification data source.

The above would turn into something like this:

```
resource “honeycombio_query” “helpful-query” {
   dataset       = var.dataset
   query_json    = data.honeycombio_query_specification.helpful.json
}

resource “honeycombio_query” “other-query” {
   dataset     = var.dataset
   query_json  = data.honeycombio_query_specification.other.json
}

resource “honeycombio_board” “myboard” {
    name  = "Test board managed by Terraform"
    style   = "list"

    query {
      caption       = "A very Helpful Query"
      dataset       = var.dataset
      query_id      = honeycombio_query.helpful-query.id
    }
    query {
      caption        = "my verbose query"
      query_style    = "table"
      dataset        = var.dataset
      query_id       = honeycombio_query.other-query.id
    }
}
```

The above paves the way for cleanly making use of the Query Annotation resource to name and describe the queries on the Board.

### Abandoned Ideas

- Adding an “inline_query” type to the Board resource which allowed you to provide the Query Spec as JSON and would track the returned “query_id” as a “Calculated” schema attribute. Abandoned as it was still a breaking change (all current “query” would need to be moved to “inline_query”)
- Attempting to use the Terraform Plugin SDK’s experimental “GetRawConfig” to extract the parsed HCL and determine if “query_json” was in use. This was ugly and felt like the sort of brittle that would break in a future version of the Provider SDK.

## honeycombio_trigger resource change

Similar to the Board resource, the Provider currently supports passing an inline Query (as Query Specification JSON) to create a Trigger. The explicit creation of a Query resource also feels more declarative and ✨ Terraform-ish ✨ .

This change is ultimately intended to bring more consistency to the Provider’s interface.

Triggers in Terraform today look something like this:

```
resource “honeycombio_trigger” “mytrigger” {
  name       = "Trigger managed by Terraform"
  dataset    = var.dataset
  query_json = data.honeycombio_query.mytrigger.json

  frequency = 300

  threshold {
    op    = ">"
    value = 50
  }
  
  recipient {
    type   = "email"
    target = "hello@example.com"
  }
}
```

### Proposed change

The change to the Trigger resource’s schema will remove the ability to provide a Query Specification directly and instead require that you make use of the existing Query resource to construct Queries – with the recommendation that you do so with the assistance of the (newly renamed) Query Specification data source.

The above would turn into something like this:

```
resource “honeycombio_query” “mytrigger” {
  dataset    = var.dataset
  query_json = data.honeycombio_query_specification.mytrigger.json
}

resource “honeycombio_trigger” “mytrigger” {
  name     = "Trigger managed by Terraform"
  dataset  = var.dataset
  query_id = honeycombio_query.mytrigger.id

  frequency = 300

  threshold {
    op    = ">"
    value = 50
  }
  
  recipient {
    type   = "email"
    target = "hello@example.com"
  }
}
```
Rename data source honeycombio_query to honeycombio_query_spec
With the new honeycombio_query resource, it becomes confusing to have to differentiate between the `honeycombio_query` [data source](https://github.com/kvrhdn/terraform-provider-honeycombio/blob/main/docs/data-sources/query.md) and [the resource](https://github.com/kvrhdn/terraform-provider-honeycombio/blob/main/docs/resources/query.md).
The `honeycombio_query` data source is not actually a query though, it's a query specification as used described [in the docs](https://docs.honeycomb.io/api/query-specification/).

To avoid this confusion we should:
- rename the `honeycombio_query` data source to `honeycombio_query_spec`
- rename attributes that expect a query specification from `query` to `query_spec`


Discussion / hints:
This makes a lot of sense to me. My only concern is around how the provider will handle management of the existing state with these resource changes/additions. I believe that making these changes in the Terraform code followed by an apply would simply show:
- newly created `honeycombio_query_specification` resources
- potential changes to `honeycombio_board` (particularly if query titles are added)
- no changes to `honeycombio_trigger` resources since the query definitions themselves will remain the same

In other words, I _think_ the transition will be seamless. Does that track with your expectations @jharley? 
I'd rather avoid having to do manual imports of resources.
@slizco Correct! These are just breaking changes to the schema which should not cause entire resources to be removed from state or put you into a position of needing to do 'state surgery' (manual imports or `state rm`)
@slizco Wait, I just thought about it a bit more: `honeycombio_trigger` resources will show an update as the Query ID will be changed but it should be an update in place.
Hej @kvrhdn 
First of all, thanks for creating/providing this provider. We are adopting it currently into our workflow.

Reading this issue, I would vote for being consistent with the naming from `honeycomb` documentation. There is a unambiguous difference in `query` and `query_id` (https://docs.honeycomb.io/api/triggers/#fields-on-a-trigger).

If so, we should leave the attributes for the `honeycombio_query_spec` datasource but after we introduced the `query` resource we should name those attributes `query_id`.

Thoughts? 

Fix patch:
diff --git a/docs/data-sources/query.md b/docs/data-sources/query_specification.md
similarity index 97%
rename from docs/data-sources/query.md
rename to docs/data-sources/query_specification.md
index 6df7eea2..14357bd3 100644
--- a/docs/data-sources/query.md
+++ b/docs/data-sources/query_specification.md
@@ -1,4 +1,4 @@
-# Data Source: honeycombio_query
+# Data Source: honeycombio_query_specification
 
 Construct a query that can be used in triggers and boards. For more information about the query specification, check out [Query Specification](https://docs.honeycomb.io/api/query-specification/).
 
@@ -7,7 +7,7 @@ The `json` attribute contains a serialized JSON representation which can be pass
 ## Example Usage
 
 ```hcl
-data "honeycombio_query" "example" {
+data "honeycombio_query_specification" "example" {
   # zero or more calculation blocks
   calculation {
     op     = "AVG"
@@ -34,7 +34,7 @@ data "honeycombio_query" "example" {
 }
 
 output "json_query" {
-    value = data.honeycombio_query.example.json
+    value = data.honeycombio_query_specification.example.json
 }
 ```
 
diff --git a/docs/data-sources/trigger_recipient.md b/docs/data-sources/trigger_recipient.md
index c1d85af8..25e490de 100644
--- a/docs/data-sources/trigger_recipient.md
+++ b/docs/data-sources/trigger_recipient.md
@@ -16,7 +16,7 @@ data "honeycombio_trigger_recipient" "slack" {
   target  = "honeycomb-triggers"
 }
 
-data "honeycombio_query" "example" {
+data "honeycombio_query_specification" "example" {
   calculation {
     op     = "AVG"
     column = "duration_ms"
@@ -26,7 +26,7 @@ data "honeycombio_query" "example" {
 resource "honeycombio_trigger" "example" {
   name        = "Requests are slower than usuals"
 
-  query_json = data.honeycombio_query.example.json
+  query_json = data.honeycombio_query_specification.example.json
   dataset    = var.dataset
 
   threshold {
diff --git a/docs/resources/board.md b/docs/resources/board.md
index cd18f51a..bc31bba2 100644
--- a/docs/resources/board.md
+++ b/docs/resources/board.md
@@ -13,7 +13,7 @@ locals {
   percentiles = ["P50", "P75", "P90", "P95"]
 }
 
-data "honeycombio_query" "query" {
+data "honeycombio_query_specification" "query" {
   count = length(local.percentiles)
 
   calculation {
@@ -46,7 +46,7 @@ resource "honeycombio_board" "board" {
       caption     = query.value
       query_style = "combo"
       dataset     = var.dataset
-      query_json  = data.honeycombio_query.query[query.key].json
+      query_json  = data.honeycombio_query_specification.query[query.key].json
     }
   }
 }
@@ -63,7 +63,7 @@ The following arguments are supported:
 
 Each board configuration may have zero or more `query` blocks, which accepts the following arguments:
 
-* `query_json` - (Required) A JSON object describing the query according to the [Query Specification](https://docs.honeycomb.io/api/query-specification/#fields-on-a-query-specification). While the JSON can be constructed manually, it is easiest to use the [`honeycombio_query`](../data-sources/query.md) data source.
+* `query_json` - (Required) A JSON object describing the query according to the [Query Specification](https://docs.honeycomb.io/api/query-specification/#fields-on-a-query-specification). While the JSON can be constructed manually, it is easiest to use the [`honeycombio_query_specification`](../data-sources/query_specification.md) data source.
 * `dataset` - (Required) The dataset this query is associated with.
 * `caption` - (Optional) A description of the query that will be displayed on the board. Supports markdown.
 * `query_style` - (Optional) How the query should be displayed within the board, either `graph` (the default), `table` or `combo`.
diff --git a/docs/resources/query.md b/docs/resources/query.md
index e7117730..a8409246 100644
--- a/docs/resources/query.md
+++ b/docs/resources/query.md
@@ -11,7 +11,7 @@ variable "dataset" {
   type = string
 }
 
-data "honeycombio_query" "test_query" {
+data "honeycombio_query_specification" "test_query" {
   calculation {
     op     = "AVG"
     column = "duration_ms"
@@ -26,7 +26,7 @@ data "honeycombio_query" "test_query" {
 
 resource "honeycombio_query" "test_query" {
   dataset = "%s"
-  query_json = data.honeycombio_query.test_query.json
+  query_json = data.honeycombio_query_specification.test_query.json
 }
 ```
 
@@ -35,7 +35,7 @@ resource "honeycombio_query" "test_query" {
 The following arguments are supported:
 
 * `dataset` - (Required) The dataset this query is added to.
-* `query_json` - (Required) A JSON object describing the query according to the [Query Specification](https://docs.honeycomb.io/api/query-specification/#fields-on-a-query-specification). While the JSON can be constructed manually, it is easiest to use the [`honeycombio_query`](../data-sources/query.md) data source.
+* `query_json` - (Required) A JSON object describing the query according to the [Query Specification](https://docs.honeycomb.io/api/query-specification/#fields-on-a-query-specification). While the JSON can be constructed manually, it is easiest to use the [`honeycombio_query_specification`](../data-sources/query_specification.md) data source.
 
 ## Attribute Reference
 
diff --git a/docs/resources/query_annotation.md b/docs/resources/query_annotation.md
index b7118b91..33a5c751 100644
--- a/docs/resources/query_annotation.md
+++ b/docs/resources/query_annotation.md
@@ -3,7 +3,7 @@
 Creates a query annotation in a dataset.
 
 -> **Note** A query annotation points to a specific query. Any change to the query will result in a new query ID and the annotation will no longer apply.
-If you use the "honeycombio_query" to determine the `query_id` parameter (as in the example below), Terraform will destroy the old query annotation and create a new one.
+If you use the "honeycombio_query_specification" to determine the `query_id` parameter (as in the example below), Terraform will destroy the old query annotation and create a new one.
 If this is wrong for your use case, please open an issue in [kvrhdn/terraform-provider-honeycombio](https://github.com/kvrhdn/terraform-provider-honeycombio).
 
 ## Example Usage
@@ -13,7 +13,7 @@ variable "dataset" {
   type = string
 }
 
-data "honeycombio_query" "test_query" {
+data "honeycombio_query_specification" "test_query" {
   calculation {
     op     = "AVG"
     column = "duration_ms"
@@ -28,7 +28,7 @@ data "honeycombio_query" "test_query" {
 
 resource "honeycombio_query" "test_query" {
   dataset    = var.dataset
-  query_json = data.honeycombio_query.test_query.json
+  query_json = data.honeycombio_query_specification.test_query.json
 }
 
 resource "honeycombio_query_annotation" "test_annotation" {
diff --git a/docs/resources/trigger.md b/docs/resources/trigger.md
index fcdd5445..44017b3f 100644
--- a/docs/resources/trigger.md
+++ b/docs/resources/trigger.md
@@ -9,7 +9,7 @@ variable "dataset" {
   type = string
 }
 
-data "honeycombio_query" "example" {
+data "honeycombio_query_specification" "example" {
   calculation {
     op     = "AVG"
     column = "duration_ms"
@@ -25,7 +25,7 @@ resource "honeycombio_trigger" "example" {
   name        = "Requests are slower than usuals"
   description = "Average duration of all requests for the last 10 minutes."
 
-  query_json = data.honeycombio_query.example.json
+  query_json = data.honeycombio_query_specification.example.json
   dataset    = var.dataset
 
   frequency = 600 // in seconds, 10 minutes
@@ -54,7 +54,7 @@ The following arguments are supported:
 
 * `name` - (Required) Name of the trigger.
 * `dataset` - (Required) The dataset this trigger is associated with.
-* `query_json` - (Required) A JSON object describng the query according to the [Query Specification](https://docs.honeycomb.io/api/query-specification/#fields-on-a-query-specification). While the JSON can be constructed manually, it is easiest to use the [`honeycombio_query`](../data-sources/query.md) data source.
+* `query_json` - (Required) A JSON object describng the query according to the [Query Specification](https://docs.honeycomb.io/api/query-specification/#fields-on-a-query-specification). While the JSON can be constructed manually, it is easiest to use the [`honeycombio_query_specification`](../data-sources/query_specification.md) data source.
 * `threshold` - (Required) A configuration block (described below) describing the threshold of the trigger.
 * `description` - (Optional) Description of the trigger.
 * `disabled` - (Optional) The state of the trigger. If true, the trigger will not be run. Defaults to false.
diff --git a/example/board/main.tf b/example/board/main.tf
index 2dc51024..3ba278eb 100644
--- a/example/board/main.tf
+++ b/example/board/main.tf
@@ -14,7 +14,7 @@ locals {
   percentiles = ["P50", "P75", "P90", "P95"]
 }
 
-data "honeycombio_query" "query" {
+data "honeycombio_query_specification" "query" {
   count = length(local.percentiles)
 
   calculation {
@@ -45,7 +45,7 @@ resource "honeycombio_board" "board" {
     content {
       caption    = query.value
       dataset    = var.dataset
-      query_json = data.honeycombio_query.query[query.key].json
+      query_json = data.honeycombio_query_specification.query[query.key].json
     }
   }
 }
diff --git a/example/trigger/main.tf b/example/trigger/main.tf
index 453e5fea..55eab67b 100644
--- a/example/trigger/main.tf
+++ b/example/trigger/main.tf
@@ -10,7 +10,7 @@ variable "dataset" {
   type = string
 }
 
-data "honeycombio_query" "query" {
+data "honeycombio_query_specification" "query" {
   calculation {
     op     = "AVG"
     column = "duration_ms"
@@ -35,7 +35,7 @@ resource "honeycombio_trigger" "trigger" {
 
   disabled = false
 
-  query_json = data.honeycombio_query.query.json
+  query_json = data.honeycombio_query_specification.query.json
   dataset    = var.dataset
 
   frequency = 900 // in seconds, 15 minutes
diff --git a/example/trigger_with_slack_recipient/main.tf b/example/trigger_with_slack_recipient/main.tf
index f3297b41..82dd7e06 100644
--- a/example/trigger_with_slack_recipient/main.tf
+++ b/example/trigger_with_slack_recipient/main.tf
@@ -10,7 +10,7 @@ variable "dataset" {
   type = string
 }
 
-data "honeycombio_query" "query" {
+data "honeycombio_query_specification" "query" {
   calculation {
     op     = "AVG"
     column = "duration_ms"
@@ -29,7 +29,7 @@ data "honeycombio_trigger_recipient" "slack" {
 resource "honeycombio_trigger" "trigger" {
   name = "Requests are slower than usual"
 
-  query_json = data.honeycombio_query.query.json
+  query_json = data.honeycombio_query_specification.query.json
   dataset    = var.dataset
 
   threshold {
diff --git a/honeycombio/data_source_query.go b/honeycombio/data_source_query_specification.go
similarity index 97%
rename from honeycombio/data_source_query.go
rename to honeycombio/data_source_query_specification.go
index 9f29e18f..99b56cb4 100644
--- a/honeycombio/data_source_query.go
+++ b/honeycombio/data_source_query_specification.go
@@ -13,9 +13,9 @@ import (
 	"github.com/honeycombio/terraform-provider-honeycombio/honeycombio/internal/hashcode"
 )
 
-func dataSourceHoneycombioQuery() *schema.Resource {
+func dataSourceHoneycombioQuerySpec() *schema.Resource {
 	return &schema.Resource{
-		ReadContext: dataSourceHoneycombioQueryRead,
+		ReadContext: dataSourceHoneycombioQuerySpecRead,
 
 		Schema: map[string]*schema.Schema{
 			"calculation": {
@@ -148,7 +148,7 @@ func dataSourceHoneycombioQuery() *schema.Resource {
 	}
 }
 
-func dataSourceHoneycombioQueryRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
+func dataSourceHoneycombioQuerySpecRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
 	calculations, err := extractCalculations(d)
 	if err != nil {
 		return diag.FromErr(err)
diff --git a/honeycombio/provider.go b/honeycombio/provider.go
index 90d7fc6f..0960c4d1 100644
--- a/honeycombio/provider.go
+++ b/honeycombio/provider.go
@@ -44,9 +44,9 @@ func Provider() *schema.Provider {
 			},
 		},
 		DataSourcesMap: map[string]*schema.Resource{
-			"honeycombio_datasets":          dataSourceHoneycombioDatasets(),
-			"honeycombio_query":             dataSourceHoneycombioQuery(),
-			"honeycombio_trigger_recipient": dataSourceHoneycombioSlackRecipient(),
+			"honeycombio_datasets":            dataSourceHoneycombioDatasets(),
+			"honeycombio_query_specification": dataSourceHoneycombioQuerySpec(),
+			"honeycombio_trigger_recipient":   dataSourceHoneycombioSlackRecipient(),
 		},
 		ResourcesMap: map[string]*schema.Resource{
 			"honeycombio_board":            newBoard(),


Test patch:
diff --git a/honeycombio/data_source_query_test.go b/honeycombio/data_source_query_specification_test.go
similarity index 89%
rename from honeycombio/data_source_query_test.go
rename to honeycombio/data_source_query_specification_test.go
index 88d202b5..96cf646c 100644
--- a/honeycombio/data_source_query_test.go
+++ b/honeycombio/data_source_query_specification_test.go
@@ -24,7 +24,7 @@ func TestAccDataSourceHoneycombioQuery_basic(t *testing.T) {
 }
 
 const testAccQueryConfig = `
-data "honeycombio_query" "test" {
+data "honeycombio_query_specification" "test" {
     calculation {
         op     = "AVG"
         column = "duration_ms"
@@ -63,7 +63,7 @@ data "honeycombio_query" "test" {
 }
 
 output "query_json" {
-    value = data.honeycombio_query.test.json
+    value = data.honeycombio_query_specification.test.json
 }`
 
 //Note: By default go encodes `<` and `>` for html, hence the `\u003e`
@@ -126,7 +126,7 @@ func TestAccDataSourceHoneycombioQuery_validationChecks(t *testing.T) {
 var testStepsQueryValidationChecks_calculation = []resource.TestStep{
 	{
 		Config: `
-data "honeycombio_query" "test" {
+data "honeycombio_query_specification" "test" {
   calculation {
     op     = "COUNT"
     column = "we-should-not-specify-a-column-with-COUNT"
@@ -137,7 +137,7 @@ data "honeycombio_query" "test" {
 	},
 	{
 		Config: `
-data "honeycombio_query" "test" {
+data "honeycombio_query_specification" "test" {
   calculation {
     op     = "AVG"
   }
@@ -150,7 +150,7 @@ data "honeycombio_query" "test" {
 var testStepsQueryValidationChecks_filter = []resource.TestStep{
 	{
 		Config: `
-data "honeycombio_query" "test" {
+data "honeycombio_query_specification" "test" {
   filter {
     column = "column"
     op     = "exists"
@@ -162,7 +162,7 @@ data "honeycombio_query" "test" {
 	},
 	{
 		Config: `
-data "honeycombio_query" "test" {
+data "honeycombio_query_specification" "test" {
   filter {
     column = "column"
     op     = ">"
@@ -173,7 +173,7 @@ data "honeycombio_query" "test" {
 	},
 	{
 		Config: `
-data "honeycombio_query" "test" {
+data "honeycombio_query_specification" "test" {
   filter {
     column        = "column"
     op            = ">"
@@ -186,7 +186,7 @@ data "honeycombio_query" "test" {
 	},
 	{
 		Config: `
-data "honeycombio_query" "test" {
+data "honeycombio_query_specification" "test" {
   filter {
     column        = "column"
     op            = "in"
@@ -200,7 +200,7 @@ data "honeycombio_query" "test" {
 
 func testStepsQueryValidationChecks_limit() []resource.TestStep {
 	var queryLimitFmt = `
-data "honeycombio_query" "test" {
+data "honeycombio_query_specification" "test" {
   limit = %d
 }`
 	return []resource.TestStep{
@@ -222,7 +222,7 @@ data "honeycombio_query" "test" {
 var testStepsQueryValidationChecks_time = []resource.TestStep{
 	{
 		Config: `
-data "honeycombio_query" "test" {
+data "honeycombio_query_specification" "test" {
   time_range = 7200
   start_time = 1577836800
   end_time   = 1577844000
@@ -232,7 +232,7 @@ data "honeycombio_query" "test" {
 	},
 	{
 		Config: `
-data "honeycombio_query" "test" {
+data "honeycombio_query_specification" "test" {
   time_range  = 120
   granularity = 13
 }
@@ -241,7 +241,7 @@ data "honeycombio_query" "test" {
 	},
 	{
 		Config: `
-data "honeycombio_query" "test" {
+data "honeycombio_query_specification" "test" {
   time_range  = 60000
   granularity = 59
 }
@@ -267,7 +267,7 @@ func TestAccDataSourceHoneycombioQuery_filterOpInAndNotIn(t *testing.T) {
 		Steps: []resource.TestStep{
 			{
 				Config: fmt.Sprintf(`
-data "honeycombio_query" "test" {
+data "honeycombio_query_specification" "test" {
   calculation {
     op = "COUNT"
   }
@@ -288,7 +288,7 @@ resource "honeycombio_board" "test" {
   name = "terraform-provider-honeycombio - Test honeycombio-query - filter ops in/not-in"
   query {
     dataset    = "%v"
-    query_json = data.honeycombio_query.test.json
+    query_json = data.honeycombio_query_specification.test.json
   }
 }`, dataset),
 			},
diff --git a/honeycombio/resource_board_test.go b/honeycombio/resource_board_test.go
index c07190ac..7464f3cf 100644
--- a/honeycombio/resource_board_test.go
+++ b/honeycombio/resource_board_test.go
@@ -36,7 +36,7 @@ func TestAccHoneycombioBoard_basic(t *testing.T) {
 
 func testAccBoardConfig(dataset string) string {
 	return fmt.Sprintf(`
-data "honeycombio_query" "test" {
+data "honeycombio_query_specification" "test" {
   count = 2
 
   calculation {
@@ -58,13 +58,13 @@ resource "honeycombio_board" "test" {
   query {
     caption = "test query 0"
     dataset = "%s"
-    query_json = data.honeycombio_query.test[0].json
+    query_json = data.honeycombio_query_specification.test[0].json
   }
   query {
     caption     = "test query 1"
     query_style = "combo"
     dataset     = "%s"
-    query_json  = data.honeycombio_query.test[1].json
+    query_json  = data.honeycombio_query_specification.test[1].json
   }
 }`, dataset, dataset)
 }
diff --git a/honeycombio/resource_query_annotation_test.go b/honeycombio/resource_query_annotation_test.go
index 14fa750f..15739882 100644
--- a/honeycombio/resource_query_annotation_test.go
+++ b/honeycombio/resource_query_annotation_test.go
@@ -37,7 +37,7 @@ func TestAccHoneycombioQueryAnnotation_update(t *testing.T) {
 
 func testAccResourceQueryAnnotationConfig(dataset string, name string) string {
 	return fmt.Sprintf(`
-data "honeycombio_query" "test" {
+data "honeycombio_query_specification" "test" {
   calculation {
     op     = "AVG"
     column = "duration_ms"
@@ -52,7 +52,7 @@ data "honeycombio_query" "test" {
 
 resource "honeycombio_query" "test" {
   dataset = "%s"
-  query_json = data.honeycombio_query.test.json
+  query_json = data.honeycombio_query_specification.test.json
 }
 
 resource "honeycombio_query_annotation" "test" {
diff --git a/honeycombio/resource_query_test.go b/honeycombio/resource_query_test.go
index afa0a245..59bb4377 100644
--- a/honeycombio/resource_query_test.go
+++ b/honeycombio/resource_query_test.go
@@ -40,7 +40,7 @@ func TestAccHoneycombioQuery_update(t *testing.T) {
 
 func testAccResourceQueryConfig(dataset string, duration int) string {
 	return fmt.Sprintf(`
-data "honeycombio_query" "test" {
+data "honeycombio_query_specification" "test" {
   calculation {
     op     = "AVG"
     column = "duration_ms"
@@ -55,7 +55,7 @@ data "honeycombio_query" "test" {
 
 resource "honeycombio_query" "test" {
   dataset = "%s"
-  query_json = data.honeycombio_query.test.json
+  query_json = data.honeycombio_query_specification.test.json
 }
 `, duration, dataset)
 }
diff --git a/honeycombio/resource_trigger_test.go b/honeycombio/resource_trigger_test.go
index 2187455b..98f65709 100644
--- a/honeycombio/resource_trigger_test.go
+++ b/honeycombio/resource_trigger_test.go
@@ -175,7 +175,7 @@ func TestAccHoneycombioTrigger_validationErrors(t *testing.T) {
 
 func testAccTriggerConfigWithFrequency(dataset string, frequency int) string {
 	return fmt.Sprintf(`
-data "honeycombio_query" "test" {
+data "honeycombio_query_specification" "test" {
   calculation {
     op     = "AVG"
     column = "duration_ms"
@@ -187,7 +187,7 @@ resource "honeycombio_trigger" "test" {
   name    = "Test trigger from terraform-provider-honeycombio"
   dataset = "%s"
 
-  query_json = data.honeycombio_query.test.json
+  query_json = data.honeycombio_query_specification.test.json
 
   threshold {
     op    = ">"
@@ -210,7 +210,7 @@ resource "honeycombio_trigger" "test" {
 
 func testAccTriggerConfigWithCount(dataset string) string {
 	return fmt.Sprintf(`
-data "honeycombio_query" "test" {
+data "honeycombio_query_specification" "test" {
   calculation {
     op     = "COUNT"
   }
@@ -221,7 +221,7 @@ resource "honeycombio_trigger" "test" {
   name    = "Test trigger from terraform-provider-honeycombio"
   dataset = "%s"
 
-  query_json = data.honeycombio_query.test.json
+  query_json = data.honeycombio_query_specification.test.json
 
   threshold {
     op    = ">"
@@ -249,7 +249,7 @@ EOF
 
 func testAccTriggerConfigWithRecipientID(dataset, recipientID string) string {
 	return fmt.Sprintf(`
-data "honeycombio_query" "test" {
+data "honeycombio_query_specification" "test" {
   calculation {
     op     = "AVG"
     column = "duration_ms"
@@ -261,7 +261,7 @@ resource "honeycombio_trigger" "test" {
   name    = "Test trigger from terraform-provider-honeycombio"
   dataset = "%s"
 
-  query_json = data.honeycombio_query.test.json
+  query_json = data.honeycombio_query_specification.test.json
         
   threshold {
     op    = ">"