Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

num_shards value changed to 1 #970

Closed
jmeagheriv opened this issue Dec 16, 2022 · 4 comments
Closed

num_shards value changed to 1 #970

jmeagheriv opened this issue Dec 16, 2022 · 4 comments
Labels

Comments

@jmeagheriv
Copy link

jmeagheriv commented Dec 16, 2022

Terraform CLI and Terraform MongoDB Atlas Provider Version

Terraform v0.13.7
+ provider registry.terraform.io/mongodb/mongodbatlas v1.6.1

Terraform Configuration File

resource "mongodbatlas_cluster" "cluster-test"
 project_id   = var.projid
 name         = "cluster-test"
 cluster_type = "SHARDED"
 replication_specs {
   num_shards = 3
   regions_config {
     region_name     = "US_EAST_1"
     electable_nodes = 3
     priority        = 7
     read_only_nodes = 0
   }
 }
 cloud_backup = true
 auto_scaling_disk_gb_enabled = true
 mongo_db_major_version       = "4.2"
 # Provider Settings "block"
 provider_name               = "AWS"
 disk_size_gb                = 100
 provider_instance_size_name = "M30"
}

Steps to Reproduce

Expected Behavior

No changes

Actual Behavior

  ~ num_shards                              = 3 -> 1

Number of shards reset to 1.

Debug Output

Crash Output

No Crash output

Additional Context

There are two different num_shards values in the plan output, one in replicationSpecs and one before that. If you have a sharded cluster and make any change except to num_shards it will revert the num_shards to 1. This issue could cause someone to remove shards erroneously.

References

https://github.com/mongodb/terraform-provider-mongodbatlas/blob/master/mongodbatlas/data_source_mongodbatlas_cluster.go

@jmeagheriv
Copy link
Author

Updated the references it seems in this resource there is num_shards inside the replication_specs and outside it. If you set them both the issue doesn't occur but your config looks weird with the same variable set multiple times

@martinstibbe
Copy link
Contributor

@jmeagheriv Investigating the overlap of parameters with engineering to determine best course of action

@github-actions
Copy link
Contributor

This issue has gone 30 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 30 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!

@github-actions github-actions bot added the stale label Jan 19, 2023
@Zuhairahmed Zuhairahmed added not_stale Not stale issue or PR and removed stale labels Jan 19, 2023
@Zuhairahmed Zuhairahmed added stale and removed not_stale Not stale issue or PR labels Mar 19, 2023
@Zuhairahmed
Copy link
Collaborator

Zuhairahmed commented Mar 19, 2023

@jmeagheriv this issue has been resolved in advanced_cluster resource with only 1 num_shards parameter within replicationSpecs block. For more details see here: https://www.mongodb.com/docs/atlas/reference/api-resources-spec/#tag/Multi-Cloud-Clusters/operation/listClusters

You are correct there are 2 num_shards parameters in cluster resource and would recommend in this case to adopt advanced_cluster resource where possible going forward. Closing issue, but feel free to re-open if you need anything else here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants