diff --git a/internal/provider/burn_alert_resource_test.go b/internal/provider/burn_alert_resource_test.go index 3a6db488..9c2c42c1 100644 --- a/internal/provider/burn_alert_resource_test.go +++ b/internal/provider/burn_alert_resource_test.go @@ -482,6 +482,48 @@ func TestAcc_BurnAlertResource_HandlesDynamicRecipientBlock(t *testing.T) { }) } +func TestAcc_BurnAlertResource_HandlesDescriptionSetToEmptyString(t *testing.T) { + ctx := context.Background() + dataset, sloID := burnAlertAccTestSetup(t) + burnAlert := &client.BurnAlert{} + + config := fmt.Sprintf(` +resource "honeycombio_burn_alert" "test" { + exhaustion_minutes = 240 + + dataset = "%s" + slo_id = "%s" + + recipient { + type = "email" + target = "%s" + } +}`, dataset, sloID, test.RandomEmail()) + + resource.Test(t, resource.TestCase{ + PreCheck: testAccPreCheck(t), + ProtoV5ProviderFactories: testAccProtoV5MuxServerFactory, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testAccEnsureBurnAlertExists(t, "honeycombio_burn_alert.test", burnAlert), + resource.TestCheckResourceAttr("honeycombio_burn_alert.test", "description", ""), + ), + }, + { + PreConfig: func() { + // add a description to the burn alert outside of Terraform + burnAlert.Description = "test description" + _, err := testAccClient(t).BurnAlerts.Update(ctx, dataset, burnAlert) + require.NoError(t, err, "failed to update burn alert") + }, + Config: config, + }, + }, + }) +} + // 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(