Skip to content

Commit

Permalink
fix: uses SchemaConfigModeAttr for list attributes in cluster resourc…
Browse files Browse the repository at this point in the history
…e. (#1654)

* fix: uses SchemaConfigModeAttr for list attributes.

* test.

* test.
  • Loading branch information
marcosuma authored Nov 22, 2023
1 parent 7074c0b commit d76dfd6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
15 changes: 9 additions & 6 deletions mongodbatlas/resource_mongodbatlas_cloud_backup_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,9 @@ func flattenCloudProviderSnapshotBackupPolicy(ctx context.Context, d *schema.Res

func computedCloudProviderSnapshotBackupPolicySchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeList,
Computed: true,
Type: schema.TypeList,
Computed: true,
ConfigMode: schema.SchemaConfigModeAttr,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"cluster_id": {
Expand Down Expand Up @@ -477,17 +478,19 @@ func computedCloudProviderSnapshotBackupPolicySchema() *schema.Schema {
Computed: true,
},
"policies": {
Type: schema.TypeList,
Computed: true,
Type: schema.TypeList,
Computed: true,
ConfigMode: schema.SchemaConfigModeAttr,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeString,
Computed: true,
},
"policy_item": {
Type: schema.TypeList,
Computed: true,
Type: schema.TypeList,
Computed: true,
ConfigMode: schema.SchemaConfigModeAttr,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Expand Down
15 changes: 9 additions & 6 deletions mongodbatlas/resource_mongodbatlas_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1529,8 +1529,9 @@ func getContainerID(containers []matlas.Container, cluster *matlas.Cluster) stri

func clusterConnectionStringsSchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeList,
Computed: true,
Type: schema.TypeList,
Computed: true,
ConfigMode: schema.SchemaConfigModeAttr,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"standard": {
Expand All @@ -1550,17 +1551,19 @@ func clusterConnectionStringsSchema() *schema.Schema {
Computed: true,
},
"private_endpoint": {
Type: schema.TypeList,
Computed: true,
Type: schema.TypeList,
Computed: true,
ConfigMode: schema.SchemaConfigModeAttr,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"connection_string": {
Type: schema.TypeString,
Computed: true,
},
"endpoints": {
Type: schema.TypeList,
Computed: true,
Type: schema.TypeList,
Computed: true,
ConfigMode: schema.SchemaConfigModeAttr,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"endpoint_id": {
Expand Down
4 changes: 4 additions & 0 deletions mongodbatlas/resource_mongodbatlas_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ func TestAccClusterRSCluster_basicAWS_simple(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "version_release_system", "LTS"),
resource.TestCheckResourceAttr(resourceName, "accept_data_risks_and_force_replica_set_reconfig", ""),
resource.TestCheckResourceAttr(resourceName, "auto_scaling_disk_gb_enabled", "true"),
resource.TestCheckResourceAttrSet(resourceName, "snapshot_backup_policy.#"),
resource.TestCheckResourceAttrSet(resourceName, "snapshot_backup_policy.0.policies.#"),
resource.TestCheckResourceAttrSet(resourceName, "connection_strings.#"),
resource.TestCheckResourceAttrSet(resourceName, "connection_strings.0.private_endpoint.#"),
),
},
{
Expand Down

0 comments on commit d76dfd6

Please sign in to comment.