Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ func TestAccClusterAdvancedCluster_pausedToUnpaused(t *testing.T) {
}

func TestAccClusterAdvancedCluster_advancedConfig_oldMongoDBVersion(t *testing.T) {
acc.SkipIfAdvancedClusterV2Schema(t) // TODO: default_max_time_ms not implemented in TPF yet
var (
projectID = acc.ProjectIDExecution(t)
clusterName = acc.RandomClusterName()
Expand Down Expand Up @@ -372,7 +371,6 @@ func TestAccClusterAdvancedCluster_advancedConfig_oldMongoDBVersion(t *testing.T
}

func TestAccClusterAdvancedCluster_advancedConfig(t *testing.T) {
acc.SkipIfAdvancedClusterV2Schema(t) // TODO: default_max_time_ms not implemented in TPF yet
var (
projectID = acc.ProjectIDExecution(t)
clusterName = acc.RandomClusterName()
Expand Down Expand Up @@ -441,7 +439,6 @@ func TestAccClusterAdvancedCluster_advancedConfig(t *testing.T) {
}

func TestAccClusterAdvancedCluster_defaultWrite(t *testing.T) {
acc.SkipIfAdvancedClusterV2Schema(t) // TODO: tls_cipher_config_mode not implemented in TPF yet
var (
projectID = acc.ProjectIDExecution(t)
clusterName = acc.RandomClusterName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package advancedclustertpf
import (
"context"

admin20240530 "go.mongodb.org/atlas-sdk/v20240530005/admin"
"go.mongodb.org/atlas-sdk/v20241113004/admin"

"github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-framework/types"

"github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion"
admin20240530 "go.mongodb.org/atlas-sdk/v20240530005/admin"
"go.mongodb.org/atlas-sdk/v20241113004/admin"
)

func AddAdvancedConfig(ctx context.Context, tfModel *TFModel, input *admin.ClusterDescriptionProcessArgs20240805, inputLegacy *admin20240530.ClusterDescriptionProcessArgs, diags *diag.Diagnostics) {
Expand Down Expand Up @@ -44,8 +46,15 @@ func AddAdvancedConfig(ctx context.Context, tfModel *TFModel, input *admin.Clust
SampleSizeBiconnector: types.Int64Value(conversion.SafeValue(conversion.IntPtrToInt64Ptr(input.SampleSizeBIConnector))),
SampleRefreshIntervalBiconnector: types.Int64Value(conversion.SafeValue(conversion.IntPtrToInt64Ptr(input.SampleRefreshIntervalBIConnector))),
TransactionLifetimeLimitSeconds: types.Int64Value(conversion.SafeValue(input.TransactionLifetimeLimitSeconds)),
DefaultMaxTimeMS: types.Int64Value(conversion.SafeValue(conversion.IntPtrToInt64Ptr(input.DefaultMaxTimeMS))),
TlsCipherConfigMode: types.StringValue(conversion.SafeValue(input.TlsCipherConfigMode)),
}

customOpensslCipherConfigTLS12, d := types.SetValueFrom(ctx, types.StringType, input.CustomOpensslCipherConfigTls12)
diags.Append(d...)
advancedConfig.CustomOpensslCipherConfigTls12 = customOpensslCipherConfigTLS12
}

objType, diagsLocal := types.ObjectValueFrom(ctx, AdvancedConfigurationObjType.AttrTypes, advancedConfig)
diags.Append(diagsLocal...)
tfModel.AdvancedConfiguration = objType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package advancedclustertpf
import (
"context"

"go.mongodb.org/atlas-sdk/v20241113004/admin"

"github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"

"github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion"
"go.mongodb.org/atlas-sdk/v20241113004/admin"
)

func NewAtlasReqAdvancedConfiguration(ctx context.Context, objInput *types.Object, diags *diag.Diagnostics) *admin.ClusterDescriptionProcessArgs20240805 {
Expand All @@ -31,5 +33,8 @@ func NewAtlasReqAdvancedConfiguration(ctx context.Context, objInput *types.Objec
SampleRefreshIntervalBIConnector: conversion.NilForUnknown(input.SampleRefreshIntervalBiconnector, conversion.Int64PtrToIntPtr(input.SampleRefreshIntervalBiconnector.ValueInt64Pointer())),
SampleSizeBIConnector: conversion.NilForUnknown(input.SampleSizeBiconnector, conversion.Int64PtrToIntPtr(input.SampleSizeBiconnector.ValueInt64Pointer())),
TransactionLifetimeLimitSeconds: conversion.NilForUnknown(input.TransactionLifetimeLimitSeconds, input.TransactionLifetimeLimitSeconds.ValueInt64Pointer()),
DefaultMaxTimeMS: conversion.NilForUnknown(input.DefaultMaxTimeMS, conversion.Int64PtrToIntPtr(input.DefaultMaxTimeMS.ValueInt64Pointer())),
TlsCipherConfigMode: conversion.NilForUnknown(input.TlsCipherConfigMode, input.TlsCipherConfigMode.ValueStringPointer()),
CustomOpensslCipherConfigTls12: conversion.Pointer(conversion.TypesSetToString(ctx, input.CustomOpensslCipherConfigTls12)),
}
}
28 changes: 26 additions & 2 deletions internal/service/advancedclustertpf/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"

"github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion"
"github.com/mongodb/terraform-provider-mongodbatlas/internal/common/schemafunc"
)
Expand Down Expand Up @@ -528,6 +529,23 @@ func AdvancedConfigurationSchema(ctx context.Context) schema.SingleNestedAttribu
Optional: true,
MarkdownDescription: "fail_index_key_too_long", // TODO: add description
},
"default_max_time_ms": schema.Int64Attribute{
Optional: true,
MarkdownDescription: "Default time limit in milliseconds for individual read operations to complete. This parameter is supported only for MongoDB version 8.0 and above.",
PlanModifiers: []planmodifier.Int64{
PlanMustUseMongoDBVersion(8.0, EqualOrHigher),
},
},
"custom_openssl_cipher_config_tls12": schema.SetAttribute{
Optional: true,
ElementType: types.StringType,
MarkdownDescription: "The custom OpenSSL cipher suite list for TLS 1.2. This field is only valid when `tls_cipher_config_mode` is set to `CUSTOM`.",
},
"tls_cipher_config_mode": schema.StringAttribute{
Optional: true,
Computed: true,
MarkdownDescription: "The TLS cipher suite configuration mode. Valid values include `CUSTOM` or `DEFAULT`. The `DEFAULT` mode uses the default cipher suites. The `CUSTOM` mode allows you to specify custom cipher suites for both TLS 1.2 and TLS 1.3. To unset, this should be set back to `DEFAULT`.",
},
},
}
}
Expand Down Expand Up @@ -759,14 +777,17 @@ var TagsObjType = types.ObjectType{AttrTypes: map[string]attr.Type{

type TFAdvancedConfigurationModel struct {
OplogMinRetentionHours types.Float64 `tfsdk:"oplog_min_retention_hours"`
CustomOpensslCipherConfigTls12 types.Set `tfsdk:"custom_openssl_cipher_config_tls12"`
MinimumEnabledTlsProtocol types.String `tfsdk:"minimum_enabled_tls_protocol"`
DefaultWriteConcern types.String `tfsdk:"default_write_concern"`
DefaultReadConcern types.String `tfsdk:"default_read_concern"`
ChangeStreamOptionsPreAndPostImagesExpireAfterSeconds types.Int64 `tfsdk:"change_stream_options_pre_and_post_images_expire_after_seconds"`
OplogSizeMb types.Int64 `tfsdk:"oplog_size_mb"`
TlsCipherConfigMode types.String `tfsdk:"tls_cipher_config_mode"`
SampleRefreshIntervalBiconnector types.Int64 `tfsdk:"sample_refresh_interval_bi_connector"`
SampleSizeBiconnector types.Int64 `tfsdk:"sample_size_bi_connector"`
TransactionLifetimeLimitSeconds types.Int64 `tfsdk:"transaction_lifetime_limit_seconds"`
DefaultMaxTimeMS types.Int64 `tfsdk:"default_max_time_ms"`
OplogSizeMb types.Int64 `tfsdk:"oplog_size_mb"`
ChangeStreamOptionsPreAndPostImagesExpireAfterSeconds types.Int64 `tfsdk:"change_stream_options_pre_and_post_images_expire_after_seconds"`
JavascriptEnabled types.Bool `tfsdk:"javascript_enabled"`
NoTableScan types.Bool `tfsdk:"no_table_scan"`
FailIndexKeyTooLong types.Bool `tfsdk:"fail_index_key_too_long"`
Expand All @@ -785,6 +806,9 @@ var AdvancedConfigurationObjType = types.ObjectType{AttrTypes: map[string]attr.T
"sample_refresh_interval_bi_connector": types.Int64Type,
"sample_size_bi_connector": types.Int64Type,
"transaction_lifetime_limit_seconds": types.Int64Type,
"default_max_time_ms": types.Int64Type,
"tls_cipher_config_mode": types.StringType,
"custom_openssl_cipher_config_tls12": types.SetType{ElemType: types.StringType},
}}

type TFPinnedFCVModel struct {
Expand Down
Loading