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

fix(client) - queryspec Granularity equivalency #404

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

jharley
Copy link
Collaborator

@jharley jharley commented Nov 24, 2023

Reported via Pollinators (link).

The Query Builder will export JSON query specs with "granularity": 0, but the API will not return this field if it's set to zero. This marks either case as equivalent.

Prior to this change a honeycombio_query as below would cause an infinite diff:

resource "honeycombio_query" "test" {
  dataset    = var.dataset
  query_json = <<-EOF
{
  "breakdowns": ["app.tenant"],
  "calculations": [{ "op": "COUNT" }],
  "orders": [
    {
      "column": "app.tenant",
      "order": "ascending"
    }
  ],
  "granularity": 0
  "filter_combination": "AND",
}
EOF
}

Plan output:

  # honeycombio_query.test must be replaced
-/+ resource "honeycombio_query" "test" {
      ~ id         = "AD1Ue8TJCfC" -> (known after apply)
      ~ query_json = jsonencode(
          ~ {
              + filter_combination = "AND"
              + granularity        = 0
              ~ orders             = [
                  ~ {
                      + order  = "ascending"
                        # (1 unchanged attribute hidden)
                    },
                ]
                # (3 unchanged attributes hidden)
            } # forces replacement
        )
        # (1 unchanged attribute hidden)
    }

@jharley jharley added the bug label Nov 24, 2023
@jharley jharley requested a review from a team as a code owner November 24, 2023 15:24
@jharley jharley merged commit 9b0ffb3 into main Nov 27, 2023
3 checks passed
@jharley jharley deleted the jharley.fix-qs-equiv-granularity branch November 27, 2023 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants