-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: config application-level encryption for fl
- Loading branch information
1 parent
a8e71cf
commit f5af3f8
Showing
17 changed files
with
251 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...ke/base/use-cases/federated-learning/terraform/key_management_service/.terraform.lock.hcl
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...e/base/use-cases/federated-learning/terraform/key_management_service/_cluster.auto.tfvars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../_shared_config/cluster.auto.tfvars |
1 change: 1 addition & 0 deletions
1
.../base/use-cases/federated-learning/terraform/key_management_service/_cluster_variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../_shared_config/cluster_variables.tf |
1 change: 1 addition & 0 deletions
1
.../base/use-cases/federated-learning/terraform/key_management_service/_platform.auto.tfvars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../_shared_config/platform.auto.tfvars |
1 change: 1 addition & 0 deletions
1
...base/use-cases/federated-learning/terraform/key_management_service/_platform_variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../_shared_config/platform_variables.tf |
1 change: 1 addition & 0 deletions
1
...base/use-cases/federated-learning/terraform/key_management_service/_terraform.auto.tfvars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../_shared_config/terraform.auto.tfvars |
1 change: 1 addition & 0 deletions
1
...ase/use-cases/federated-learning/terraform/key_management_service/_terraform_variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../_shared_config/terraform_variables.tf |
1 change: 1 addition & 0 deletions
1
...es/federated-learning/terraform/key_management_service/_uc_federated_learning.auto.tfvars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../_shared_config/uc_federated_learning.auto.tfvars |
1 change: 1 addition & 0 deletions
1
...s/federated-learning/terraform/key_management_service/_uc_federated_learning_variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../_shared_config/uc_federated_learning_variables.tf |
20 changes: 20 additions & 0 deletions
20
platforms/gke/base/use-cases/federated-learning/terraform/key_management_service/backend.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2024 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
terraform { | ||
backend "gcs" { | ||
bucket = "" | ||
prefix = "terraform/federated-learning/key-management-service" | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
platforms/gke/base/use-cases/federated-learning/terraform/key_management_service/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Copyright 2024 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# KeyRings cannot be deleted; append a random suffix to the keyring name | ||
resource "random_id" "keyring_suffix" { | ||
byte_length = 4 | ||
} | ||
|
||
resource "google_kms_key_ring" "key_ring" { | ||
name = "${var.platform_name}-keyring-${random_id.keyring_suffix.hex}" | ||
project = google_project_service.cloudkms_googleapis_com.project | ||
location = var.cluster_region | ||
} | ||
|
||
resource "google_kms_crypto_key" "cluster_secrects_key" { | ||
name = "clusterSecretsKey" | ||
key_ring = google_kms_key_ring.key_ring.id | ||
rotation_period = "7776000s" | ||
purpose = "ENCRYPT_DECRYPT" | ||
import_only = false | ||
skip_initial_version_creation = false | ||
|
||
lifecycle { | ||
prevent_destroy = false | ||
} | ||
|
||
version_template { | ||
# Ref: https://cloud.google.com/kms/docs/reference/rest/v1/CryptoKeyVersionAlgorithm | ||
algorithm = "GOOGLE_SYMMETRIC_ENCRYPTION" | ||
|
||
# Ref: https://cloud.google.com/kms/docs/reference/rest/v1/ProtectionLevel | ||
protection_level = "SOFTWARE" | ||
} | ||
} | ||
|
||
resource "google_kms_crypto_key_iam_binding" "cluster_secrets_decrypters" { | ||
role = "roles/cloudkms.cryptoKeyDecrypter" | ||
crypto_key_id = google_kms_crypto_key.cluster_secrects_key.id | ||
members = [local.gke_robot_service_account_iam_email] | ||
} | ||
|
||
resource "google_kms_crypto_key_iam_binding" "cluster_secrets_encrypters" { | ||
role = "roles/cloudkms.cryptoKeyEncrypter" | ||
crypto_key_id = google_kms_crypto_key.cluster_secrects_key.id | ||
members = [local.gke_robot_service_account_iam_email] | ||
} |
18 changes: 18 additions & 0 deletions
18
platforms/gke/base/use-cases/federated-learning/terraform/key_management_service/output.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright 2024 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
output "cluster_database_encryption_key_id" { | ||
description = "Id of the cluster database encryption key" | ||
value = google_kms_crypto_key.cluster_secrects_key.id | ||
} |
24 changes: 24 additions & 0 deletions
24
platforms/gke/base/use-cases/federated-learning/terraform/key_management_service/project.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright 2024 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
data "google_project" "default" { | ||
project_id = var.cluster_project_id | ||
} | ||
|
||
resource "google_project_service" "cloudkms_googleapis_com" { | ||
disable_dependent_services = false | ||
disable_on_destroy = false | ||
project = data.google_project.default.project_id | ||
service = "cloudkms.googleapis.com" | ||
} |
36 changes: 36 additions & 0 deletions
36
platforms/gke/base/use-cases/federated-learning/terraform/key_management_service/versions.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Copyright 2024 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
terraform { | ||
required_version = ">= 1.5.7" | ||
|
||
required_providers { | ||
google = { | ||
source = "hashicorp/google" | ||
version = "6.12.0" | ||
} | ||
local = { | ||
source = "hashicorp/local" | ||
version = "2.5.2" | ||
} | ||
random = { | ||
source = "hashicorp/random" | ||
version = "3.6.3" | ||
} | ||
} | ||
|
||
provider_meta "google" { | ||
module_name = "cloud-solutions/acp_fl_kms_deploy-v1" | ||
} | ||
} |