diff --git a/docs/resources/burn_alert.md b/docs/resources/burn_alert.md index 8006f85a..e4dc5516 100644 --- a/docs/resources/burn_alert.md +++ b/docs/resources/burn_alert.md @@ -20,6 +20,7 @@ variable "slo_id" { resource "honeycombio_burn_alert" "example_alert" { alert_type = "exhaustion_time" exhaustion_minutes = 480 + description = "Exhaustion burn alert description" dataset = var.dataset slo_id = var.slo_id @@ -51,6 +52,7 @@ resource "honeycombio_burn_alert" "example_alert" { alert_type = "budget_rate" budget_rate_window_minutes = 480 budget_rate_decrease_percent = 1 + description = "Budget rate burn alert description" dataset = var.dataset slo_id = var.slo_id @@ -84,6 +86,7 @@ data "honeycombio_recipient" "pd_prod" { resource "honeycombio_burn_alert" "example_alert" { exhaustion_minutes = 60 + description = "Burn alert description" dataset = var.dataset slo_id = var.slo_id @@ -103,6 +106,7 @@ resource "honeycombio_burn_alert" "example_alert" { The following arguments are supported: * `slo_id` - (Required) ID of the SLO this burn alert is associated with. * `dataset` - (Required) The dataset this burn alert is associated with. +* `description` - (Optional) Instructions on how to respond to the burn alert, e.g. run book link, next steps. * `alert_type` - (Optional) Type of the burn alert. Valid values are `exhaustion_time` and `budget_rate`. Defaults to `exhaustion_time`. * `budget_rate_window_minutes` - (Optional) The time period, in minutes, over which a budget rate will be calculated. diff --git a/internal/provider/burn_alert_resource_test.go b/internal/provider/burn_alert_resource_test.go index 2b953e94..143232fc 100644 --- a/internal/provider/burn_alert_resource_test.go +++ b/internal/provider/burn_alert_resource_test.go @@ -19,7 +19,7 @@ import ( "github.com/honeycombio/terraform-provider-honeycombio/client" ) -const baDescription = "burn alert description" +const testBADescription = "burn alert description" func TestAcc_BurnAlertResource_defaultBasic(t *testing.T) { dataset, sloID := burnAlertAccTestSetup(t) @@ -484,7 +484,6 @@ func TestAcc_BurnAlertResource_HandlesDynamicRecipientBlock(t *testing.T) { // Checks that the exhaustion time burn alert exists, has the correct attributes, and has the correct state func testAccEnsureSuccessExhaustionTimeAlert(t *testing.T, burnAlert *client.BurnAlert, exhaustionMinutes int, pagerdutySeverity, sloID string) resource.TestCheckFunc { - return resource.ComposeAggregateTestCheckFunc( // Check that the burn alert exists testAccEnsureBurnAlertExists(t, "honeycombio_burn_alert.test", burnAlert), @@ -494,7 +493,7 @@ func testAccEnsureSuccessExhaustionTimeAlert(t *testing.T, burnAlert *client.Bur // Check that the burn alert has the correct values in state resource.TestCheckResourceAttr("honeycombio_burn_alert.test", "slo_id", sloID), - resource.TestCheckResourceAttr("honeycombio_burn_alert.test", "description", baDescription), + resource.TestCheckResourceAttr("honeycombio_burn_alert.test", "description", testBADescription), resource.TestCheckResourceAttr("honeycombio_burn_alert.test", "alert_type", "exhaustion_time"), resource.TestCheckResourceAttr("honeycombio_burn_alert.test", "exhaustion_minutes", fmt.Sprintf("%d", exhaustionMinutes)), resource.TestCheckResourceAttr("honeycombio_burn_alert.test", "recipient.#", "1"), @@ -518,7 +517,7 @@ func testAccEnsureSuccessBudgetRateAlert(t *testing.T, burnAlert *client.BurnAle // Check that the burn alert has the correct values in state resource.TestCheckResourceAttr("honeycombio_burn_alert.test", "slo_id", sloID), - resource.TestCheckResourceAttr("honeycombio_burn_alert.test", "description", baDescription), + resource.TestCheckResourceAttr("honeycombio_burn_alert.test", "description", testBADescription), resource.TestCheckResourceAttr("honeycombio_burn_alert.test", "alert_type", "budget_rate"), resource.TestCheckResourceAttr("honeycombio_burn_alert.test", "budget_rate_window_minutes", fmt.Sprintf("%d", budgetRateWindowMinutes)), resource.TestCheckResourceAttr("honeycombio_burn_alert.test", "budget_rate_decrease_percent", helper.FloatToPercentString(budgetRateDecreasePercent)), @@ -578,10 +577,6 @@ func testAccEnsureAttributesCorrectBudgetRate(burnAlert *client.BurnAlert, budge return fmt.Errorf("incorrect alert_type: %s", burnAlert.AlertType) } - if burnAlert.Description != baDescription { - return fmt.Errorf("incorrect description: %s", burnAlert.Description) - } - if burnAlert.BudgetRateWindowMinutes == nil { return fmt.Errorf("incorrect budget_rate_window_minutes: expected not to be nil") } @@ -672,7 +667,6 @@ resource "honeycombio_burn_alert" "test" { dataset = "%[2]s" slo_id = "%[3]s" - recipient { id = honeycombio_pagerduty_recipient.test.id @@ -704,7 +698,7 @@ resource "honeycombio_burn_alert" "test" { pagerduty_severity = "%[4]s" } } -}`, exhaustionMinutes, dataset, sloID, pdseverity, baDescription) +}`, exhaustionMinutes, dataset, sloID, pdseverity, testBADescription) } func testAccConfigBurnAlertDefault_validateAttributesWhenAlertTypeIsExhaustionTime(dataset, sloID string) string { @@ -745,7 +739,7 @@ resource "honeycombio_burn_alert" "test" { pagerduty_severity = "%[4]s" } } -}`, exhaustionMinutes, dataset, sloID, pdseverity, baDescription) +}`, exhaustionMinutes, dataset, sloID, pdseverity, testBADescription) } func testAccConfigBurnAlertExhaustionTime_validateAttributesWhenAlertTypeIsExhaustionTime(dataset, sloID string) string { @@ -788,7 +782,7 @@ resource "honeycombio_burn_alert" "test" { pagerduty_severity = "%[5]s" } } -}`, budgetRateWindowMinutes, helper.FloatToPercentString(budgetRateDecreasePercent), dataset, sloID, pdseverity, baDescription) +}`, budgetRateWindowMinutes, helper.FloatToPercentString(budgetRateDecreasePercent), dataset, sloID, pdseverity, testBADescription) } func testAccConfigBurnAlertBudgetRate_trailingZeros(dataset, sloID string) string { @@ -814,7 +808,7 @@ resource "honeycombio_burn_alert" "test" { pagerduty_severity = "info" } } -}`, dataset, sloID, baDescription) +}`, dataset, sloID, testBADescription) } func testAccConfigBurnAlertBudgetRate_validateAttributesWhenAlertTypeIsBudgetRate(dataset, sloID string) string { @@ -859,7 +853,7 @@ resource "honeycombio_burn_alert" "test" { pagerduty_severity = "info" } } -}`, dataset, sloID, baDescription) +}`, dataset, sloID, testBADescription) } func testAccConfigBurnAlertWithSlackRecipient(dataset, sloID, channel string) string { @@ -875,7 +869,7 @@ resource "honeycombio_burn_alert" "test" { type = "slack" target = "%[3]s" } -}`, dataset, sloID, channel, baDescription) +}`, dataset, sloID, channel, testBADescription) } func testAccConfigBurnAlertWithDynamicRecipient(dataset, sloID string) string {