advancedclustertpf

package
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MPL-2.0 Imports: 37 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)

Documentation

Index

Constants

View Source
const (
	MoveModeEnvVarName   = "MONGODB_ATLAS_TEST_MOVE_MODE"
	MoveModeValPreferred = "preferred"
	MoveModeValRawState  = "rawstate"
	MoveModeValJSON      = "json"
)
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 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 AdvancedConfigurationSchema added in v1.22.0

func AdvancedConfigurationSchema(ctx context.Context) schema.SingleNestedAttribute

TODO: generated from processArgs API endpoint

func AutoScalingSchema added in v1.22.0

func AutoScalingSchema() schema.SingleNestedAttribute

func AwaitChanges added in v1.22.0

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

func CreateStateChangeConfig added in v1.22.0

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

func DataSource

func DataSource() datasource.DataSource

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, objInput *types.Object, diags *diag.Diagnostics) *admin.ClusterDescriptionProcessArgs20240805

func NewAtlasReqAdvancedConfigurationLegacy added in v1.22.0

func NewAtlasReqAdvancedConfigurationLegacy(ctx context.Context, objInput *types.Object, 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.Object

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) 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 PluralDataSourceSchema

func PluralDataSourceSchema(ctx context.Context) schema.Schema

TODO: see if we can leverage on resource or singular data source schema, e.g. have a func to add computed

func Resource

func Resource() resource.Resource

func ResourceSchema

func ResourceSchema(ctx context.Context) schema.Schema

func SpecsSchema added in v1.22.0

func SpecsSchema(markdownDescription string) schema.SingleNestedAttribute

Types

type AdvancedClustersModel

type AdvancedClustersModel struct {
	ProjectID                         types.String `tfsdk:"project_id"`
	ItemsPerPage                      types.Int64  `tfsdk:"items_per_page"`
	PageNum                           types.Int64  `tfsdk:"page_num"`
	TotalCount                        types.Int64  `tfsdk:"total_count"`
	IncludeCount                      types.Bool   `tfsdk:"include_count"`
	IncludeDeletedWithRetainedBackups types.Bool   `tfsdk:"include_deleted_with_retained_backups"`
}

type ModelDS

type ModelDS struct {
	ProjectID types.String `tfsdk:"project_id"`
	Name      types.String `tfsdk:"name"`
}

TODO: see if resource model can be used instead

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"`
	MongoDBVersion                            types.String   `tfsdk:"mongo_db_version"`
	BiConnectorConfig                         types.Object   `tfsdk:"bi_connector_config"`
	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"`
	StateName                                 types.String   `tfsdk:"state_name"`
	Name                                      types.String   `tfsdk:"name"`
	VersionReleaseSystem                      types.String   `tfsdk:"version_release_system"`
	ConnectionStrings                         types.Object   `tfsdk:"connection_strings"`
	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.Object   `tfsdk:"advanced_configuration"`
	PitEnabled                                types.Bool     `tfsdk:"pit_enabled"`
	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"`
}

func NewTFModel

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

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