Skip to content

Commit 2aead38

Browse files
add google_logging_project_sink to version 5 upgrade doc for #8779 (#8837) (#6201)
Signed-off-by: Modular Magician <[email protected]>
1 parent 62dea40 commit 2aead38

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

.changelog/8837.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
```release-note:none
2+
```

website/docs/guides/version_5_upgrade.html.markdown

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,3 +331,42 @@ If you were relying on accessing an individual flag by index (for example, `goog
331331
### `rule.rate_limit_options.encorce_on_key` no longer has default value
332332

333333
Previously, the default value for `rule.rate_limit_options.encorce_on_key` is "ALL", now this field no longer has a default value.
334+
335+
## Resource: `google_logging_project_sink`
336+
337+
### `unique_writer_identity` now defaults to `TRUE`
338+
339+
Previously, the default value of `unique_writer_identity` was `FALSE`. Now it will be `TRUE`.
340+
341+
This will change the behavior for new sinks created using the default value. Previously, all sinks created using the default value had a `writer_identity` of `serviceAccount:[email protected]`. Now sinks created using the default value will have a `writer_identity` that differs depending on the parent resource, for example: `serviceAccount:service-<PROJECT_NUMBER>@gcp-sa-logging.iam.gserviceaccount.com` for a project-level sink.
342+
343+
IAM permissions that were manually configured for `[email protected]` and `iam_bindings` that are hard-coded to use `[email protected]` will not properly apply permissions to the `writer_identity` of new sinks created using the default value. **If a sink is missing the proper permissions it will be successfully created but it will fail to export log data.**
344+
345+
Currently there are only two types of log sinks that populate `writer_identity` and can be created with `unique_writer_identity = false`. Only these types of sinks may be affected:
346+
* Sinks with a Cloud Pub/Sub topic `destination` for which the topic is in the same project as the sink.
347+
* Sinks for a BigQuery dataset `destination` for which the dataset is in the same project as the sink.
348+
349+
To ensure that proper permissions are in place for new sinks created using the default value, check that the related `iam_bindings` are configured and reference the sink's `writer_identity` property.
350+
351+
Here is an example of proper `iam_bindings`:
352+
353+
```hcl
354+
resource "google_logging_project_sink" "gcs-bucket-sink" {
355+
name = "my-gcs-bucket-sink"
356+
description = "Routes all admin activity logs to a GCS bucket"
357+
destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}"
358+
filter = "log_id(\"cloudaudit.googleapis.com/activity\")"
359+
# `unique_writer_identity is explicitly set to true here, but will now default to 'true'.
360+
unique_writer_identity = true
361+
}
362+
363+
# We must grant proper permissions for the log sink to access the GCS bucket.
364+
resource "google_project_iam_binding" "gcs-bucket-writer" {
365+
project = "your-project-id"
366+
role = "roles/storage.objectCreator"
367+
368+
members = [
369+
google_logging_project_sink.gcs-bucket-sink.writer_identity,
370+
]
371+
}
372+
```

0 commit comments

Comments
 (0)