Skip to content

Commit 70a20b0

Browse files
Add option to set autoresize limit (#4743) (#3273)
Co-authored-by: Evy Bongers <[email protected]> Signed-off-by: Modular Magician <[email protected]> Co-authored-by: Evy Bongers <[email protected]>
1 parent 704390d commit 70a20b0

File tree

5 files changed

+21
-5
lines changed

5 files changed

+21
-5
lines changed

.changelog/4743.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
sql: added field `disk_autoresize_limit` to `sql_database_instance`
3+
```

google-beta/resource_dataproc_cluster_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ import (
1313
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
1414
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
1515

16-
dataproc "google.golang.org/api/dataproc/v1beta2"
1716
"google.golang.org/api/googleapi"
17+
18+
dataproc "google.golang.org/api/dataproc/v1beta2"
1819
)
1920

2021
func TestDataprocExtractInitTimeout(t *testing.T) {

google-beta/resource_sql_database_instance.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,13 @@ settings.backup_configuration.binary_log_enabled are both set to true.`,
270270
DiffSuppressFunc: suppressFirstGen,
271271
Description: `Configuration to increase storage size automatically. Note that future terraform apply calls will attempt to resize the disk to the value specified in disk_size - if this is set, do not set disk_size.`,
272272
},
273+
"disk_autoresize_limit": {
274+
Type: schema.TypeInt,
275+
Optional: true,
276+
Default: 0,
277+
DiffSuppressFunc: suppressFirstGen,
278+
Description: `The maximum size, in GB, to which storage capacity can be automatically increased. The default value is 0, which specifies that there is no limit.`,
279+
},
273280
"disk_size": {
274281
Type: schema.TypeInt,
275282
Optional: true,
@@ -978,6 +985,7 @@ func expandSqlDatabaseInstanceSettings(configured []interface{}, secondGen bool)
978985
if secondGen {
979986
resize := _settings["disk_autoresize"].(bool)
980987
settings.StorageAutoResize = &resize
988+
settings.StorageAutoResizeLimit = int64(_settings["disk_autoresize_limit"].(int))
981989
}
982990

983991
return settings
@@ -1395,6 +1403,7 @@ func flattenSettings(settings *sqladmin.Settings) []map[string]interface{} {
13951403
}
13961404

13971405
data["disk_autoresize"] = settings.StorageAutoResize
1406+
data["disk_autoresize_limit"] = settings.StorageAutoResizeLimit
13981407

13991408
if settings.UserLabels != nil {
14001409
data["user_labels"] = settings.UserLabels

google-beta/resource_sql_database_instance_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,10 +1253,11 @@ resource "google_sql_database_instance" "instance" {
12531253
deletion_protection = false
12541254
12551255
settings {
1256-
tier = "db-f1-micro"
1257-
disk_autoresize = true
1258-
disk_size = 15
1259-
disk_type = "PD_HDD"
1256+
tier = "db-f1-micro"
1257+
disk_autoresize = true
1258+
disk_autoresize_limit = 50
1259+
disk_size = 15
1260+
disk_type = "PD_HDD"
12601261
}
12611262
}
12621263
`

website/docs/d/sql_database_instance.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ instance, high availability (`REGIONAL`) or single zone (`ZONAL`).
6868

6969
* `disk_autoresize` - Configuration to increase storage size automatically.
7070

71+
* `disk_autoresize_limit` - The maximum size, in GB, to which storage capacity can be automatically increased.
72+
7173
* `disk_size` - The size of data disk, in GB.
7274

7375
* `disk_type` - The type of data disk.

0 commit comments

Comments
 (0)