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

cloud storage log export for chronicle #16

Merged
merged 2 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ No requirements.
| Name | Source | Version |
|------|--------|---------|
| <a name="module_application_folder"></a> [application\_folder](#module\_application\_folder) | github.com/Coalfire-CF/terraform-google-folder | n/a |
| <a name="module_destination"></a> [destination](#module\_destination) | github.com/Coalfire-CF/terraform-google-log-export/modules/pubsub | n/a |
| <a name="module_destination"></a> [destination](#module\_destination) | github.com/Coalfire-CF/terraform-google-log-export//modules/storage | v1.0.4 |
| <a name="module_gcs"></a> [gcs](#module\_gcs) | github.com/Coalfire-CF/terraform-google-cloud-storage | n/a |
| <a name="module_kms"></a> [kms](#module\_kms) | github.com/Coalfire-CF/terraform-google-kms | n/a |
| <a name="module_log_export"></a> [log\_export](#module\_log\_export) | github.com/Coalfire-CF/terraform-google-log-export | n/a |
| <a name="module_log_export"></a> [log\_export](#module\_log\_export) | github.com/Coalfire-CF/terraform-google-log-export | v1.0.4 |
| <a name="module_management_folder"></a> [management\_folder](#module\_management\_folder) | github.com/Coalfire-CF/terraform-google-folder | n/a |
| <a name="module_management_project"></a> [management\_project](#module\_management\_project) | github.com/Coalfire-CF/terraform-google-project | n/a |
| <a name="module_networking_folder"></a> [networking\_folder](#module\_networking\_folder) | github.com/Coalfire-CF/terraform-google-folder | n/a |
Expand Down Expand Up @@ -97,7 +97,7 @@ No requirements.
| <a name="input_billing_account"></a> [billing\_account](#input\_billing\_account) | The ID of the billing account to associate projects with. | `string` | n/a | yes |
| <a name="input_boolean_type_organization_policies"></a> [boolean\_type\_organization\_policies](#input\_boolean\_type\_organization\_policies) | List of boolean type org policies to apply. | `list(string)` | <pre>[<br> "compute.disableNonFIPSMachineTypes",<br> "compute.skipDefaultNetworkCreation",<br> "sql.restrictPublicIp",<br> "storage.publicAccessPrevention"<br>]</pre> | no |
| <a name="input_bucket_prefix"></a> [bucket\_prefix](#input\_bucket\_prefix) | Prefix for buckets. | `string` | `"bkt"` | no |
| <a name="input_create_log_sinks"></a> [create\_log\_sinks](#input\_create\_log\_sinks) | Whether or not to create log sinks | `bool` | `true` | no |
| <a name="input_create_log_export"></a> [create\_log\_export](#input\_create\_log\_export) | Whether or not to create log export | `bool` | `true` | no |
| <a name="input_folder_prefix"></a> [folder\_prefix](#input\_folder\_prefix) | Prefix for folders. | `string` | `"fldr"` | no |
| <a name="input_group_org_admins"></a> [group\_org\_admins](#input\_group\_org\_admins) | Google Group for GCP Organization Administrators. | `string` | n/a | yes |
| <a name="input_keyring_prefix"></a> [keyring\_prefix](#input\_keyring\_prefix) | Prefix for key rings. | `string` | `"kr"` | no |
Expand Down
17 changes: 8 additions & 9 deletions log-sinks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ resource "random_string" "suffix_sink" {
}

module "log_export" {
source = "github.com/Coalfire-CF/terraform-google-log-export"
source = "github.com/Coalfire-CF/terraform-google-log-export?ref=v1.0.4"

count = var.create_log_sinks ? 1 : 0
count = var.create_log_export ? 1 : 0

destination_uri = module.destination[0].destination_uri
filter = var.log_filter
Expand All @@ -28,18 +28,17 @@ module "log_export" {
}

module "destination" {
source = "github.com/Coalfire-CF/terraform-google-log-export/modules/pubsub"
source = "github.com/Coalfire-CF/terraform-google-log-export//modules/storage?ref=v1.0.4"

count = var.create_log_sinks ? 1 : 0
count = var.create_log_export ? 1 : 0

project_id = module.management_project.project_id
topic_name = "${var.topic_prefix}-org-logs-${random_string.suffix_sink.result}"
storage_bucket_name = "${var.bucket_prefix}-org-logs-${random_string.suffix_sink.result}"
log_sink_writer_identity = module.log_export[0].writer_identity
create_subscriber = true
kms_key_name = module.kms.keys["pub-sub"]
location = var.region
kms_key_name = module.kms.keys["cloud-storage"]

depends_on = [
time_sleep.wait,
google_kms_crypto_key_iam_member.ps_account
time_sleep.wait
]
}
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ variable "topic_prefix" {
default = "ps"
}

variable "create_log_sinks" {
description = "Whether or not to create log sinks"
variable "create_log_export" {
description = "Whether or not to create log export"
type = bool
default = true
}
Expand Down
Loading