diff --git a/digitalocean/database/resource_database_cluster.go b/digitalocean/database/resource_database_cluster.go index d6082fe98..d207b8e65 100644 --- a/digitalocean/database/resource_database_cluster.go +++ b/digitalocean/database/resource_database_cluster.go @@ -364,7 +364,11 @@ func resourceDigitalOceanDatabaseClusterUpdate(ctx context.Context, d *schema.Re SizeSlug: d.Get("size").(string), NumNodes: d.Get("node_count").(int), } - if v, ok := d.GetOk("storage_size_mib"); ok { + + // only include the storage_size_mib in the resize request if it has changed + // this avoids invalid values when plans sizes are increasing that require higher base levels of storage + // excluding this parameter will utilize default base storage levels for the given plan size + if v, ok := d.GetOk("storage_size_mib"); ok && d.HasChange("storage_size_mib") { v, err := strconv.ParseUint(v.(string), 10, 64) if err == nil { opts.StorageSizeMib = v diff --git a/digitalocean/database/resource_database_cluster_test.go b/digitalocean/database/resource_database_cluster_test.go index d053701a8..82b4ac928 100644 --- a/digitalocean/database/resource_database_cluster_test.go +++ b/digitalocean/database/resource_database_cluster_test.go @@ -930,7 +930,7 @@ const testAccCheckDigitalOceanDatabaseClusterConfigMongoDB = ` resource "digitalocean_database_cluster" "foobar" { name = "%s" engine = "mongodb" - version = "4" + version = "6" size = "db-s-1vcpu-1gb" region = "nyc3" node_count = 1 diff --git a/digitalocean/database/resource_database_user_test.go b/digitalocean/database/resource_database_user_test.go index 1a036379e..b4be3f3e8 100644 --- a/digitalocean/database/resource_database_user_test.go +++ b/digitalocean/database/resource_database_user_test.go @@ -363,7 +363,7 @@ const testAccCheckDigitalOceanDatabaseUserConfigMongo = ` resource "digitalocean_database_cluster" "foobar" { name = "%s" engine = "mongodb" - version = "4" + version = "6" size = "db-s-1vcpu-1gb" region = "nyc1" node_count = 1 @@ -383,7 +383,7 @@ const testAccCheckDigitalOceanDatabaseUserConfigMongoMultiUser = ` resource "digitalocean_database_cluster" "foobar" { name = "%s" engine = "mongodb" - version = "4" + version = "6" size = "db-s-1vcpu-1gb" region = "nyc1" node_count = 1 diff --git a/docs/resources/database_cluster.md b/docs/resources/database_cluster.md index 1d0ff59bf..890b79c62 100644 --- a/docs/resources/database_cluster.md +++ b/docs/resources/database_cluster.md @@ -61,7 +61,7 @@ resource "digitalocean_database_cluster" "kafka-example" { resource "digitalocean_database_cluster" "mongodb-example" { name = "example-mongo-cluster" engine = "mongodb" - version = "4" + version = "6" size = "db-s-1vcpu-1gb" region = "nyc3" node_count = 1