Skip to content

Commit

Permalink
Merge pull request #7 from mineiros-io/mariux/fix
Browse files Browse the repository at this point in the history
fix: make disk_autoresize follow disk_size setting to resolve recreation issues on fixed disk_size
  • Loading branch information
mariux authored Oct 14, 2021
2 parents 108119d + 6cb05ef commit 6d9bbfc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.0.2]

### Fixed

- Fixed `disk_autoresize` default to follow `disk_size` variable.

## [0.0.1]

### Added
Expand All @@ -15,7 +21,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

<!-- markdown-link-check-disable -->

[unreleased]: https://github.com/mineiros-io/terraform-google-cloud-sql/compare/v0.0.1...HEAD
[0.0.1]: https://github.com/mineiros-io/terraform-google-cloud-sql/releases/tag/v0.0.1
[unreleased]: https://github.com/mineiros-io/terraform-google-cloud-sql/compare/v0.0.2...HEAD
[0.0.2]: https://github.com/mineiros-io/terraform-google-cloud-sql/compare/v0.0.1...v0.0.2

<!-- markdown-link-check-disabled -->

[0.0.1]: https://github.com/mineiros-io/terraform-google-cloud-sql/releases/tag/v0.0.1
14 changes: 8 additions & 6 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ resource "google_sql_database_instance" "instance" {
tier = var.tier
activation_policy = var.activation_policy
availability_type = var.availability_type
disk_autoresize = var.disk_autoresize
disk_size = var.disk_size
disk_type = var.disk_type
pricing_plan = var.pricing_plan
replication_type = var.replication_type
user_labels = var.user_labels

# disable disk_autoresize if the user requested a specific disk_size
disk_autoresize = var.disk_size != null ? false : var.disk_autoresize
disk_size = var.disk_size
disk_type = var.disk_type
pricing_plan = var.pricing_plan
replication_type = var.replication_type
user_labels = var.user_labels

dynamic "database_flags" {
for_each = var.database_flags
Expand Down
6 changes: 3 additions & 3 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ variable "availability_type" {
}

variable "disk_autoresize" {
description = "(Optional) Configuration to increase storage size automatically."
description = "(Optional) Configuration to increase storage size automatically. Default is `true` if no `var.disk_size` is set and `false` otherwise."
type = bool
default = true
}

variable "disk_size" {
description = "(Optional) The size of data disk, in GB. Size of a running instance cannot be reduced but can be increased."
description = "(Optional) The size of data disk, in GB. Size of a running instance cannot be reduced but can be increased. If `disk_size` is set `var.disk_autoresize` will be disbaled as terraform can not handle both."
type = number
default = 10
default = null
}

variable "disk_type" {
Expand Down

0 comments on commit 6d9bbfc

Please sign in to comment.