Skip to content

Commit 2bd0f41

Browse files
authored
feat: Add encryption_key_name variable for MS SQL module (#132)
1 parent e6a31ca commit 2bd0f41

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

examples/mssql-public/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
provider "google-beta" {
18-
version = "~> 3.1.0"
18+
version = ">= 3.1.0, <4.0.0"
1919
region = var.region
2020
}
2121

modules/mssql/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ The following dependency must be available for SQL Server module:
2424
| disk\_autoresize | Configuration to increase storage size. | bool | `"true"` | no |
2525
| disk\_size | The disk size for the master instance. | string | `"10"` | no |
2626
| disk\_type | The disk type for the master instance. | string | `"PD_SSD"` | no |
27+
| encryption\_key\_name | The full path to the encryption key used for the CMEK disk encryption | string | `"null"` | no |
2728
| ip\_configuration | The ip configuration for the master instances. | object | `<map>` | no |
2829
| maintenance\_window\_day | The day of week (1-7) for the master instance maintenance. | number | `"1"` | no |
2930
| maintenance\_window\_hour | The hour of day (0-23) maintenance window for the master instance maintenance. | number | `"23"` | no |

modules/mssql/main.tf

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ resource "random_password" "root-password" {
3838
}
3939

4040
resource "google_sql_database_instance" "default" {
41-
provider = google-beta
42-
project = var.project_id
43-
name = var.random_instance_name ? "${var.name}-${random_id.suffix[0].hex}" : var.name
44-
database_version = var.database_version
45-
region = var.region
46-
root_password = coalesce(var.root_password, random_password.root-password.result)
41+
provider = google-beta
42+
project = var.project_id
43+
name = var.random_instance_name ? "${var.name}-${random_id.suffix[0].hex}" : var.name
44+
database_version = var.database_version
45+
region = var.region
46+
encryption_key_name = var.encryption_key_name
47+
root_password = coalesce(var.root_password, random_password.root-password.result)
4748

4849
settings {
4950
tier = var.tier

modules/mssql/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,9 @@ variable "module_depends_on" {
224224
type = list(any)
225225
default = []
226226
}
227+
228+
variable "encryption_key_name" {
229+
description = "The full path to the encryption key used for the CMEK disk encryption"
230+
type = string
231+
default = null
232+
}

modules/mssql/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
terraform {
1818
required_version = ">= 0.12"
1919
required_providers {
20-
google-beta = ">= 3.1.0"
20+
google-beta = ">= 3.10.0, <4.0.0"
2121
}
2222
}

0 commit comments

Comments
 (0)