advancedclustertpf

package
v1.24.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2024 License: MPL-2.0 Imports: 43 Imported by: 0

README

advancedclustertpf package

This package contains the WIP for mongodbatlas_advanced_cluster in TPF. Current exposed implementation is in advancedcluster package.

Note: This file will be deleted once the update is complete and advancedcluster package will be deleted.

Changes in advancedcluster that needs to be added here

(list changes done in advancedcluster which couldn't also be done here at that moment)

  • PR #2825 Add new advanced_configuration.0.default_max_time_ms attribute to mongodbatlas_advanced_cluster resource and data sources.
  • feat: Ensures asymmetric auto-scaling is not defined in the cluster when using the old sharding configuration in mongodbatlas_advanced_cluster (https://github.com/mongodb/terraform-provider-mongodbatlas/pull/2836)
  • pinned_fcv attribute was a recently added attribute in advanced_cluster. It has been defined in the new tpf schema but we need to make sure that the implementation is also present.
  • PR #2872 Adds support for Customer Cipher Configuration for Data Plane Connections.

Documentation

Index

Constants

View Source
const (
	ErrorClusterSetting            = "error setting `%s` for MongoDB Cluster (%s): %s"
	ErrorAdvancedConfRead          = "error reading Advanced Configuration Option form MongoDB Cluster (%s): %s"
	ErrorClusterAdvancedSetting    = "error setting `%s` for MongoDB ClusterAdvanced (%s): %s"
	ErrorAdvancedClusterListStatus = "error awaiting MongoDB ClusterAdvanced List IDLE: %s"
	ErrorOperationNotPermitted     = "error operation not permitted"

	DeprecationOldSchemaAction = "" /* 206-byte string literal not displayed */

	ErrorCodeClusterNotFound = "CLUSTER_NOT_FOUND"
)

Variables

View Source
var (
	RetryMinTimeout   = 1 * time.Minute
	RetryDelay        = 30 * time.Second
	RetryPollInterval = 30 * time.Second
)
View Source
var AdvancedConfigurationObjType = types.ObjectType{AttrTypes: map[string]attr.Type{
	"change_stream_options_pre_and_post_images_expire_after_seconds": types.Int64Type,
	"default_read_concern":                 types.StringType,
	"default_write_concern":                types.StringType,
	"fail_index_key_too_long":              types.BoolType,
	"javascript_enabled":                   types.BoolType,
	"minimum_enabled_tls_protocol":         types.StringType,
	"no_table_scan":                        types.BoolType,
	"oplog_min_retention_hours":            types.Float64Type,
	"oplog_size_mb":                        types.Int64Type,
	"sample_refresh_interval_bi_connector": types.Int64Type,
	"sample_size_bi_connector":             types.Int64Type,
	"transaction_lifetime_limit_seconds":   types.Int64Type,
}}
View Source
var AutoScalingObjType = types.ObjectType{AttrTypes: map[string]attr.Type{
	"compute_enabled":            types.BoolType,
	"compute_max_instance_size":  types.StringType,
	"compute_min_instance_size":  types.StringType,
	"compute_scale_down_enabled": types.BoolType,
	"disk_gb_enabled":            types.BoolType,
}}
View Source
var BiConnectorConfigObjType = types.ObjectType{AttrTypes: map[string]attr.Type{
	"enabled":         types.BoolType,
	"read_preference": types.StringType,
}}
View Source
var ConnectionStringsObjType = types.ObjectType{AttrTypes: map[string]attr.Type{
	"private":          types.StringType,
	"private_endpoint": types.ListType{ElemType: PrivateEndpointObjType},
	"private_srv":      types.StringType,
	"standard":         types.StringType,
	"standard_srv":     types.StringType,
}}
View Source
var (
	DeprecationMsgOldSchema = fmt.Sprintf("%s %s", constant.DeprecationParam, DeprecationOldSchemaAction)
)
View Source
var EndpointsObjType = types.ObjectType{AttrTypes: map[string]attr.Type{
	"endpoint_id":   types.StringType,
	"provider_name": types.StringType,
	"region":        types.StringType,
}}
View Source
var LabelsObjType = types.ObjectType{AttrTypes: map[string]attr.Type{
	"key":   types.StringType,
	"value": types.StringType,
}}
View Source
var PinnedFCVObjType = types.ObjectType{AttrTypes: map[string]attr.Type{
	"version":         types.StringType,
	"expiration_date": types.StringType,
}}
View Source
var PrivateEndpointObjType = types.ObjectType{AttrTypes: map[string]attr.Type{
	"connection_string":                     types.StringType,
	"endpoints":                             types.ListType{ElemType: EndpointsObjType},
	"srv_connection_string":                 types.StringType,
	"srv_shard_optimized_connection_string": types.StringType,
	"type":                                  types.StringType,
}}
View Source
var RegionConfigsObjType = types.ObjectType{AttrTypes: map[string]attr.Type{
	"analytics_auto_scaling": AutoScalingObjType,
	"analytics_specs":        SpecsObjType,
	"auto_scaling":           AutoScalingObjType,
	"backing_provider_name":  types.StringType,
	"electable_specs":        SpecsObjType,
	"priority":               types.Int64Type,
	"provider_name":          types.StringType,
	"read_only_specs":        SpecsObjType,
	"region_name":            types.StringType,
}}
View Source
var ReplicationSpecsObjType = types.ObjectType{AttrTypes: map[string]attr.Type{
	"id":             types.StringType,
	"container_id":   types.MapType{ElemType: types.StringType},
	"external_id":    types.StringType,
	"num_shards":     types.Int64Type,
	"region_configs": types.ListType{ElemType: RegionConfigsObjType},
	"zone_id":        types.StringType,
	"zone_name":      types.StringType,
}}
View Source
var SpecsObjType = types.ObjectType{AttrTypes: map[string]attr.Type{
	"disk_iops":       types.Int64Type,
	"disk_size_gb":    types.Float64Type,
	"ebs_volume_type": types.StringType,
	"instance_size":   types.StringType,
	"node_count":      types.Int64Type,
}}
View Source
var TagsObjType = types.ObjectType{AttrTypes: map[string]attr.Type{
	"key":   types.StringType,
	"value": types.StringType,
}}

Functions

func AddAdvancedConfig added in v1.22.0

func AutoScalingSchema added in v1.22.0

func AutoScalingSchema() schema.SingleNestedAttribute

func AwaitChanges added in v1.22.0

func AwaitChanges(ctx context.Context, api admin.ClustersApi, t *timeouts.Value, diags *diag.Diagnostics, projectID, clusterName, changeReason string) (cluster *admin.ClusterDescription20240805)

func CreateStateChangeConfig added in v1.22.0

func CreateStateChangeConfig(ctx context.Context, api admin.ClustersApi, projectID, name, targetState string, timeout time.Duration, extraPending ...string) retry.StateChangeConf

func DataSource

func DataSource() datasource.DataSource

func FormatMongoDBMajorVersion added in v1.23.0

func FormatMongoDBMajorVersion(version string) string

func MajorVersionCompatible added in v1.23.0

func MajorVersionCompatible(input *string, version float64, operator MajorVersionOperator) *bool

func NewAtlasReq

func NewAtlasReq(ctx context.Context, input *TFModel, diags *diag.Diagnostics) *admin.ClusterDescription20240805

func NewAtlasReqAdvancedConfiguration added in v1.22.0

func NewAtlasReqAdvancedConfiguration(ctx context.Context, input *types.List, diags *diag.Diagnostics) *admin.ClusterDescriptionProcessArgs20240805

func NewAtlasReqAdvancedConfigurationLegacy added in v1.22.0

func NewAtlasReqAdvancedConfigurationLegacy(ctx context.Context, input *types.List, diags *diag.Diagnostics) *admin20240530.ClusterDescriptionProcessArgs

func NewAutoScalingObjType added in v1.22.0

func NewAutoScalingObjType(ctx context.Context, input *admin.AdvancedAutoScalingSettings, diags *diag.Diagnostics) types.Object

func NewBiConnectorConfigObjType added in v1.22.0

func NewBiConnectorConfigObjType(ctx context.Context, input *admin.BiConnector, diags *diag.Diagnostics) types.List

func NewConnectionStringsObjType added in v1.22.0

func NewConnectionStringsObjType(ctx context.Context, input *admin.ClusterConnectionStrings, diags *diag.Diagnostics) types.Object

func NewLabelsObjType added in v1.22.0

func NewLabelsObjType(ctx context.Context, input *[]admin.ComponentLabel, diags *diag.Diagnostics) types.Set

func NewPrivateEndpointObjType added in v1.22.0

func NewPrivateEndpointObjType(ctx context.Context, input *[]admin.ClusterDescriptionConnectionStringsPrivateEndpoint, diags *diag.Diagnostics) types.List

func NewRegionConfigsObjType added in v1.22.0

func NewRegionConfigsObjType(ctx context.Context, input *[]admin.CloudRegionConfig20240805, diags *diag.Diagnostics) types.List

func NewReplicationSpecsObjType added in v1.22.0

func NewReplicationSpecsObjType(ctx context.Context, input *[]admin.ReplicationSpec20240805, diags *diag.Diagnostics, apiInfo *ExtraAPIInfo) types.List

func NewSpecsFromHwObjType added in v1.22.0

func NewSpecsFromHwObjType(ctx context.Context, input *admin.HardwareSpec20240805, diags *diag.Diagnostics) types.Object

func NewSpecsObjType added in v1.22.0

func NewSpecsObjType(ctx context.Context, input *admin.DedicatedHardwareSpec20240805, diags *diag.Diagnostics) types.Object

func NewTagsObjType added in v1.22.0

func NewTagsObjType(ctx context.Context, input *[]admin.ResourceTag, diags *diag.Diagnostics) types.Set

func PluralDataSource

func PluralDataSource() datasource.DataSource

func Resource

func Resource() resource.Resource

func SpecsSchema added in v1.22.0

func SpecsSchema(markdownDescription string) schema.SingleNestedAttribute

Types

type ExtraAPIInfo added in v1.23.0

type ExtraAPIInfo struct {
	ZoneNameNumShards          map[string]int64
	ZoneNameReplicationSpecIDs map[string]string
	RootDiskSize               *float64
	ContainerIDs               map[string]string
	UsingLegacySchema          bool
	ForceLegacySchemaFailed    bool
}

type FailOnIncompatibleMongoDBVersion added in v1.23.0

type FailOnIncompatibleMongoDBVersion struct {
	Version  float64
	Operator MajorVersionOperator
}

func PlanMustUseMongoDBVersion added in v1.23.0

func PlanMustUseMongoDBVersion(version float64, operator MajorVersionOperator) FailOnIncompatibleMongoDBVersion

func (FailOnIncompatibleMongoDBVersion) Description added in v1.23.0

func (FailOnIncompatibleMongoDBVersion) MarkdownDescription added in v1.23.0

func (v FailOnIncompatibleMongoDBVersion) MarkdownDescription(_ context.Context) string

func (FailOnIncompatibleMongoDBVersion) PlanModifyBool added in v1.23.0

func (FailOnIncompatibleMongoDBVersion) PlanModifyInt64 added in v1.23.0

type MajorVersionOperator added in v1.23.0

type MajorVersionOperator int
const (
	EqualOrHigher MajorVersionOperator = iota
	Higher
	EqualOrLower
	Lower
)

type RegionSpecPriorityOrderDecreasingValidator added in v1.23.0

type RegionSpecPriorityOrderDecreasingValidator struct{}

func (RegionSpecPriorityOrderDecreasingValidator) Description added in v1.23.0

func (RegionSpecPriorityOrderDecreasingValidator) MarkdownDescription added in v1.23.0

func (RegionSpecPriorityOrderDecreasingValidator) ValidateList added in v1.23.0

type TFAdvancedConfigurationModel added in v1.22.0

type TFAdvancedConfigurationModel struct {
	OplogMinRetentionHours                                types.Float64 `tfsdk:"oplog_min_retention_hours"`
	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"`
	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"`
	JavascriptEnabled                                     types.Bool    `tfsdk:"javascript_enabled"`
	NoTableScan                                           types.Bool    `tfsdk:"no_table_scan"`
	FailIndexKeyTooLong                                   types.Bool    `tfsdk:"fail_index_key_too_long"`
}

type TFAutoScalingModel added in v1.22.0

type TFAutoScalingModel struct {
	ComputeMaxInstanceSize  types.String `tfsdk:"compute_max_instance_size"`
	ComputeMinInstanceSize  types.String `tfsdk:"compute_min_instance_size"`
	ComputeEnabled          types.Bool   `tfsdk:"compute_enabled"`
	ComputeScaleDownEnabled types.Bool   `tfsdk:"compute_scale_down_enabled"`
	DiskGBEnabled           types.Bool   `tfsdk:"disk_gb_enabled"`
}

type TFBiConnectorModel added in v1.22.0

type TFBiConnectorModel struct {
	ReadPreference types.String `tfsdk:"read_preference"`
	Enabled        types.Bool   `tfsdk:"enabled"`
}

type TFConnectionStringsModel added in v1.22.0

type TFConnectionStringsModel struct {
	Private         types.String `tfsdk:"private"`
	PrivateEndpoint types.List   `tfsdk:"private_endpoint"`
	PrivateSrv      types.String `tfsdk:"private_srv"`
	Standard        types.String `tfsdk:"standard"`
	StandardSrv     types.String `tfsdk:"standard_srv"`
}

type TFEndpointsModel added in v1.22.0

type TFEndpointsModel struct {
	EndpointId   types.String `tfsdk:"endpoint_id"`
	ProviderName types.String `tfsdk:"provider_name"`
	Region       types.String `tfsdk:"region"`
}

type TFLabelsModel added in v1.22.0

type TFLabelsModel struct {
	Key   types.String `tfsdk:"key"`
	Value types.String `tfsdk:"value"`
}

type TFModel

type TFModel struct {
	DiskSizeGB                                types.Float64  `tfsdk:"disk_size_gb"`
	Labels                                    types.Set      `tfsdk:"labels"`
	ReplicationSpecs                          types.List     `tfsdk:"replication_specs"`
	Tags                                      types.Set      `tfsdk:"tags"`
	StateName                                 types.String   `tfsdk:"state_name"`
	ConnectionStrings                         types.Object   `tfsdk:"connection_strings"`
	CreateDate                                types.String   `tfsdk:"create_date"`
	AcceptDataRisksAndForceReplicaSetReconfig types.String   `tfsdk:"accept_data_risks_and_force_replica_set_reconfig"`
	EncryptionAtRestProvider                  types.String   `tfsdk:"encryption_at_rest_provider"`
	Timeouts                                  timeouts.Value `tfsdk:"timeouts"`
	ProjectID                                 types.String   `tfsdk:"project_id"`
	ClusterID                                 types.String   `tfsdk:"cluster_id"`
	ConfigServerManagementMode                types.String   `tfsdk:"config_server_management_mode"`
	MongoDBMajorVersion                       types.String   `tfsdk:"mongo_db_major_version"`
	MongoDBVersion                            types.String   `tfsdk:"mongo_db_version"`
	Name                                      types.String   `tfsdk:"name"`
	VersionReleaseSystem                      types.String   `tfsdk:"version_release_system"`
	BiConnectorConfig                         types.List     `tfsdk:"bi_connector_config"`
	ConfigServerType                          types.String   `tfsdk:"config_server_type"`
	ReplicaSetScalingStrategy                 types.String   `tfsdk:"replica_set_scaling_strategy"`
	ClusterType                               types.String   `tfsdk:"cluster_type"`
	RootCertType                              types.String   `tfsdk:"root_cert_type"`
	AdvancedConfiguration                     types.List     `tfsdk:"advanced_configuration"`
	PinnedFCV                                 types.Object   `tfsdk:"pinned_fcv"`
	TerminationProtectionEnabled              types.Bool     `tfsdk:"termination_protection_enabled"`
	Paused                                    types.Bool     `tfsdk:"paused"`
	RetainBackupsEnabled                      types.Bool     `tfsdk:"retain_backups_enabled"`
	BackupEnabled                             types.Bool     `tfsdk:"backup_enabled"`
	GlobalClusterSelfManagedSharding          types.Bool     `tfsdk:"global_cluster_self_managed_sharding"`
	RedactClientLogData                       types.Bool     `tfsdk:"redact_client_log_data"`
	PitEnabled                                types.Bool     `tfsdk:"pit_enabled"`
}

func NewTFModel

func NewTFModel(ctx context.Context, input *admin.ClusterDescription20240805, timeout timeouts.Value, diags *diag.Diagnostics, apiInfo ExtraAPIInfo) *TFModel

type TFModelDS added in v1.23.0

type TFModelDS struct {
	DiskSizeGB                       types.Float64 `tfsdk:"disk_size_gb"`
	Labels                           types.Set     `tfsdk:"labels"`
	ReplicationSpecs                 types.List    `tfsdk:"replication_specs"`
	Tags                             types.Set     `tfsdk:"tags"`
	ReplicaSetScalingStrategy        types.String  `tfsdk:"replica_set_scaling_strategy"`
	Name                             types.String  `tfsdk:"name"`
	AdvancedConfiguration            types.List    `tfsdk:"advanced_configuration"`
	BiConnectorConfig                types.List    `tfsdk:"bi_connector_config"`
	RootCertType                     types.String  `tfsdk:"root_cert_type"`
	ClusterType                      types.String  `tfsdk:"cluster_type"`
	MongoDBMajorVersion              types.String  `tfsdk:"mongo_db_major_version"`
	ConfigServerType                 types.String  `tfsdk:"config_server_type"`
	VersionReleaseSystem             types.String  `tfsdk:"version_release_system"`
	ConnectionStrings                types.Object  `tfsdk:"connection_strings"`
	StateName                        types.String  `tfsdk:"state_name"`
	MongoDBVersion                   types.String  `tfsdk:"mongo_db_version"`
	CreateDate                       types.String  `tfsdk:"create_date"`
	EncryptionAtRestProvider         types.String  `tfsdk:"encryption_at_rest_provider"`
	ProjectID                        types.String  `tfsdk:"project_id"`
	ClusterID                        types.String  `tfsdk:"cluster_id"`
	ConfigServerManagementMode       types.String  `tfsdk:"config_server_management_mode"`
	PinnedFCV                        types.Object  `tfsdk:"pinned_fcv"`
	UseReplicationSpecPerShard       types.Bool    `tfsdk:"use_replication_spec_per_shard"`
	RedactClientLogData              types.Bool    `tfsdk:"redact_client_log_data"`
	GlobalClusterSelfManagedSharding types.Bool    `tfsdk:"global_cluster_self_managed_sharding"`
	BackupEnabled                    types.Bool    `tfsdk:"backup_enabled"`
	RetainBackupsEnabled             types.Bool    `tfsdk:"retain_backups_enabled"`
	Paused                           types.Bool    `tfsdk:"paused"`
	TerminationProtectionEnabled     types.Bool    `tfsdk:"termination_protection_enabled"`
	PitEnabled                       types.Bool    `tfsdk:"pit_enabled"`
}

TFModelDS differs from TFModel: removes timeouts, accept_data_risks_and_force_replica_set_reconfig; adds use_replication_spec_per_shard.

type TFModelPluralDS added in v1.23.0

type TFModelPluralDS struct {
	ProjectID                         types.String `tfsdk:"project_id"`
	Results                           []*TFModelDS `tfsdk:"results"`
	UseReplicationSpecPerShard        types.Bool   `tfsdk:"use_replication_spec_per_shard"`        // TODO: added as in current resource
	IncludeDeletedWithRetainedBackups types.Bool   `tfsdk:"include_deleted_with_retained_backups"` // TODO: not in current resource, decide if keep
}

type TFPinnedFCVModel added in v1.23.0

type TFPinnedFCVModel struct {
	Version        types.String `tfsdk:"version"`
	ExpirationDate types.String `tfsdk:"expiration_date"`
}

type TFPrivateEndpointModel added in v1.22.0

type TFPrivateEndpointModel struct {
	ConnectionString                  types.String `tfsdk:"connection_string"`
	Endpoints                         types.List   `tfsdk:"endpoints"`
	SrvConnectionString               types.String `tfsdk:"srv_connection_string"`
	SrvShardOptimizedConnectionString types.String `tfsdk:"srv_shard_optimized_connection_string"`
	Type                              types.String `tfsdk:"type"`
}

type TFRegionConfigsModel added in v1.22.0

type TFRegionConfigsModel struct {
	AnalyticsAutoScaling types.Object `tfsdk:"analytics_auto_scaling"`
	AnalyticsSpecs       types.Object `tfsdk:"analytics_specs"`
	AutoScaling          types.Object `tfsdk:"auto_scaling"`
	BackingProviderName  types.String `tfsdk:"backing_provider_name"`
	ElectableSpecs       types.Object `tfsdk:"electable_specs"`
	ProviderName         types.String `tfsdk:"provider_name"`
	ReadOnlySpecs        types.Object `tfsdk:"read_only_specs"`
	RegionName           types.String `tfsdk:"region_name"`
	Priority             types.Int64  `tfsdk:"priority"`
}

type TFReplicationSpecsModel added in v1.22.0

type TFReplicationSpecsModel struct {
	RegionConfigs types.List   `tfsdk:"region_configs"`
	ContainerId   types.Map    `tfsdk:"container_id"`
	Id            types.String `tfsdk:"id"`
	ExternalId    types.String `tfsdk:"external_id"`
	ZoneId        types.String `tfsdk:"zone_id"`
	ZoneName      types.String `tfsdk:"zone_name"`
	NumShards     types.Int64  `tfsdk:"num_shards"`
}

type TFSpecsModel added in v1.22.0

type TFSpecsModel struct {
	DiskSizeGb    types.Float64 `tfsdk:"disk_size_gb"`
	EbsVolumeType types.String  `tfsdk:"ebs_volume_type"`
	InstanceSize  types.String  `tfsdk:"instance_size"`
	DiskIops      types.Int64   `tfsdk:"disk_iops"`
	NodeCount     types.Int64   `tfsdk:"node_count"`
}

type TFTagsModel added in v1.22.0

type TFTagsModel struct {
	Key   types.String `tfsdk:"key"`
	Value types.String `tfsdk:"value"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL