@@ -19,19 +19,31 @@ func AddAdvancedConfig(ctx context.Context, tfModel *TFModel, input *admin.Clust
19
19
// special behavior using -1 when it is unset by the user
20
20
changeStreamOptionsPreAndPostImagesExpireAfterSeconds = conversion .Pointer (- 1 )
21
21
}
22
+ // When MongoDBMajorVersion is not 4.4 or lower, the API response for fail_index_key_too_long will always be null, to ensure no consistency issues, we need to match the config
23
+ failIndexKeyTooLong := inputLegacy .GetFailIndexKeyTooLong ()
24
+ if tfModel != nil {
25
+ stateConfig := tfModel .AdvancedConfiguration
26
+ stateConfigSDK := NewAtlasReqAdvancedConfigurationLegacy (ctx , & stateConfig , diags )
27
+ if diags .HasError () {
28
+ return
29
+ }
30
+ if stateConfigSDK != nil && stateConfigSDK .GetFailIndexKeyTooLong () != failIndexKeyTooLong {
31
+ failIndexKeyTooLong = stateConfigSDK .GetFailIndexKeyTooLong ()
32
+ }
33
+ }
22
34
advancedConfig = TFAdvancedConfigurationModel {
23
35
ChangeStreamOptionsPreAndPostImagesExpireAfterSeconds : types .Int64PointerValue (conversion .IntPtrToInt64Ptr (changeStreamOptionsPreAndPostImagesExpireAfterSeconds )),
24
- DefaultWriteConcern : types .StringPointerValue ( input .DefaultWriteConcern ),
25
- DefaultReadConcern : types .StringPointerValue ( inputLegacy .DefaultReadConcern ),
26
- FailIndexKeyTooLong : types .BoolPointerValue ( inputLegacy . FailIndexKeyTooLong ),
27
- JavascriptEnabled : types .BoolPointerValue ( input .JavascriptEnabled ),
28
- MinimumEnabledTlsProtocol : types .StringPointerValue ( input .MinimumEnabledTlsProtocol ),
29
- NoTableScan : types .BoolPointerValue ( input .NoTableScan ),
30
- OplogMinRetentionHours : types .Float64PointerValue ( input .OplogMinRetentionHours ),
31
- OplogSizeMb : types .Int64PointerValue (conversion .IntPtrToInt64Ptr (input .OplogSizeMB )),
32
- SampleSizeBiconnector : types .Int64PointerValue (conversion .IntPtrToInt64Ptr (input .SampleSizeBIConnector )),
33
- SampleRefreshIntervalBiconnector : types .Int64PointerValue (conversion .IntPtrToInt64Ptr (input .SampleRefreshIntervalBIConnector )),
34
- TransactionLifetimeLimitSeconds : types .Int64PointerValue ( input .TransactionLifetimeLimitSeconds ),
36
+ DefaultWriteConcern : types .StringValue ( conversion . SafeValue ( input .DefaultWriteConcern ) ),
37
+ DefaultReadConcern : types .StringValue ( conversion . SafeValue ( inputLegacy .DefaultReadConcern ) ),
38
+ FailIndexKeyTooLong : types .BoolValue ( failIndexKeyTooLong ),
39
+ JavascriptEnabled : types .BoolValue ( conversion . SafeValue ( input .JavascriptEnabled ) ),
40
+ MinimumEnabledTlsProtocol : types .StringValue ( conversion . SafeValue ( input .MinimumEnabledTlsProtocol ) ),
41
+ NoTableScan : types .BoolValue ( conversion . SafeValue ( input .NoTableScan ) ),
42
+ OplogMinRetentionHours : types .Float64Value ( conversion . SafeValue ( input .OplogMinRetentionHours ) ),
43
+ OplogSizeMb : types .Int64Value (conversion .SafeValue ( conversion . IntPtrToInt64Ptr (input .OplogSizeMB ) )),
44
+ SampleSizeBiconnector : types .Int64Value (conversion .SafeValue ( conversion . IntPtrToInt64Ptr (input .SampleSizeBIConnector ) )),
45
+ SampleRefreshIntervalBiconnector : types .Int64Value (conversion .SafeValue ( conversion . IntPtrToInt64Ptr (input .SampleRefreshIntervalBIConnector ) )),
46
+ TransactionLifetimeLimitSeconds : types .Int64Value ( conversion . SafeValue ( input .TransactionLifetimeLimitSeconds ) ),
35
47
}
36
48
}
37
49
objType , diagsLocal := types .ObjectValueFrom (ctx , AdvancedConfigurationObjType .AttrTypes , advancedConfig )
0 commit comments