-
Notifications
You must be signed in to change notification settings - Fork 787
Feat: enable kms centralized key usage tracking #1402
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
Changes from 5 commits
54bce3f
220fb2b
5cf9598
55a5027
a7c2c58
a7cfe47
31abfb7
ee8d466
1bbdc04
e0d03db
68081f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,18 @@ resource "google_organization_iam_member" "billing_viewer" { | |
| member = "group:${local.required_groups["billing_data_users"]}" | ||
| } | ||
|
|
||
| /****************************************** | ||
| Enable KMS Usage Tracking | ||
| *****************************************/ | ||
|
|
||
| resource "google_organization_iam_member" "kms_usage_tracking" { | ||
| count = var.enable_kms_key_usage_tracking ? 1 : 0 | ||
|
|
||
| org_id = local.org_id | ||
| role = "roles/cloudkms.orgServiceAgent" | ||
| member = "serviceAccount:service-org-${local.org_id}@gcp-sa-cloudkms.iam.gserviceaccount.com" | ||
| } | ||
|
|
||
| /****************************************** | ||
| Groups permissions | ||
| *****************************************/ | ||
|
|
@@ -154,3 +166,10 @@ resource "google_project_iam_member" "cai_monitoring_builder" { | |
| role = each.key | ||
| member = "serviceAccount:${google_service_account.cai_monitoring_builder[0].email}" | ||
| } | ||
|
|
||
| resource "google_organization_iam_member" "kms_protected_resources_viewer" { | ||
|
||
| count = var.gcp_groups.kms_protected_resources_viewer != null && var.enable_kms_key_usage_tracking ? 1 : 0 | ||
| org_id = local.org_id | ||
| role = "roles/cloudkms.protectedResourcesViewer" | ||
| member = "group:${var.gcp_groups.kms_protected_resources_viewer}" | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,12 @@ variable "enable_scc_resources_in_terraform" { | |
| default = false | ||
| } | ||
|
|
||
| variable "enable_kms_key_usage_tracking" { | ||
| description = "Enable KMS centralized key usage tracking system." | ||
| type = bool | ||
| default = false | ||
|
||
| } | ||
|
|
||
| variable "domains_to_allow" { | ||
| description = "The list of domains to allow users from in IAM. Used by Domain Restricted Sharing Organization Policy. Must include the domain of the organization you are deploying the foundation. To add other domains you must also grant access to these domains to the Terraform Service Account used in the deploy." | ||
| type = list(string) | ||
|
|
@@ -141,15 +147,17 @@ variable "gcp_groups" { | |
| network_viewer: Google Workspace or Cloud Identity group that members are part of the networking team and review network configurations. | ||
| scc_admin: Google Workspace or Cloud Identity group that can administer Security Command Center. | ||
| audit_viewer: Google Workspace or Cloud Identity group that members are part of an audit team and view audit logs in the logging project. | ||
| global_secrets_admin: Google Workspace or Cloud Identity group that members are responsible for putting secrets into Secrets Manage | ||
| global_secrets_admin: Google Workspace or Cloud Identity group that members are responsible for putting secrets into Secrets Management. | ||
| kms_protected_resources_viewer: Google Workspace or Cloud Identity group that can search for kms protected resources. | ||
| EOT | ||
| type = object({ | ||
| audit_viewer = optional(string, null) | ||
| security_reviewer = optional(string, null) | ||
| network_viewer = optional(string, null) | ||
| scc_admin = optional(string, null) | ||
| global_secrets_admin = optional(string, null) | ||
| kms_admin = optional(string, null) | ||
| audit_viewer = optional(string, null) | ||
| security_reviewer = optional(string, null) | ||
| network_viewer = optional(string, null) | ||
| scc_admin = optional(string, null) | ||
| global_secrets_admin = optional(string, null) | ||
| kms_admin = optional(string, null) | ||
| kms_protected_resources_viewer = optional(string, null) | ||
|
||
| }) | ||
| default = {} | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we will set
enable_kms_key_usagetracking to true, I recommend to also remove the extra directions from the readme. This helps keep the instructions more simple.The documentation on what the variable does is already auto-generated in the readme.md under envs/shared, so we don't need redundant text here to describe each variable.