-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add exclusions option for logging sink resources #7335
Conversation
Added as definedd in https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks#LogExclusion Log entries that match any of the exclusion filters will not be exported. If a log entry is matched by both filter and one of exclusion_filters it will not be exported.
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.
Thanks for adding this! I'm running the tests, but is there a reason to have disabled
be a string rather than a bool?
This will avoid unnecessary conversions and it is also defined as a boolean in the API client.
Having |
unique_writer_identity = false | ||
} | ||
|
||
resource "google_logging_project_bucket_config" "logbucket" { |
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.
Looks like this needs a project
field defined.
Getting this error: on config992620966/terraform_plugin_test.tf line 21, in resource "google_logging_project_bucket_config" "logbucket": 21: resource "google_logging_project_bucket_config" "logbucket" { The argument "project" is required, but no definition was found. --- FAIL: TestAccLoggingProjectSink_loggingbucket (2.32s)
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.
Sorry for this! I was running tests incorrectly locally and I thought they ran in CI. I have fixed this issue and a couple issues more.
stAccLoggingProjectSink_loggingbucket'
==> Checking source code against gofmt...
==> Checking that code complies with gofmt requirements...
go generate ./...
TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test ./google -v -run=TestAccLoggingProjectSink_loggingbucket -timeout 240m -ldflags="-X=github.com/hashicorp/terraform-provider-google/version.ProviderVersion=acc"
=== RUN TestAccLoggingProjectSink_loggingbucket
=== PAUSE TestAccLoggingProjectSink_loggingbucket
=== CONT TestAccLoggingProjectSink_loggingbucket
--- PASS: TestAccLoggingProjectSink_loggingbucket (9.01s)
PASS
ok github.com/hashicorp/terraform-provider-google/google 9.955s
This test resource does not createa a logging bucket, it just modifies its config, therefore it is not suitable for the test. For this test, the sink with exclusions will be tested directly with the _Default log bucket as we want to test the exclusions, which is enough.
I have fixed an issue with tests, where unnecessary |
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.
This looks great! Can you add documentation for these fields to the relevant resources?
For example here: https://github.com/hashicorp/terraform-provider-google/blob/master/website/docs/r/logging_project_sink.html.markdown
Awesome, thanks for the catch again. I have added documentation with an example. |
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.
Thanks for the contribution!
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Added as defined in https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks#LogExclusion
Log entries that match any of the exclusion filters will not be exported.
If a log entry is matched by both filters and one of exclusion_filters it will not be exported.
Affects to the following resources: