@@ -58,7 +58,7 @@ func TestAccCloudflareBotManagement_SBFM(t *testing.T) {
58
58
59
59
func TestAccCloudflareBotManagement_Unentitled (t * testing.T ) {
60
60
t .Skip ("Test expects entitlement error but test zone entitlements allow the configuration" )
61
-
61
+
62
62
rnd := utils .GenerateRandomResourceName ()
63
63
zoneID := os .Getenv ("CLOUDFLARE_ZONE_ID" )
64
64
@@ -108,7 +108,7 @@ func TestAccCloudflareBotManagement_EnableJS(t *testing.T) {
108
108
ImportStateVerify : true ,
109
109
ImportStateVerifyIgnore : []string {
110
110
"ai_bots_protection" ,
111
- "crawler_protection" ,
111
+ "crawler_protection" ,
112
112
"stale_zone_configuration" ,
113
113
},
114
114
},
@@ -144,7 +144,7 @@ func TestAccCloudflareBotManagement_SuppressSessionScore(t *testing.T) {
144
144
ImportStateVerify : true ,
145
145
ImportStateVerifyIgnore : []string {
146
146
"ai_bots_protection" ,
147
- "crawler_protection" ,
147
+ "crawler_protection" ,
148
148
"stale_zone_configuration" ,
149
149
},
150
150
},
@@ -200,29 +200,6 @@ func TestAccCloudflareBotManagement_AIBotsProtection(t *testing.T) {
200
200
})
201
201
}
202
202
203
- func testCloudflareBotManagementSBFM (resourceName , rnd string , bm cloudflare.BotManagement ) string {
204
- return acctest .LoadTestCase ("cloudflarebotmanagementsbfm.tf" , resourceName , rnd ,
205
- * bm .EnableJS , * bm .SBFMDefinitelyAutomated ,
206
- * bm .SBFMLikelyAutomated , * bm .SBFMVerifiedBots ,
207
- * bm .SBFMStaticResourceProtection , * bm .OptimizeWordpress )
208
- }
209
-
210
- func testCloudflareBotManagementEntSubscription (resourceName , zoneID string , bm cloudflare.BotManagement ) string {
211
- return acctest .LoadTestCase ("cloudflarebotmanagemententsubscription.tf" , resourceName , zoneID , * bm .EnableJS , * bm .SuppressSessionScore , false )
212
- }
213
-
214
- func testCloudflareBotManagementEnableJS (resourceName , zoneID string , enableJS bool ) string {
215
- return acctest .LoadTestCase ("cloudflarebotmanagementenablejs.tf" , resourceName , zoneID , enableJS )
216
- }
217
-
218
- func testCloudflareBotManagementSuppressSessionScore (resourceName , zoneID string , suppressSessionScore bool ) string {
219
- return acctest .LoadTestCase ("cloudflarebotmanagementsuppresssessionscore.tf" , resourceName , zoneID , suppressSessionScore )
220
- }
221
-
222
- func testCloudflareBotManagementAutoUpdateModel (resourceName , zoneID string , autoUpdateModel bool ) string {
223
- return acctest .LoadTestCase ("cloudflarebotmanagementautoupdatemodel.tf" , resourceName , zoneID , autoUpdateModel )
224
- }
225
-
226
203
func TestAccCloudflareBotManagement_StateConsistency (t * testing.T ) {
227
204
rnd := utils .GenerateRandomResourceName ()
228
205
resourceName := "cloudflare_bot_management." + rnd
@@ -260,7 +237,7 @@ func TestAccCloudflareBotManagement_StateConsistency(t *testing.T) {
260
237
ImportStateVerify : true ,
261
238
ImportStateVerifyIgnore : []string {
262
239
"ai_bots_protection" ,
263
- "crawler_protection" ,
240
+ "crawler_protection" ,
264
241
"stale_zone_configuration" ,
265
242
},
266
243
},
@@ -601,6 +578,59 @@ func TestAccCloudflareBotManagement_ComputedFields(t *testing.T) {
601
578
})
602
579
}
603
580
581
+ func TestAccCloudflareBotManagement_EnableJSAutoUpdateSuppression (t * testing.T ) {
582
+ rnd := utils .GenerateRandomResourceName ()
583
+ resourceName := "cloudflare_bot_management." + rnd
584
+ zoneID := os .Getenv ("CLOUDFLARE_ZONE_ID" )
585
+
586
+ resource .Test (t , resource.TestCase {
587
+ PreCheck : func () { acctest .TestAccPreCheck (t ) },
588
+ ProtoV6ProviderFactories : acctest .TestAccProtoV6ProviderFactories ,
589
+ Steps : []resource.TestStep {
590
+ {
591
+ Config : testCloudflareBotManagementEnableJSAutoUpdateSupression (rnd , zoneID ),
592
+ ConfigStateChecks : []statecheck.StateCheck {
593
+ statecheck .ExpectKnownValue (resourceName , tfjsonpath .New (consts .ZoneIDSchemaKey ), knownvalue .StringExact (zoneID )),
594
+ statecheck .ExpectKnownValue (resourceName , tfjsonpath .New ("enable_js" ), knownvalue .Bool (false )),
595
+ },
596
+ ConfigPlanChecks : resource.ConfigPlanChecks {
597
+ PreApply : []plancheck.PlanCheck {
598
+ plancheck .ExpectResourceAction (resourceName , plancheck .ResourceActionCreate ),
599
+ plancheck .ExpectKnownValue (
600
+ resourceName ,
601
+ tfjsonpath .New ("enable_js" ),
602
+ knownvalue .Bool (false ),
603
+ ),
604
+ plancheck .ExpectKnownValue (
605
+ resourceName ,
606
+ tfjsonpath .New ("auto_update_model" ),
607
+ knownvalue .Bool (true ),
608
+ ),
609
+ plancheck .ExpectKnownValue (
610
+ resourceName ,
611
+ tfjsonpath .New ("suppress_session_score" ),
612
+ knownvalue .Bool (false ),
613
+ ),
614
+ },
615
+ PostApplyPostRefresh : []plancheck.PlanCheck {
616
+ plancheck .ExpectEmptyPlan (),
617
+ },
618
+ },
619
+ },
620
+ {
621
+ ResourceName : resourceName ,
622
+ ImportState : true ,
623
+ ImportStateVerify : true ,
624
+ ImportStateVerifyIgnore : []string {
625
+ "ai_bots_protection" ,
626
+ "crawler_protection" ,
627
+ "stale_zone_configuration" ,
628
+ },
629
+ },
630
+ },
631
+ })
632
+ }
633
+
604
634
func testCloudflareBotManagementAIBotsProtection (resourceName , zoneID string , aiBotsProtection string ) string {
605
635
return acctest .LoadTestCase ("cloudflarebotmanagementaibotsprotection.tf" , resourceName , zoneID , aiBotsProtection )
606
636
}
@@ -664,3 +694,30 @@ func testCloudflareBotManagementIssue5519NullFields(resourceName, zoneID string)
664
694
func testCloudflareBotManagementIssue5519Reproduce (resourceName , zoneID string ) string {
665
695
return acctest .LoadTestCase ("cloudflarebotmanagementissue5519reproduce.tf" , resourceName , zoneID )
666
696
}
697
+
698
+ func testCloudflareBotManagementSBFM (resourceName , rnd string , bm cloudflare.BotManagement ) string {
699
+ return acctest .LoadTestCase ("cloudflarebotmanagementsbfm.tf" , resourceName , rnd ,
700
+ * bm .EnableJS , * bm .SBFMDefinitelyAutomated ,
701
+ * bm .SBFMLikelyAutomated , * bm .SBFMVerifiedBots ,
702
+ * bm .SBFMStaticResourceProtection , * bm .OptimizeWordpress )
703
+ }
704
+
705
+ func testCloudflareBotManagementEntSubscription (resourceName , zoneID string , bm cloudflare.BotManagement ) string {
706
+ return acctest .LoadTestCase ("cloudflarebotmanagemententsubscription.tf" , resourceName , zoneID , * bm .EnableJS , * bm .SuppressSessionScore , false )
707
+ }
708
+
709
+ func testCloudflareBotManagementEnableJS (resourceName , zoneID string , enableJS bool ) string {
710
+ return acctest .LoadTestCase ("cloudflarebotmanagementenablejs.tf" , resourceName , zoneID , enableJS )
711
+ }
712
+
713
+ func testCloudflareBotManagementSuppressSessionScore (resourceName , zoneID string , suppressSessionScore bool ) string {
714
+ return acctest .LoadTestCase ("cloudflarebotmanagementsuppresssessionscore.tf" , resourceName , zoneID , suppressSessionScore )
715
+ }
716
+
717
+ func testCloudflareBotManagementAutoUpdateModel (resourceName , zoneID string , autoUpdateModel bool ) string {
718
+ return acctest .LoadTestCase ("cloudflarebotmanagementautoupdatemodel.tf" , resourceName , zoneID , autoUpdateModel )
719
+ }
720
+
721
+ func testCloudflareBotManagementEnableJSAutoUpdateSupression (resourceName , zoneID string ) string {
722
+ return acctest .LoadTestCase ("cloudflarebotmanagementenablejsautoupdatesupression.tf" , resourceName , zoneID )
723
+ }
0 commit comments