Skip to content

Commit 0fe2605

Browse files
authored
feat: add cmek support in composer_env_v2 (#113)
1 parent d045902 commit 0fe2605

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

modules/create_environment_v2/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ module "simple-composer-environment" {
6969
| environment\_size | The environment size controls the performance parameters of the managed Cloud Composer infrastructure that includes the Airflow database. Values for environment size are: `ENVIRONMENT_SIZE_SMALL`, `ENVIRONMENT_SIZE_MEDIUM`, and `ENVIRONMENT_SIZE_LARGE`. | `string` | `"ENVIRONMENT_SIZE_MEDIUM"` | no |
7070
| grant\_sa\_agent\_permission | Cloud Composer relies on Workload Identity as Google API authentication mechanism for Airflow. | `bool` | `true` | no |
7171
| image\_version | The version of the aiflow running in the cloud composer environment. | `string` | `"composer-2.5.0-airflow-2.6.3"` | no |
72+
| kms\_key\_name | Customer-managed Encryption Key fully qualified resource name, i.e. projects/project-id/locations/location/keyRings/keyring/cryptoKeys/key. | `string` | `null` | no |
7273
| labels | The resource labels (a map of key/value pairs) to be applied to the Cloud Composer. | `map(string)` | `{}` | no |
7374
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `null` | no |
7475
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `null` | no |

modules/create_environment_v2/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,13 @@ resource "google_composer_environment" "composer_env" {
199199
}
200200
}
201201

202+
dynamic "encryption_config" {
203+
for_each = var.kms_key_name != null ? ["encryption_config"] : []
204+
content {
205+
kms_key_name = var.kms_key_name
206+
}
207+
}
208+
202209
}
203210

204211
depends_on = [google_project_iam_member.composer_agent_service_account]

modules/create_environment_v2/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,3 +282,9 @@ variable "web_server_network_access_control" {
282282
default = null
283283
description = "The network-level access control policy for the Airflow web server. If unspecified, no network-level access restrictions are applied"
284284
}
285+
286+
variable "kms_key_name" {
287+
description = "Customer-managed Encryption Key fully qualified resource name, i.e. projects/project-id/locations/location/keyRings/keyring/cryptoKeys/key."
288+
type = string
289+
default = null
290+
}

0 commit comments

Comments
 (0)