@@ -287,9 +287,7 @@ func TestAccClusterAdvancedCluster_pausedToUnpaused(t *testing.T) {
287287func TestAccClusterAdvancedCluster_advancedConfig_oldMongoDBVersion (t * testing.T ) {
288288 var (
289289 projectID , clusterName = acc .ProjectIDExecutionWithCluster (t , 4 )
290- processArgs = & admin.ClusterDescriptionProcessArgs20240805 {
291- ChangeStreamOptionsPreAndPostImagesExpireAfterSeconds : conversion .IntPtr (- 1 ), // this will not be set in the TF configuration
292- DefaultMaxTimeMS : conversion .IntPtr (65 ),
290+ processArgsCommon = & admin.ClusterDescriptionProcessArgs20240805 {
293291 DefaultWriteConcern : conversion .StringPtr ("1" ),
294292 JavascriptEnabled : conversion .Pointer (true ),
295293 MinimumEnabledTlsProtocol : conversion .StringPtr ("TLS1_2" ),
@@ -299,24 +297,26 @@ func TestAccClusterAdvancedCluster_advancedConfig_oldMongoDBVersion(t *testing.T
299297 SampleSizeBIConnector : conversion .Pointer (110 ),
300298 TransactionLifetimeLimitSeconds : conversion.Pointer [int64 ](300 ),
301299 }
302- processArgsCipherConfig = & admin.ClusterDescriptionProcessArgs20240805 {
303- TlsCipherConfigMode : conversion .StringPtr ("CUSTOM" ),
304- CustomOpensslCipherConfigTls12 : & []string {"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" , "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" },
305- }
306300 )
301+ processArgs := * processArgsCommon
302+ processArgs .DefaultMaxTimeMS = conversion .IntPtr (65 )
303+
304+ processArgsCipherConfig := * processArgsCommon
305+ processArgsCipherConfig .TlsCipherConfigMode = conversion .StringPtr ("CUSTOM" )
306+ processArgsCipherConfig .CustomOpensslCipherConfigTls12 = & []string {"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" , "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" }
307307
308308 resource .ParallelTest (t , resource.TestCase {
309309 PreCheck : acc .PreCheckBasicSleep (t , nil , projectID , clusterName ),
310310 ProtoV6ProviderFactories : acc .TestAccProviderV6Factories ,
311311 CheckDestroy : acc .CheckDestroyCluster ,
312312 Steps : []resource.TestStep {
313313 {
314- Config : configAdvanced (t , projectID , clusterName , "7.0" , processArgs ),
314+ Config : configAdvanced (t , projectID , clusterName , "7.0" , & processArgs ),
315315 ExpectError : regexp .MustCompile (errDefaultMaxTimeMinVersion ),
316316 },
317317 {
318- Config : configAdvanced (t , projectID , clusterName , "7.0" , processArgsCipherConfig ),
319- Check : checkAdvanced (clusterName , "TLS1_2" , processArgsCipherConfig ),
318+ Config : configAdvanced (t , projectID , clusterName , "7.0" , & processArgsCipherConfig ),
319+ Check : checkAdvanced (clusterName , "TLS1_2" , & processArgsCipherConfig ),
320320 },
321321 acc .TestStepImportCluster (resourceName ),
322322 },
@@ -1108,7 +1108,7 @@ func TestAccAdvancedCluster_createTimeoutWithDeleteOnCreateReplicaset(t *testing
11081108 Timeout : 60 * time .Second ,
11091109 IsDelete : true ,
11101110 }, "waiting for cluster to be deleted after cleanup in create timeout" , diags )
1111- time .Sleep (1 * time .Minute ) // decrease the chance of `CONTAINER_WAITING_FOR_FAST_RECORD_CLEAN_UP`: "A transient error occurred. Please try again in a minute or use a different name"
1111+ time .Sleep (2 * time .Minute ) // decrease the chance of `CONTAINER_WAITING_FOR_FAST_RECORD_CLEAN_UP`: "A transient error occurred. Please try again in a minute or use a different name"
11121112 }
11131113 )
11141114 resource .ParallelTest (t , * createCleanupTest (t , configCall , waitOnClusterDeleteDone , true ))
@@ -1895,40 +1895,51 @@ func checkSingleProviderPaused(name string, paused bool) resource.TestCheckFunc
18951895
18961896func configAdvanced (t * testing.T , projectID , clusterName , mongoDBMajorVersion string , p * admin.ClusterDescriptionProcessArgs20240805 ) string {
18971897 t .Helper ()
1898- changeStreamOptionsStr := ""
1899- defaultMaxTimeStr := ""
1900- tlsCipherConfigModeStr := ""
1901- customOpensslCipherConfigTLS12Str := ""
1898+ advancedConfig := ""
19021899 mongoDBMajorVersionStr := ""
1903-
1904- if p != nil {
1905- if p .ChangeStreamOptionsPreAndPostImagesExpireAfterSeconds != nil && p .ChangeStreamOptionsPreAndPostImagesExpireAfterSeconds != conversion .IntPtr (- 1 ) {
1906- changeStreamOptionsStr = fmt .Sprintf (`change_stream_options_pre_and_post_images_expire_after_seconds = %[1]d` , * p .ChangeStreamOptionsPreAndPostImagesExpireAfterSeconds )
1907- }
1908- if p .DefaultMaxTimeMS != nil {
1909- defaultMaxTimeStr = fmt .Sprintf (`default_max_time_ms = %[1]d` , * p .DefaultMaxTimeMS )
1910- }
1911- if p .TlsCipherConfigMode != nil {
1912- tlsCipherConfigModeStr = fmt .Sprintf (`tls_cipher_config_mode = %[1]q` , * p .TlsCipherConfigMode )
1913- if p .CustomOpensslCipherConfigTls12 != nil && len (* p .CustomOpensslCipherConfigTls12 ) > 0 {
1914- customOpensslCipherConfigTLS12Str = fmt .Sprintf (
1915- `custom_openssl_cipher_config_tls12 = [%s]` ,
1916- acc .JoinQuotedStrings (* p .CustomOpensslCipherConfigTls12 ),
1917- )
1918- }
1900+ if mongoDBMajorVersion != "" {
1901+ mongoDBMajorVersionStr = fmt .Sprintf ("mongo_db_major_version = %[1]q\n " , mongoDBMajorVersion )
1902+ }
1903+ if p .JavascriptEnabled != nil {
1904+ advancedConfig += fmt .Sprintf ("javascript_enabled = %[1]t\n " , * p .JavascriptEnabled )
1905+ }
1906+ if p .NoTableScan != nil {
1907+ advancedConfig += fmt .Sprintf ("no_table_scan = %[1]t\n " , * p .NoTableScan )
1908+ }
1909+ if p .OplogSizeMB != nil {
1910+ advancedConfig += fmt .Sprintf ("oplog_size_mb = %[1]d\n " , * p .OplogSizeMB )
1911+ }
1912+ if p .SampleRefreshIntervalBIConnector != nil {
1913+ advancedConfig += fmt .Sprintf ("sample_refresh_interval_bi_connector = %[1]d\n " , * p .SampleRefreshIntervalBIConnector )
1914+ }
1915+ if p .SampleSizeBIConnector != nil {
1916+ advancedConfig += fmt .Sprintf ("sample_size_bi_connector = %[1]d\n " , * p .SampleSizeBIConnector )
1917+ }
1918+ if p .TransactionLifetimeLimitSeconds != nil {
1919+ advancedConfig += fmt .Sprintf ("transaction_lifetime_limit_seconds = %[1]d\n " , * p .TransactionLifetimeLimitSeconds )
1920+ }
1921+ if p .ChangeStreamOptionsPreAndPostImagesExpireAfterSeconds != nil && * p .ChangeStreamOptionsPreAndPostImagesExpireAfterSeconds != - 1 {
1922+ advancedConfig += fmt .Sprintf ("change_stream_options_pre_and_post_images_expire_after_seconds = %[1]d\n " , * p .ChangeStreamOptionsPreAndPostImagesExpireAfterSeconds )
1923+ }
1924+ if p .DefaultMaxTimeMS != nil {
1925+ advancedConfig += fmt .Sprintf ("default_max_time_ms = %[1]d\n " , * p .DefaultMaxTimeMS )
1926+ }
1927+ if p .TlsCipherConfigMode != nil {
1928+ advancedConfig += fmt .Sprintf ("tls_cipher_config_mode = %[1]q\n " , * p .TlsCipherConfigMode )
1929+ if p .CustomOpensslCipherConfigTls12 != nil && len (* p .CustomOpensslCipherConfigTls12 ) > 0 {
1930+ advancedConfig += fmt .Sprintf ("custom_openssl_cipher_config_tls12 = [%s]\n " , acc .JoinQuotedStrings (* p .CustomOpensslCipherConfigTls12 ))
19191931 }
19201932 }
1921- if mongoDBMajorVersion != "" {
1922- mongoDBMajorVersionStr = fmt .Sprintf (`mongo_db_major_version = %[1]q` , mongoDBMajorVersion )
1933+ if p . MinimumEnabledTlsProtocol != nil {
1934+ advancedConfig + = fmt .Sprintf ("minimum_enabled_tls_protocol = %[1]q\n " , * p . MinimumEnabledTlsProtocol )
19231935 }
19241936
19251937 return fmt .Sprintf (`
19261938 resource "mongodbatlas_advanced_cluster" "test" {
19271939 project_id = %[1]q
19281940 name = %[2]q
19291941 cluster_type = "REPLICASET"
1930- %[12]s
1931-
1942+ %[3]s
19321943 replication_specs = [{
19331944 region_configs = [{
19341945 electable_specs = {
@@ -1946,22 +1957,10 @@ func configAdvanced(t *testing.T, projectID, clusterName, mongoDBMajorVersion st
19461957 }]
19471958
19481959 advanced_configuration = {
1949- javascript_enabled = %[3]t
1950- minimum_enabled_tls_protocol = %[4]q
1951- no_table_scan = %[5]t
1952- oplog_size_mb = %[6]d
1953- sample_size_bi_connector = %[7]d
1954- sample_refresh_interval_bi_connector = %[8]d
1955- transaction_lifetime_limit_seconds = %[9]d
1956- %[10]s
1957- %[11]s
1958- %[13]s
1959- %[14]s
1960+ %[4]s
19601961 }
19611962 }
1962- ` , projectID , clusterName , p .GetJavascriptEnabled (), p .GetMinimumEnabledTlsProtocol (), p .GetNoTableScan (),
1963- p .GetOplogSizeMB (), p .GetSampleSizeBIConnector (), p .GetSampleRefreshIntervalBIConnector (), p .GetTransactionLifetimeLimitSeconds (),
1964- changeStreamOptionsStr , defaultMaxTimeStr , mongoDBMajorVersionStr , tlsCipherConfigModeStr , customOpensslCipherConfigTLS12Str ) + dataSourcesConfig
1963+ ` , projectID , clusterName , mongoDBMajorVersionStr , advancedConfig ) + dataSourcesConfig
19651964}
19661965
19671966func checkAdvanced (name , tls string , processArgs * admin.ClusterDescriptionProcessArgs20240805 ) resource.TestCheckFunc {
@@ -2689,13 +2688,13 @@ func configPriority(t *testing.T, projectID, clusterName string, swapPriorities
26892688
26902689func configBiConnectorConfig (t * testing.T , projectID , name string , enabled bool ) string {
26912690 t .Helper ()
2692- additionalConfig := `
2691+ advancedConfig := `
26932692 bi_connector_config = {
26942693 enabled = false
26952694 }
26962695 `
26972696 if enabled {
2698- additionalConfig = `
2697+ advancedConfig = `
26992698 bi_connector_config = {
27002699 enabled = true
27012700 read_preference = "secondary"
@@ -2727,7 +2726,7 @@ func configBiConnectorConfig(t *testing.T, projectID, name string, enabled bool)
27272726
27282727 %[3]s
27292728 }
2730- ` , projectID , name , additionalConfig ) + dataSourcesConfig
2729+ ` , projectID , name , advancedConfig ) + dataSourcesConfig
27312730}
27322731
27332732func checkTenantBiConnectorConfig (projectID , name string , enabled bool ) resource.TestCheckFunc {
0 commit comments