mongodb / terraform-provider-mongodbatlas

Terraform MongoDB Atlas Provider: Deploy, update, and manage MongoDB Atlas infrastructure as code through HashiCorp Terraform
https://registry.terraform.io/providers/mongodb/mongodbatlas
Mozilla Public License 2.0
241 stars 169 forks source link

[Bug]: Documentation issue #2240

Closed AdamMAtWork closed 4 months ago

AdamMAtWork commented 4 months ago

Is there an existing issue for this?

Provider Version

1.16.0

Terraform Version

n/a

Terraform Edition

Terraform Enterprise

Current Behavior

In the reference documentation, num_shards is labelled as (Required) but the description says to omit the value when cluster_type is REPLICASET.

When applying a cluster_type of REPLICASET, if num_shards is omitted, the following error is produced:

 Error: Provider produced invalid plan

 Provider "registry.terraform.io/mongodb/mongodbatlas" planned an invalid value for
 module.mongodb_contiguous_cluster.module.contiguous_cluster.mongodbatlas_advanced_cluster.replicaset.replication_specs[0].num_shards: planned value cty.NumberIntVal(1) for a non-computed attribute.

 This is a bug in the provider, which should be reported in the provider's own issue tracker.

I'd like to create a non-sharded, REPLICASET cluster, but the documentation is misleading.

Terraform configuration to reproduce the issue

TBD

Steps To Reproduce

TBD

Logs

No response

Code of Conduct

github-actions[bot] commented 4 months ago

Thanks for opening this issue! Please make sure you've followed our guidelines when opening the issue. In short, to help us reproduce the issue we need:

The ticket CLOUDP-248007 was created for internal tracking.

github-actions[bot] commented 4 months ago

This issue has gone 7 days without any activity and meets the project’s definition of "stale". This will be auto-closed if there is no new activity over the next 7 days. If the issue is still relevant and active, you can simply comment with a "bump" to keep it open, or add the label "not_stale". Thanks for keeping our repository healthy!

marcosuma commented 4 months ago

Thanks for opening this issue with us @AdamMAtWork , let me have a look at it and get back to you.

marcosuma commented 4 months ago

I've did a quick test and created

resource "mongodbatlas_advanced_cluster" "this" {
  project_id                     = var.project_id
  name                           = "advanced-cluster-0"
  mongo_db_major_version         = "6.0"
  termination_protection_enabled = false
  cluster_type                   = "REPLICASET"

  replication_specs {
    region_configs {
      electable_specs {
        instance_size = "M10"
        node_count    = 3
      }
      analytics_specs {
        instance_size = "M10"
        node_count    = 1
      }
      provider_name = "AWS"
      priority      = 7
      region_name   = "US_EAST_1"
    }
  }
}

and verified that num_shards is effectively not needed and that the creation succeeds. I haven't investigated about your error, but I am assuming you tried to specify the num_shards field for a REPLICASET and you got that error.

You are correct the documentation should be updated and be more clear. Let me take an action at it.

github-actions[bot] commented 4 months ago

This issue has gone 7 days without any activity and meets the project’s definition of "stale". This will be auto-closed if there is no new activity over the next 7 days. If the issue is still relevant and active, you can simply comment with a "bump" to keep it open, or add the label "not_stale". Thanks for keeping our repository healthy!