Skip to content

Commit

Permalink
added variable maintenance_version
Browse files Browse the repository at this point in the history
  • Loading branch information
imrannayer committed Nov 1, 2024
1 parent a7eaff3 commit 01deb98
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions modules/mssql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ resource "google_sql_database_instance" "default" {
project = var.project_id
name = var.random_instance_name ? "${var.name}-${random_id.suffix[0].hex}" : var.name
database_version = var.database_version
maintenance_version = var.maintenance_version
region = var.region
encryption_key_name = var.encryption_key_name
root_password = coalesce(var.root_password, random_password.root-password.result)
Expand Down
5 changes: 5 additions & 0 deletions modules/mssql/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ variable "database_version" {
default = "SQLSERVER_2017_STANDARD"
}

variable "maintenance_version" {
description = "The current software version on the instance. This attribute can not be set during creation. Refer to available_maintenance_versions attribute to see what maintenance_version are available for upgrade. When this attribute gets updated, it will cause an instance restart. Setting a maintenance_version value that is older than the current one on the instance will be ignored"
type = string
}

// required
variable "region" {
type = string
Expand Down
1 change: 1 addition & 0 deletions modules/mysql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ resource "google_sql_database_instance" "default" {
project = var.project_id
name = local.master_instance_name
database_version = var.database_version
maintenance_version = var.maintenance_version
region = var.region
master_instance_name = var.master_instance_name
instance_type = var.instance_type
Expand Down
5 changes: 5 additions & 0 deletions modules/mysql/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ variable "database_version" {
type = string
}

variable "maintenance_version" {
description = "The current software version on the instance. This attribute can not be set during creation. Refer to available_maintenance_versions attribute to see what maintenance_version are available for upgrade. When this attribute gets updated, it will cause an instance restart. Setting a maintenance_version value that is older than the current one on the instance will be ignored"
type = string
}

// required
variable "region" {
description = "The region of the Cloud SQL resources"
Expand Down
1 change: 1 addition & 0 deletions modules/postgresql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ resource "google_sql_database_instance" "default" {
project = var.project_id
name = local.instance_name
database_version = can(regex("\\d", substr(var.database_version, 0, 1))) ? format("POSTGRES_%s", var.database_version) : replace(var.database_version, substr(var.database_version, 0, 8), "POSTGRES")
maintenance_version = var.maintenance_version
region = var.region
encryption_key_name = var.encryption_key_name
deletion_protection = var.deletion_protection
Expand Down
5 changes: 5 additions & 0 deletions modules/postgresql/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ variable "database_version" {
}
}

variable "maintenance_version" {
description = "The current software version on the instance. This attribute can not be set during creation. Refer to available_maintenance_versions attribute to see what maintenance_version are available for upgrade. When this attribute gets updated, it will cause an instance restart. Setting a maintenance_version value that is older than the current one on the instance will be ignored"
type = string
}

// required
variable "region" {
type = string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestPostgreSqlCrossRegionFailover(t *testing.T) {
assert.Equal(1, len(authNetworks), "Expected one auth network")

/// assert standard database settings
assert.Equal("POSTGRES_14", op.Get("databaseVersion").String(), "Expected POSTGRES_14 databaseVersion")
assert.Equal("POSTGRES_17", op.Get("databaseVersion").String(), "Expected POSTGRES_17 databaseVersion")
assert.Equal("SECOND_GEN", op.Get("backendType").String(), "Expected SECOND_GEN backendType")
assert.Equal("RUNNABLE", op.Get("state").String(), "Expected RUNNABLE state")
assert.Equal("us-central1", op.Get("region").String(), "Expected us-central1 region")
Expand Down

0 comments on commit 01deb98

Please # to comment.