From b1e00887ba3629936369e267fbd141d468351642 Mon Sep 17 00:00:00 2001 From: Naren Date: Wed, 24 Jul 2019 13:37:05 +0800 Subject: [PATCH 1/3] feat(storage): added support for max_allocated_storage --- README.md | 1 + main.tf | 21 ++++++++++---------- modules/db_instance/main.tf | 34 +++++++++++++++++--------------- modules/db_instance/variables.tf | 4 ++++ variables.tf | 4 ++++ 5 files changed, 38 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index cd4f869f..ab504776 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,7 @@ module "db" { | Name | Description | Type | Default | Required | |------|-------------|:----:|:-----:|:-----:| | allocated\_storage | The allocated storage in gigabytes | string | n/a | yes | +| max\_allocated\_storage | Specifies the maximum value for storage autoscaling | string | `""` | no | | allow\_major\_version\_upgrade | Indicates that major version upgrades are allowed. Changing this parameter does not result in an outage and the change is asynchronously applied as soon as possible | string | `"false"` | no | | apply\_immediately | Specifies whether any database modifications are applied immediately, or during the next maintenance window | string | `"false"` | no | | auto\_minor\_version\_upgrade | Indicates that minor engine upgrades will be applied automatically to the DB instance during the maintenance window | string | `"true"` | no | diff --git a/main.tf b/main.tf index d121127b..21235855 100644 --- a/main.tf +++ b/main.tf @@ -54,16 +54,17 @@ module "db_option_group" { module "db_instance" { source = "./modules/db_instance" - create = "${var.create_db_instance}" - identifier = "${var.identifier}" - engine = "${var.engine}" - engine_version = "${var.engine_version}" - instance_class = "${var.instance_class}" - allocated_storage = "${var.allocated_storage}" - storage_type = "${var.storage_type}" - storage_encrypted = "${var.storage_encrypted}" - kms_key_id = "${var.kms_key_id}" - license_model = "${var.license_model}" + create = "${var.create_db_instance}" + identifier = "${var.identifier}" + engine = "${var.engine}" + engine_version = "${var.engine_version}" + instance_class = "${var.instance_class}" + allocated_storage = "${var.allocated_storage}" + max_allocated_storage = "${var.max_allocated_storage}" + storage_type = "${var.storage_type}" + storage_encrypted = "${var.storage_encrypted}" + kms_key_id = "${var.kms_key_id}" + license_model = "${var.license_model}" name = "${var.name}" username = "${var.username}" diff --git a/modules/db_instance/main.tf b/modules/db_instance/main.tf index 6602d69a..f85b5919 100644 --- a/modules/db_instance/main.tf +++ b/modules/db_instance/main.tf @@ -22,14 +22,15 @@ resource "aws_db_instance" "this" { identifier = "${var.identifier}" - engine = "${var.engine}" - engine_version = "${var.engine_version}" - instance_class = "${var.instance_class}" - allocated_storage = "${var.allocated_storage}" - storage_type = "${var.storage_type}" - storage_encrypted = "${var.storage_encrypted}" - kms_key_id = "${var.kms_key_id}" - license_model = "${var.license_model}" + engine = "${var.engine}" + engine_version = "${var.engine_version}" + instance_class = "${var.instance_class}" + allocated_storage = "${var.allocated_storage}" + max_allocated_storage = "${var.max_allocated_storage}" + storage_type = "${var.storage_type}" + storage_encrypted = "${var.storage_encrypted}" + kms_key_id = "${var.kms_key_id}" + license_model = "${var.license_model}" name = "${var.name}" username = "${var.username}" @@ -82,14 +83,15 @@ resource "aws_db_instance" "this_mssql" { identifier = "${var.identifier}" - engine = "${var.engine}" - engine_version = "${var.engine_version}" - instance_class = "${var.instance_class}" - allocated_storage = "${var.allocated_storage}" - storage_type = "${var.storage_type}" - storage_encrypted = "${var.storage_encrypted}" - kms_key_id = "${var.kms_key_id}" - license_model = "${var.license_model}" + engine = "${var.engine}" + engine_version = "${var.engine_version}" + instance_class = "${var.instance_class}" + allocated_storage = "${var.allocated_storage}" + max_allocated_storage = "${var.max_allocated_storage}" + storage_type = "${var.storage_type}" + storage_encrypted = "${var.storage_encrypted}" + kms_key_id = "${var.kms_key_id}" + license_model = "${var.license_model}" name = "${var.name}" username = "${var.username}" diff --git a/modules/db_instance/variables.tf b/modules/db_instance/variables.tf index 92454e06..296f1733 100644 --- a/modules/db_instance/variables.tf +++ b/modules/db_instance/variables.tf @@ -11,6 +11,10 @@ variable "allocated_storage" { description = "The allocated storage in gigabytes" } +variable "max_allocated_storage" { + description = "Specifies the value for Storage Autoscaling" +} + variable "storage_type" { description = "One of 'standard' (magnetic), 'gp2' (general purpose SSD), or 'io1' (provisioned IOPS SSD). The default is 'io1' if iops is specified, 'standard' if not. Note that this behaviour is different from the AWS web console, where the default is 'gp2'." default = "gp2" diff --git a/variables.tf b/variables.tf index 65275ec7..47e44f30 100644 --- a/variables.tf +++ b/variables.tf @@ -6,6 +6,10 @@ variable "allocated_storage" { description = "The allocated storage in gigabytes" } +variable "max_allocated_storage" { + description = "Specifies the value for Storage Autoscaling" +} + variable "storage_type" { description = "One of 'standard' (magnetic), 'gp2' (general purpose SSD), or 'io1' (provisioned IOPS SSD). The default is 'io1' if iops is specified, 'standard' if not. Note that this behaviour is different from the AWS web console, where the default is 'gp2'." default = "gp2" From 024659a669bdfc0099e3bba1164f5c03e740c9fb Mon Sep 17 00:00:00 2001 From: Naren Date: Wed, 24 Jul 2019 15:45:19 +0800 Subject: [PATCH 2/3] feat(storage): added support for max_allocated_storage --- modules/db_instance/variables.tf | 1 + variables.tf | 1 + 2 files changed, 2 insertions(+) diff --git a/modules/db_instance/variables.tf b/modules/db_instance/variables.tf index 296f1733..641e8c71 100644 --- a/modules/db_instance/variables.tf +++ b/modules/db_instance/variables.tf @@ -13,6 +13,7 @@ variable "allocated_storage" { variable "max_allocated_storage" { description = "Specifies the value for Storage Autoscaling" + default = 0 } variable "storage_type" { diff --git a/variables.tf b/variables.tf index 47e44f30..9ea28be0 100644 --- a/variables.tf +++ b/variables.tf @@ -8,6 +8,7 @@ variable "allocated_storage" { variable "max_allocated_storage" { description = "Specifies the value for Storage Autoscaling" + default = 0 } variable "storage_type" { From 256c0afc7c991306182ee282ff3593155fb9e745 Mon Sep 17 00:00:00 2001 From: Naren Date: Wed, 24 Jul 2019 15:47:36 +0800 Subject: [PATCH 3/3] feat(storage): added support for max_allocated_storage --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ab504776..9aef845b 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ module "db" { | Name | Description | Type | Default | Required | |------|-------------|:----:|:-----:|:-----:| | allocated\_storage | The allocated storage in gigabytes | string | n/a | yes | -| max\_allocated\_storage | Specifies the maximum value for storage autoscaling | string | `""` | no | +| max\_allocated\_storage | Specifies the maximum value for storage autoscaling | string | `"0"` | no | | allow\_major\_version\_upgrade | Indicates that major version upgrades are allowed. Changing this parameter does not result in an outage and the change is asynchronously applied as soon as possible | string | `"false"` | no | | apply\_immediately | Specifies whether any database modifications are applied immediately, or during the next maintenance window | string | `"false"` | no | | auto\_minor\_version\_upgrade | Indicates that minor engine upgrades will be applied automatically to the DB instance during the maintenance window | string | `"true"` | no |