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
242 stars 168 forks source link

Can't unset auto_scaling #1072

Closed Ulrar closed 1 year ago

Ulrar commented 1 year ago

Terraform CLI and Terraform MongoDB Atlas Provider Version

Terraform v1.3.8
on linux_amd64
+ provider registry.terraform.io/hashicorp/random v3.4.3
+ provider registry.terraform.io/hashicorp/vault v3.11.0
+ provider registry.terraform.io/mongodb/mongodbatlas v1.8.0

Terraform Configuration File

resource "mongodbatlas_advanced_cluster" "cluster" {
...
}

Steps to Reproduce

Create a cluster with auto scaling, then try to disable it

Expected Behavior

Being able to

Actual Behavior

Whatever I try, I get the following error on apply : 400 (request "COMPUTE_AUTO_SCALING_MIN_INSTANCE_SIZE_INVALID_FOR_DISABLED") Compute auto-scaling min instance size must be unset when scale down is disabled.

The issue seems to be that these fields somehow default to their existing values, which means I can't unset them. Or at least I haven't figured out how, removing them doesn't do anything and setting them to empty values doesn't either.

Additional Context

These clusters have been defined using the mongodb_cluster resource first, then imported later in advanced cluster, in case that makes a difference.

References

Ulrar commented 1 year ago

For anyone else who might have that issue, I just disabled auto scaling through the UI and re-ran an apply to update the state, worked fine.

martinstibbe commented 1 year ago

@Ulrar I was able to replicate using advanced cluster directly will track fix in engineering ticket INTMDB-617

Zuhairahmed commented 1 year ago

just as an update @Ulrar this issue has been picked up for v1.8.2 release which should be published in the next month or two.

Zuhairahmed commented 1 year ago

hi @Ulrar v1.8.2 has been released which includes above fix. feel free to re-open if you need anything else. https://registry.terraform.io/providers/mongodb/mongodbatlas/latest

Ulrar commented 1 year ago

Thanks ! CC @pacoguzman