Skip to content

Commit 402ba4e

Browse files
authored
Merge pull request #165 from marko7460/database_encryption
Database encryption
2 parents ba6d0b4 + b294685 commit 402ba4e

File tree

11 files changed

+61
-1
lines changed

11 files changed

+61
-1
lines changed

autogen/cluster_regional.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ resource "google_container_cluster" "primary" {
121121
}
122122
{% endif %}
123123
remove_default_node_pool = "${var.remove_default_node_pool}"
124+
{% if beta_cluster %}
125+
database_encryption = ["${var.database_encryption}"]
126+
{% endif %}
124127
}
125128

126129
/******************************************

autogen/cluster_zonal.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ resource "google_container_cluster" "zonal_primary" {
121121
}
122122
{% endif %}
123123
remove_default_node_pool = "${var.remove_default_node_pool}"
124+
{% if beta_cluster %}
125+
database_encryption = ["${var.database_encryption}"]
126+
{% endif %}
124127
}
125128

126129
/******************************************

autogen/variables.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,21 @@ variable "cloudrun" {
284284
description = "(Beta) Enable CloudRun addon"
285285
default = false
286286
}
287+
288+
variable "database_encryption" {
289+
description = <<EOF
290+
Application-layer Secrets Encryption settings. Example:
291+
database_encryption = [{
292+
state = "ENCRYPTED",
293+
key_name = "projects/my-project/locations/global/keyRings/my-ring/cryptoKeys/my-key"
294+
}]
295+
EOF
296+
type = "list"
297+
default = [{
298+
state = "DECRYPTED"
299+
key_name = ""
300+
}]
301+
}
287302
{% endif %}
288303

289304
variable "basic_auth_username" {

modules/beta-private-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
124124
| basic\_auth\_password | The password to be used with Basic Authentication. | string | `""` | no |
125125
| basic\_auth\_username | The username to be used with Basic Authentication. An empty value will disable Basic Authentication, which is the recommended configuration. | string | `""` | no |
126126
| cloudrun | (Beta) Enable CloudRun addon | string | `"false"` | no |
127+
| database\_encryption | Application-layer Secrets Encryption settings. Example: database_encryption = [{ state = "ENCRYPTED", key_name = "projects/my-project/locations/global/keyRings/my-ring/cryptoKeys/my-key" }] | list | `<list>` | no |
127128
| deploy\_using\_private\_endpoint | (Beta) A toggle for Terraform and kubectl to connect to the master's internal IP address during deployment. | string | `"false"` | no |
128129
| description | The description of the cluster | string | `""` | no |
129130
| disable\_legacy\_metadata\_endpoints | Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated. | string | `"true"` | no |

modules/beta-private-cluster/cluster_regional.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ resource "google_container_cluster" "primary" {
115115
master_ipv4_cidr_block = "${var.master_ipv4_cidr_block}"
116116
}
117117
remove_default_node_pool = "${var.remove_default_node_pool}"
118+
database_encryption = ["${var.database_encryption}"]
118119
}
119120

120121
/******************************************

modules/beta-private-cluster/cluster_zonal.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ resource "google_container_cluster" "zonal_primary" {
115115
master_ipv4_cidr_block = "${var.master_ipv4_cidr_block}"
116116
}
117117
remove_default_node_pool = "${var.remove_default_node_pool}"
118+
database_encryption = ["${var.database_encryption}"]
118119
}
119120

120121
/******************************************

modules/beta-private-cluster/variables.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,23 @@ variable "cloudrun" {
280280
default = false
281281
}
282282

283+
variable "database_encryption" {
284+
description = <<EOF
285+
Application-layer Secrets Encryption settings. Example:
286+
database_encryption = [{
287+
state = "ENCRYPTED",
288+
key_name = "projects/my-project/locations/global/keyRings/my-ring/cryptoKeys/my-key"
289+
}]
290+
EOF
291+
292+
type = "list"
293+
294+
default = [{
295+
state = "DECRYPTED"
296+
key_name = ""
297+
}]
298+
}
299+
283300
variable "basic_auth_username" {
284301
description = "The username to be used with Basic Authentication. An empty value will disable Basic Authentication, which is the recommended configuration."
285302
default = ""

modules/beta-public-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
119119
| basic\_auth\_password | The password to be used with Basic Authentication. | string | `""` | no |
120120
| basic\_auth\_username | The username to be used with Basic Authentication. An empty value will disable Basic Authentication, which is the recommended configuration. | string | `""` | no |
121121
| cloudrun | (Beta) Enable CloudRun addon | string | `"false"` | no |
122+
| database\_encryption | Application-layer Secrets Encryption settings. Example: database_encryption = [{ state = "ENCRYPTED", key_name = "projects/my-project/locations/global/keyRings/my-ring/cryptoKeys/my-key" }] | list | `<list>` | no |
122123
| description | The description of the cluster | string | `""` | no |
123124
| disable\_legacy\_metadata\_endpoints | Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated. | string | `"true"` | no |
124125
| horizontal\_pod\_autoscaling | Enable horizontal pod autoscaling addon | string | `"true"` | no |

modules/beta-public-cluster/cluster_regional.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ resource "google_container_cluster" "primary" {
108108
}
109109
}
110110
remove_default_node_pool = "${var.remove_default_node_pool}"
111+
database_encryption = ["${var.database_encryption}"]
111112
}
112113

113114
/******************************************

modules/beta-public-cluster/cluster_zonal.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ resource "google_container_cluster" "zonal_primary" {
108108
}
109109
}
110110
remove_default_node_pool = "${var.remove_default_node_pool}"
111+
database_encryption = ["${var.database_encryption}"]
111112
}
112113

113114
/******************************************

modules/beta-public-cluster/variables.tf

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ variable "service_account" {
237237
default = "create"
238238
}
239239

240-
241240
variable "istio" {
242241
description = "(Beta) Enable Istio addon"
243242
default = false
@@ -248,6 +247,23 @@ variable "cloudrun" {
248247
default = false
249248
}
250249

250+
variable "database_encryption" {
251+
description = <<EOF
252+
Application-layer Secrets Encryption settings. Example:
253+
database_encryption = [{
254+
state = "ENCRYPTED",
255+
key_name = "projects/my-project/locations/global/keyRings/my-ring/cryptoKeys/my-key"
256+
}]
257+
EOF
258+
259+
type = "list"
260+
261+
default = [{
262+
state = "DECRYPTED"
263+
key_name = ""
264+
}]
265+
}
266+
251267
variable "basic_auth_username" {
252268
description = "The username to be used with Basic Authentication. An empty value will disable Basic Authentication, which is the recommended configuration."
253269
default = ""

0 commit comments

Comments
 (0)