Skip to content

Fix Kibana SLO panic histogram_custom_indicator #430

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### Added
- Add support for the `.slack_api` connector type for Kibana action connectors ([#419](https://github.com/elastic/terraform-provider-elasticstack/pull/419))
- resource `elasticstack_kibana_slo`: Update `histogram_custom_indicator` `from` and `to` fields to float ([#430](https://github.com/elastic/terraform-provider-elasticstack/pull/430))

## [0.7.0] - 2023-08-22

Expand Down
4 changes: 2 additions & 2 deletions internal/kibana/slo.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ func ResourceSlo() *schema.Resource {
Optional: true,
},
"from": {
Type: schema.TypeInt, //TODO: validate this is set if aggregation is range
Type: schema.TypeFloat,
Optional: true,
},
"to": {
Type: schema.TypeInt, //TODO: validate this is set if aggregation is range
Type: schema.TypeFloat,
Optional: true,
},
},
Expand Down
8 changes: 6 additions & 2 deletions internal/kibana/slo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,21 @@ func TestAccResourceSlo(t *testing.T) {
),
},
{
SkipFunc: versionutils.CheckIfVersionIsUnsupported(version.Must(version.NewSemver("8.10.0-SNAPSHOT"))), //TODO: once 8.10.0 is released, move to 8.10.0
SkipFunc: versionutils.CheckIfVersionIsUnsupported(version.Must(version.NewSemver("8.10.0"))),
Config: getSLOConfig(sloName, "histogram_custom_indicator", true),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "histogram_custom_indicator.0.index", "my-index"),
resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "histogram_custom_indicator.0.good.0.field", "test"),
resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "histogram_custom_indicator.0.good.0.aggregation", "value_count"),
resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "histogram_custom_indicator.0.good.0.filter", "latency < 300"),
resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "histogram_custom_indicator.0.good.0.from", "0"),
resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "histogram_custom_indicator.0.good.0.to", "10"),
resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "histogram_custom_indicator.0.total.0.field", "test"),
resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "histogram_custom_indicator.0.total.0.aggregation", "value_count"),
),
},
{
SkipFunc: versionutils.CheckIfVersionIsUnsupported(version.Must(version.NewSemver("8.10.0-SNAPSHOT"))), //TODO: once 8.10.0 is released, move to 8.10.0
SkipFunc: versionutils.CheckIfVersionIsUnsupported(version.Must(version.NewSemver("8.10.0"))),
Config: getSLOConfig(sloName, "metric_custom_indicator", true),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "metric_custom_indicator.0.index", "my-index"),
Expand Down Expand Up @@ -340,6 +342,8 @@ func getSLOConfig(name string, indicatorType string, settingsEnabled bool) strin
field = "test"
aggregation = "supdawg"
filter = "latency < 300"
from = 0
to = 10
}
total {
field = "test"
Expand Down