Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cmek support in composer_env_v2 #113

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/create_environment_v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ module "simple-composer-environment" {
| 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 |
| grant\_sa\_agent\_permission | Cloud Composer relies on Workload Identity as Google API authentication mechanism for Airflow. | `bool` | `true` | no |
| image\_version | The version of the aiflow running in the cloud composer environment. | `string` | `"composer-2.5.0-airflow-2.6.3"` | no |
| 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 |
| labels | The resource labels (a map of key/value pairs) to be applied to the Cloud Composer. | `map(string)` | `{}` | no |
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `null` | no |
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `null` | no |
Expand Down
10 changes: 10 additions & 0 deletions modules/create_environment_v2/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,16 @@ resource "google_composer_environment" "composer_env" {
}
}

dynamic "encryption_config" {
for_each = var.kms_key_name != null ? [
Sarapuce marked this conversation as resolved.
Show resolved Hide resolved
{
kms_key_name = var.kms_key_name
}] : []
content {
kms_key_name = encryption_config.value["kms_key_name"]
}
}

}

depends_on = [google_project_iam_member.composer_agent_service_account]
Expand Down
6 changes: 6 additions & 0 deletions modules/create_environment_v2/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,9 @@ variable "web_server_network_access_control" {
default = null
description = "The network-level access control policy for the Airflow web server. If unspecified, no network-level access restrictions are applied"
}

variable "kms_key_name" {
description = "Customer-managed Encryption Key fully qualified resource name, i.e. projects/project-id/locations/location/keyRings/keyring/cryptoKeys/key."
type = string
default = null
}