Skip to content

Commit d76dfd6

Browse files
authored
fix: uses SchemaConfigModeAttr for list attributes in cluster resource. (#1654)
* fix: uses SchemaConfigModeAttr for list attributes. * test. * test.
1 parent 7074c0b commit d76dfd6

3 files changed

+22
-12
lines changed

mongodbatlas/resource_mongodbatlas_cloud_backup_snapshot.go

+9-6
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,9 @@ func flattenCloudProviderSnapshotBackupPolicy(ctx context.Context, d *schema.Res
444444

445445
func computedCloudProviderSnapshotBackupPolicySchema() *schema.Schema {
446446
return &schema.Schema{
447-
Type: schema.TypeList,
448-
Computed: true,
447+
Type: schema.TypeList,
448+
Computed: true,
449+
ConfigMode: schema.SchemaConfigModeAttr,
449450
Elem: &schema.Resource{
450451
Schema: map[string]*schema.Schema{
451452
"cluster_id": {
@@ -477,17 +478,19 @@ func computedCloudProviderSnapshotBackupPolicySchema() *schema.Schema {
477478
Computed: true,
478479
},
479480
"policies": {
480-
Type: schema.TypeList,
481-
Computed: true,
481+
Type: schema.TypeList,
482+
Computed: true,
483+
ConfigMode: schema.SchemaConfigModeAttr,
482484
Elem: &schema.Resource{
483485
Schema: map[string]*schema.Schema{
484486
"id": {
485487
Type: schema.TypeString,
486488
Computed: true,
487489
},
488490
"policy_item": {
489-
Type: schema.TypeList,
490-
Computed: true,
491+
Type: schema.TypeList,
492+
Computed: true,
493+
ConfigMode: schema.SchemaConfigModeAttr,
491494
Elem: &schema.Resource{
492495
Schema: map[string]*schema.Schema{
493496
"id": {

mongodbatlas/resource_mongodbatlas_cluster.go

+9-6
Original file line numberDiff line numberDiff line change
@@ -1529,8 +1529,9 @@ func getContainerID(containers []matlas.Container, cluster *matlas.Cluster) stri
15291529

15301530
func clusterConnectionStringsSchema() *schema.Schema {
15311531
return &schema.Schema{
1532-
Type: schema.TypeList,
1533-
Computed: true,
1532+
Type: schema.TypeList,
1533+
Computed: true,
1534+
ConfigMode: schema.SchemaConfigModeAttr,
15341535
Elem: &schema.Resource{
15351536
Schema: map[string]*schema.Schema{
15361537
"standard": {
@@ -1550,17 +1551,19 @@ func clusterConnectionStringsSchema() *schema.Schema {
15501551
Computed: true,
15511552
},
15521553
"private_endpoint": {
1553-
Type: schema.TypeList,
1554-
Computed: true,
1554+
Type: schema.TypeList,
1555+
Computed: true,
1556+
ConfigMode: schema.SchemaConfigModeAttr,
15551557
Elem: &schema.Resource{
15561558
Schema: map[string]*schema.Schema{
15571559
"connection_string": {
15581560
Type: schema.TypeString,
15591561
Computed: true,
15601562
},
15611563
"endpoints": {
1562-
Type: schema.TypeList,
1563-
Computed: true,
1564+
Type: schema.TypeList,
1565+
Computed: true,
1566+
ConfigMode: schema.SchemaConfigModeAttr,
15641567
Elem: &schema.Resource{
15651568
Schema: map[string]*schema.Schema{
15661569
"endpoint_id": {

mongodbatlas/resource_mongodbatlas_cluster_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ func TestAccClusterRSCluster_basicAWS_simple(t *testing.T) {
4848
resource.TestCheckResourceAttr(resourceName, "version_release_system", "LTS"),
4949
resource.TestCheckResourceAttr(resourceName, "accept_data_risks_and_force_replica_set_reconfig", ""),
5050
resource.TestCheckResourceAttr(resourceName, "auto_scaling_disk_gb_enabled", "true"),
51+
resource.TestCheckResourceAttrSet(resourceName, "snapshot_backup_policy.#"),
52+
resource.TestCheckResourceAttrSet(resourceName, "snapshot_backup_policy.0.policies.#"),
53+
resource.TestCheckResourceAttrSet(resourceName, "connection_strings.#"),
54+
resource.TestCheckResourceAttrSet(resourceName, "connection_strings.0.private_endpoint.#"),
5155
),
5256
},
5357
{

0 commit comments

Comments
 (0)