@@ -2,6 +2,7 @@ package sumologic
22
33import (
44 "fmt"
5+ "regexp"
56 "testing"
67
78 "github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
@@ -50,6 +51,28 @@ func TestAccSumoLogicPartition_basic(t *testing.T) {
5051 "sumologic_partition.foo" , "is_compliant" , "false" ),
5152 ),
5253 },
54+ // allow change in casing of analytics_tier
55+ {
56+ Config : updatePartitionAnalyticsTierCase (testName ),
57+ Check : resource .ComposeTestCheckFunc (
58+ testAccCheckPartitionExists ("sumologic_partition.foo" ),
59+ resource .TestCheckResourceAttr (
60+ "sumologic_partition.foo" , "name" , "terraform_acctest_" + testName ),
61+ resource .TestCheckResourceAttr (
62+ "sumologic_partition.foo" , "routing_expression" , "_sourcecategory=*/Terraform" ),
63+ resource .TestCheckResourceAttr (
64+ "sumologic_partition.foo" , "analytics_tier" , "continuous" ),
65+ resource .TestCheckResourceAttr (
66+ "sumologic_partition.foo" , "retention_period" , "366" ),
67+ resource .TestCheckResourceAttr (
68+ "sumologic_partition.foo" , "is_compliant" , "false" ),
69+ ),
70+ },
71+ // Update analytics tier to a different value and assert error
72+ {
73+ Config : updatePartitionAnalyticsTierConfig (testName ),
74+ ExpectError : regexp .MustCompile (`(?i)analytics_tier of a partition can only be updated post creation if partition has been moved to flex tier` ),
75+ },
5376 },
5477 })
5578}
@@ -107,3 +130,27 @@ resource "sumologic_partition" "foo" {
107130}
108131` , testName )
109132}
133+
134+ func updatePartitionAnalyticsTierConfig (testName string ) string {
135+ return fmt .Sprintf (`
136+ resource "sumologic_partition" "foo" {
137+ name = "terraform_acctest_%s"
138+ routing_expression = "_sourcecategory=*/Terraform"
139+ retention_period = 365
140+ is_compliant = false
141+ analytics_tier = "infrequent" // Changed from "continuous" to trigger error
142+ }
143+ ` , testName )
144+ }
145+
146+ func updatePartitionAnalyticsTierCase (testName string ) string {
147+ return fmt .Sprintf (`
148+ resource "sumologic_partition" "foo" {
149+ name = "terraform_acctest_%s"
150+ routing_expression = "_sourcecategory=*/Terraform"
151+ retention_period = 366
152+ is_compliant = false
153+ analytics_tier = "ContinuouS" // Changed case for "continuous"
154+ }
155+ ` , testName )
156+ }
0 commit comments