From 70dbbc152836076cbea99bef228284b44c7fc55a Mon Sep 17 00:00:00 2001 From: EspenAlbert Date: Mon, 8 Jul 2024 12:27:15 +0100 Subject: [PATCH] refactor: use advanced_cluster instead of cluster --- .../resource_global_cluster_config_test.go | 48 ++++++++++++++----- internal/testutil/acc/cluster.go | 28 ++++++----- 2 files changed, 52 insertions(+), 24 deletions(-) diff --git a/internal/service/globalclusterconfig/resource_global_cluster_config_test.go b/internal/service/globalclusterconfig/resource_global_cluster_config_test.go index 342a354f21..3d8149c92c 100644 --- a/internal/service/globalclusterconfig/resource_global_cluster_config_test.go +++ b/internal/service/globalclusterconfig/resource_global_cluster_config_test.go @@ -273,41 +273,65 @@ const ( replication_specs { zone_name = "US" num_shards = 1 - regions_config { + region_configs { + auto_scaling { + disk_gb_enabled = false + } region_name = "US_EAST_1" - electable_nodes = 3 + provider_name = "AWS" priority = 7 - read_only_nodes = 0 + electable_specs { + instance_size = "M10" + node_count = 3 + } } } replication_specs { zone_name = "EU" num_shards = 1 - regions_config { + region_configs { + auto_scaling { + disk_gb_enabled = false + } region_name = "EU_WEST_1" - electable_nodes = 3 + provider_name = "AWS" priority = 7 - read_only_nodes = 0 + electable_specs { + instance_size = "M10" + node_count = 3 + } } } replication_specs { zone_name = "DE" num_shards = 1 - regions_config { + region_configs { + auto_scaling { + disk_gb_enabled = false + } region_name = "EU_NORTH_1" - electable_nodes = 3 + provider_name = "AWS" priority = 7 - read_only_nodes = 0 + electable_specs { + instance_size = "M10" + node_count = 3 + } } } replication_specs { zone_name = "JP" num_shards = 1 - regions_config { + region_configs { + auto_scaling { + disk_gb_enabled = false + } region_name = "AP_NORTHEAST_1" - electable_nodes = 3 + provider_name = "AWS" priority = 7 - read_only_nodes = 0 + electable_specs { + instance_size = "M10" + node_count = 3 + } } } ` diff --git a/internal/testutil/acc/cluster.go b/internal/testutil/acc/cluster.go index c581f88464..04a6262553 100644 --- a/internal/testutil/acc/cluster.go +++ b/internal/testutil/acc/cluster.go @@ -61,23 +61,27 @@ func GetClusterInfo(tb testing.TB, req *ClusterRequest) ClusterInfo { `, req.ResourceDependencyName) } clusterTerraformStr := fmt.Sprintf(` - resource "mongodbatlas_cluster" "test_cluster" { + resource "mongodbatlas_advanced_cluster" "test_cluster" { project_id = %[1]q name = %[2]q - cloud_backup = %[3]t - auto_scaling_disk_gb_enabled = false - provider_name = %[4]q - provider_instance_size_name = "M10" - - cluster_type = %[5]q + backup_enabled = %[3]t + cluster_type = %[5]q + replication_specs { num_shards = 1 zone_name = "Zone 1" - regions_config { - region_name = "US_WEST_2" - electable_nodes = 3 + region_configs { + auto_scaling { + disk_gb_enabled = false + } + provider_name = %[4]q + region_name = "US_WEST_2" priority = 7 - read_only_nodes = 0 + + electable_specs { + instance_size = "M10" + node_count = 3 + } } } %[6]s @@ -88,7 +92,7 @@ func GetClusterInfo(tb testing.TB, req *ClusterRequest) ClusterInfo { ProjectIDStr: fmt.Sprintf("%q", projectID), ProjectID: projectID, ClusterName: clusterName, - ClusterNameStr: "mongodbatlas_cluster.test_cluster.name", + ClusterNameStr: "mongodbatlas_advanced_cluster.test_cluster.name", ClusterTerraformStr: clusterTerraformStr, } }