@@ -127,6 +127,14 @@ func TestAccResourceILMRolloverConditions(t *testing.T) {
127127 CheckDestroy : checkResourceILMDestroy ,
128128 ProtoV6ProviderFactories : acctest .Providers ,
129129 Steps : []resource.TestStep {
130+ {
131+ SkipFunc : versionutils .CheckIfVersionIsUnsupported (index .MaxPrimaryShardDocsMinSupportedVersion ),
132+ Config : testAccResourceILMCreateWithMaxPrimaryShardDocs (policyName ),
133+ Check : resource .ComposeTestCheckFunc (
134+ resource .TestCheckResourceAttr ("elasticstack_elasticsearch_index_lifecycle.test_rollover" , "name" , policyName ),
135+ resource .TestCheckResourceAttr ("elasticstack_elasticsearch_index_lifecycle.test_rollover" , "hot.0.rollover.0.max_primary_shard_docs" , "5000" ),
136+ ),
137+ },
130138 {
131139 SkipFunc : versionutils .CheckIfVersionIsUnsupported (index .RolloverMinConditionsMinSupportedVersion ),
132140 Config : testAccResourceILMCreateWithRolloverConditions (policyName ),
@@ -135,7 +143,7 @@ func TestAccResourceILMRolloverConditions(t *testing.T) {
135143 resource .TestCheckResourceAttr ("elasticstack_elasticsearch_index_lifecycle.test_rollover" , "hot.0.rollover.0.max_age" , "7d" ),
136144 resource .TestCheckResourceAttr ("elasticstack_elasticsearch_index_lifecycle.test_rollover" , "hot.0.rollover.0.max_docs" , "10000" ),
137145 resource .TestCheckResourceAttr ("elasticstack_elasticsearch_index_lifecycle.test_rollover" , "hot.0.rollover.0.max_size" , "100gb" ),
138- resource .TestCheckResourceAttr ("elasticstack_elasticsearch_index_lifecycle.test_rollover" , "hot.0.rollover.0.min_primary_shard_docs " , "5000" ),
146+ resource .TestCheckResourceAttr ("elasticstack_elasticsearch_index_lifecycle.test_rollover" , "hot.0.rollover.0.max_primary_shard_docs " , "5000" ),
139147 resource .TestCheckResourceAttr ("elasticstack_elasticsearch_index_lifecycle.test_rollover" , "hot.0.rollover.0.max_primary_shard_size" , "50gb" ),
140148 resource .TestCheckResourceAttr ("elasticstack_elasticsearch_index_lifecycle.test_rollover" , "hot.0.rollover.0.min_age" , "3d" ),
141149 resource .TestCheckResourceAttr ("elasticstack_elasticsearch_index_lifecycle.test_rollover" , "hot.0.rollover.0.min_docs" , "1000" ),
@@ -293,6 +301,30 @@ resource "elasticstack_elasticsearch_index_lifecycle" "test_rollover" {
293301 ` , name )
294302}
295303
304+ func testAccResourceILMCreateWithMaxPrimaryShardDocs (name string ) string {
305+ return fmt .Sprintf (`
306+ provider "elasticstack" {
307+ elasticsearch {}
308+ }
309+
310+ resource "elasticstack_elasticsearch_index_lifecycle" "test_rollover" {
311+ name = "%s"
312+
313+ hot {
314+ rollover {
315+ max_primary_shard_docs = 5000
316+ }
317+
318+ readonly {}
319+ }
320+
321+ delete {
322+ delete {}
323+ }
324+ }
325+ ` , name )
326+ }
327+
296328func testAccResourceILMDownsampleNoTimeout (name string ) string {
297329 return fmt .Sprintf (`
298330provider "elasticstack" {
0 commit comments