Skip to content

Commit

Permalink
Merge pull request #27 from mineiros-io/soerenmartius/add-missing-field
Browse files Browse the repository at this point in the history
Add disk_autoresize_limit and prepare v0.1.0 release
  • Loading branch information
soerenmartius authored Nov 25, 2022
2 parents 11f699e + e3d7131 commit 70de816
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 19 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.1.0]

## Added

- Add `disk_autoresize_limit` to `google_sql_database_instance` resource
- Validation added for `database_version` string input variable

## [0.0.5]
Expand Down Expand Up @@ -54,7 +57,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Initial Implementation

[unreleased]: https://github.com/mineiros-io/terraform-google-cloud-sql/compare/v0.0.5...HEAD
[unreleased]: https://github.com/mineiros-io/terraform-google-cloud-sql/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/mineiros-io/terraform-google-cloud-sql/compare/v0.0.5...v0.1.0
[0.0.5]: https://github.com/mineiros-io/terraform-google-cloud-sql/compare/v0.0.4...v0.0.5
[0.0.4]: https://github.com/mineiros-io/terraform-google-cloud-sql/compare/v0.0.3...v0.0.4
[0.0.3]: https://github.com/mineiros-io/terraform-google-cloud-sql/compare/v0.0.2...v0.0.3
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Most basic usage just setting required arguments:

```hcl
module "terraform-google-cloud-sql" {
source = "github.com/mineiros-io/terraform-google-cloud-sql.git?ref=v0.0.5"
source = "github.com/mineiros-io/terraform-google-cloud-sql.git?ref=v0.1.0"
tier = "db-f1-micro"
database_version = "MYSQL_5_6"
Expand Down Expand Up @@ -130,6 +130,12 @@ See [variables.tf] and [examples/] for details and use-cases.

Default is `true`.

- [**`disk_autoresize_limit`**](#var-disk_autoresize_limit): *(Optional `number`)*<a name="var-disk_autoresize_limit"></a>

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.

Default is `0`.

- [**`disk_size`**](#var-disk_size): *(Optional `number`)*<a name="var-disk_size"></a>

The size of data disk, in GB. Size of a running instance cannot be reduced but can be increased.
Expand Down
10 changes: 9 additions & 1 deletion README.tfdoc.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ section {
```hcl
module "terraform-google-cloud-sql" {
source = "github.com/mineiros-io/terraform-google-cloud-sql.git?ref=v0.0.5"
source = "github.com/mineiros-io/terraform-google-cloud-sql.git?ref=v0.1.0"
tier = "db-f1-micro"
database_version = "MYSQL_5_6"
Expand Down Expand Up @@ -184,6 +184,14 @@ section {
END
}

variable "disk_autoresize_limit" {
type = number
default = 0
description = <<-END
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.
END
}

variable "disk_size" {
type = number
default = 10
Expand Down
11 changes: 6 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ resource "google_sql_database_instance" "instance" {
availability_type = var.availability_type

# 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
user_labels = var.user_labels
disk_autoresize = var.disk_size != null ? false : var.disk_autoresize
disk_autoresize_limit = var.disk_autoresize_limit
disk_size = var.disk_size
disk_type = var.disk_type
pricing_plan = var.pricing_plan
user_labels = var.user_labels

dynamic "database_flags" {
for_each = var.database_flags
Expand Down
23 changes: 12 additions & 11 deletions test/unit-complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ module "test" {
tier = "db-n1-standard-1"

# add all optional arguments that create additional/extended resources
name = "unit-complete-main-${local.random_suffix}"
region = var.gcp_region
master_instance_name = "unit-complete-main-master-${local.random_suffix}"
project = local.project_id
deletion_protection = true
activation_policy = "ALWAYS"
availability_type = "REGIONAL"
disk_autoresize = true
disk_size = 10
disk_type = "PD_SSD"
pricing_plan = "PER_USE"
name = "unit-complete-main-${local.random_suffix}"
region = var.gcp_region
master_instance_name = "unit-complete-main-master-${local.random_suffix}"
project = local.project_id
deletion_protection = true
activation_policy = "ALWAYS"
availability_type = "REGIONAL"
disk_autoresize = true
disk_autoresize_limit = 100
disk_size = 10
disk_type = "PD_SSD"
pricing_plan = "PER_USE"

user_labels = {
"key1" = "value1"
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ variable "disk_autoresize" {
default = true
}

variable "disk_autoresize_limit" {
description = "(Optional) 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."
type = number
default = 0
}

variable "disk_size" {
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
Expand Down

0 comments on commit 70de816

Please sign in to comment.