@@ -490,6 +490,50 @@ func TestAccEMRServerlessApplication_schedulerConfiguration(t *testing.T) {
490
490
resource .TestCheckResourceAttr (resourceName , "scheduler_configuration.#" , "0" ),
491
491
),
492
492
},
493
+ {
494
+ // If both arguments are omitted and an empty block is specified for scheduler_config, defaults of 15 and 360 are used
495
+ Config : testAccApplicationConfig_schedulerConfigurationEmptyBlock (rName ),
496
+ Check : resource .ComposeTestCheckFunc (
497
+ testAccCheckApplicationExists (ctx , t , resourceName , & application ),
498
+ resource .TestCheckResourceAttr (resourceName , "scheduler_configuration.#" , "1" ),
499
+ resource .TestCheckResourceAttr (resourceName , "scheduler_configuration.0.max_concurrent_runs" , "15" ),
500
+ resource .TestCheckResourceAttr (resourceName , "scheduler_configuration.0.queue_timeout_minutes" , "360" ),
501
+ ),
502
+ },
503
+ {
504
+ Config : testAccApplicationConfig_basic (rName , "emr-7.1.0" ),
505
+ Check : resource .ComposeTestCheckFunc (
506
+ testAccCheckApplicationExists (ctx , t , resourceName , & application ),
507
+ resource .TestCheckResourceAttr (resourceName , "scheduler_configuration.#" , "0" ),
508
+ ),
509
+ },
510
+ {
511
+ // If queue_timeout_minutes is omitted, default of 360 is used
512
+ Config : testAccApplicationConfig_schedulerConfigurationMaxConcurrentRuns (rName , 30 ),
513
+ Check : resource .ComposeTestCheckFunc (
514
+ testAccCheckApplicationExists (ctx , t , resourceName , & application ),
515
+ resource .TestCheckResourceAttr (resourceName , "scheduler_configuration.#" , "1" ),
516
+ resource .TestCheckResourceAttr (resourceName , "scheduler_configuration.0.max_concurrent_runs" , "30" ),
517
+ resource .TestCheckResourceAttr (resourceName , "scheduler_configuration.0.queue_timeout_minutes" , "360" ),
518
+ ),
519
+ },
520
+ {
521
+ Config : testAccApplicationConfig_basic (rName , "emr-7.1.0" ),
522
+ Check : resource .ComposeTestCheckFunc (
523
+ testAccCheckApplicationExists (ctx , t , resourceName , & application ),
524
+ resource .TestCheckResourceAttr (resourceName , "scheduler_configuration.#" , "0" ),
525
+ ),
526
+ },
527
+ {
528
+ // If max_concurrent_runs is omitted, default of 15 is used
529
+ Config : testAccApplicationConfig_schedulerConfigurationQueueTimeoutMinutes (rName , 180 ),
530
+ Check : resource .ComposeTestCheckFunc (
531
+ testAccCheckApplicationExists (ctx , t , resourceName , & application ),
532
+ resource .TestCheckResourceAttr (resourceName , "scheduler_configuration.#" , "1" ),
533
+ resource .TestCheckResourceAttr (resourceName , "scheduler_configuration.0.max_concurrent_runs" , "15" ),
534
+ resource .TestCheckResourceAttr (resourceName , "scheduler_configuration.0.queue_timeout_minutes" , "180" ),
535
+ ),
536
+ },
493
537
},
494
538
})
495
539
}
@@ -869,9 +913,46 @@ resource "aws_emrserverless_application" "test" {
869
913
release_label = "emr-7.1.0"
870
914
type = "hive"
871
915
scheduler_configuration {
872
- max_concurrent_runs = %[2]d
916
+ max_concurrent_runs = %[2]d
873
917
queue_timeout_minutes = %[3]d
874
918
}
875
919
}
876
920
` , rName , maxConcurrentRuns , queueTimeoutMinutes )
877
921
}
922
+
923
+ func testAccApplicationConfig_schedulerConfigurationEmptyBlock (rName string ) string {
924
+ return fmt .Sprintf (`
925
+ resource "aws_emrserverless_application" "test" {
926
+ name = %[1]q
927
+ release_label = "emr-7.1.0"
928
+ type = "hive"
929
+ scheduler_configuration {}
930
+ }
931
+ ` , rName )
932
+ }
933
+
934
+ func testAccApplicationConfig_schedulerConfigurationMaxConcurrentRuns (rName string , maxConcurrentRuns int ) string {
935
+ return fmt .Sprintf (`
936
+ resource "aws_emrserverless_application" "test" {
937
+ name = %[1]q
938
+ release_label = "emr-7.1.0"
939
+ type = "hive"
940
+ scheduler_configuration {
941
+ max_concurrent_runs = %[2]d
942
+ }
943
+ }
944
+ ` , rName , maxConcurrentRuns )
945
+ }
946
+
947
+ func testAccApplicationConfig_schedulerConfigurationQueueTimeoutMinutes (rName string , queueTimeoutMinutes int ) string {
948
+ return fmt .Sprintf (`
949
+ resource "aws_emrserverless_application" "test" {
950
+ name = %[1]q
951
+ release_label = "emr-7.1.0"
952
+ type = "hive"
953
+ scheduler_configuration {
954
+ queue_timeout_minutes = %[2]d
955
+ }
956
+ }
957
+ ` , rName , queueTimeoutMinutes )
958
+ }
0 commit comments