Skip to content

Commit cf87a9d

Browse files
cromaniucCezar Romaniuc
andauthored
feat: Added "encryption_key_name" variable for postgresql and mysql modules. (#101)
* Added "encryption_key_name" variable for postgresql and mysql modules and "availability_type" variable for mysql * Added "encryption_key_name" variable for postgresql and mysql modules and "availability_type" variable for mysql * Added "encryption_key_name" variable for postgresql and mysql modules and "availability_type" variable for mysql Co-authored-by: Cezar Romaniuc <[email protected]>
1 parent 5138365 commit cf87a9d

File tree

6 files changed

+27
-8
lines changed

6 files changed

+27
-8
lines changed

modules/mysql/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
| disk\_autoresize | Configuration to increase storage size | bool | `"true"` | no |
2222
| disk\_size | The disk size for the master instance | number | `"10"` | no |
2323
| disk\_type | The disk type for the master instance. | string | `"PD_SSD"` | no |
24+
| encryption\_key\_name | The full path to the encryption key used for the CMEK disk encryption | string | `"null"` | no |
2425
| failover\_replica | Specify true if the failover instance is required | bool | `"false"` | no |
2526
| failover\_replica\_activation\_policy | The activation policy for the failover replica instance. Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`. | string | `"ALWAYS"` | no |
2627
| failover\_replica\_configuration | The replica configuration for the failover replica instance. In order to create a failover instance, need to specify this argument. | object | `<map>` | no |

modules/mysql/main.tf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ locals {
2929
}
3030

3131
resource "google_sql_database_instance" "default" {
32-
project = var.project_id
33-
name = var.name
34-
database_version = var.database_version
35-
region = var.region
32+
provider = google-beta
33+
project = var.project_id
34+
name = var.name
35+
database_version = var.database_version
36+
region = var.region
37+
encryption_key_name = var.encryption_key_name
3638

3739
settings {
3840
tier = var.tier

modules/mysql/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,12 @@ variable "delete_timeout" {
528528
default = "10m"
529529
}
530530

531+
variable "encryption_key_name" {
532+
description = "The full path to the encryption key used for the CMEK disk encryption"
533+
type = string
534+
default = null
535+
}
536+
531537
variable "module_depends_on" {
532538
description = "List of modules or resources this module depends on."
533539
type = list(any)

modules/postgresql/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
| disk\_autoresize | Configuration to increase storage size. | bool | `"true"` | no |
2222
| disk\_size | The disk size for the master instance. | string | `"10"` | no |
2323
| disk\_type | The disk type for the master instance. | string | `"PD_SSD"` | no |
24+
| encryption\_key\_name | The full path to the encryption key used for the CMEK disk encryption | string | `"null"` | no |
2425
| ip\_configuration | The ip configuration for the master instances. | object | `<map>` | no |
2526
| maintenance\_window\_day | The day of week (1-7) for the master instance maintenance. | number | `"1"` | no |
2627
| maintenance\_window\_hour | The hour of day (0-23) maintenance window for the master instance maintenance. | number | `"23"` | no |

modules/postgresql/main.tf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ locals {
2424
}
2525

2626
resource "google_sql_database_instance" "default" {
27-
project = var.project_id
28-
name = var.name
29-
database_version = var.database_version
30-
region = var.region
27+
provider = google-beta
28+
project = var.project_id
29+
name = var.name
30+
database_version = var.database_version
31+
region = var.region
32+
encryption_key_name = var.encryption_key_name
3133

3234
settings {
3335
tier = var.tier

modules/postgresql/variables.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,15 @@ variable "delete_timeout" {
358358
default = "10m"
359359
}
360360

361+
variable "encryption_key_name" {
362+
description = "The full path to the encryption key used for the CMEK disk encryption"
363+
type = string
364+
default = null
365+
}
366+
361367
variable "module_depends_on" {
362368
description = "List of modules or resources this module depends on."
363369
type = list(any)
364370
default = []
365371
}
372+

0 commit comments

Comments
 (0)