feat(logging): Add Cloud Logging Saved Query resource#16182
feat(logging): Add Cloud Logging Saved Query resource#16182roaks3 merged 6 commits intoGoogleCloudPlatform:mainfrom
Conversation
|
Hello! I am a robot. Tests will require approval from a repository maintainer to run. Googlers: For automatic test runs see go/terraform-auto-test-runs. @roaks3, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look. You can help make sure that review is quick by doing a self-review and by running impacted tests locally. |
There was a problem hiding this comment.
LGTM, nice work!
Ran tests locally:
sh -c "'/Users/ramon/go/src/github.com/hashicorp/terraform-provider-google/scripts/gofmtcheck.sh'"
==> Checking that code complies with gofmt requirements...
go vet
TF_ACC_REFRESH_AFTER_APPLY=1 TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test ./google/services/logging -v -run=TestAccLoggingSavedQuery_ -timeout 240m -ldflags="-X=github.com/hashicorp/terraform-provider-google/version.ProviderVersion=acc"
=== RUN TestAccLoggingSavedQuery_loggingSavedQueryBasicExample
=== PAUSE TestAccLoggingSavedQuery_loggingSavedQueryBasicExample
=== RUN TestAccLoggingSavedQuery_loggingSavedQueryPrivateExample
=== PAUSE TestAccLoggingSavedQuery_loggingSavedQueryPrivateExample
=== RUN TestAccLoggingSavedQuery_loggingSavedQuerySummaryFieldsExample
=== PAUSE TestAccLoggingSavedQuery_loggingSavedQuerySummaryFieldsExample
=== RUN TestAccLoggingSavedQuery_loggingSavedQuerySqlBasicExample
=== PAUSE TestAccLoggingSavedQuery_loggingSavedQuerySqlBasicExample
=== RUN TestAccLoggingSavedQuery_update
=== PAUSE TestAccLoggingSavedQuery_update
=== CONT TestAccLoggingSavedQuery_loggingSavedQueryBasicExample
=== CONT TestAccLoggingSavedQuery_loggingSavedQuerySqlBasicExample
=== CONT TestAccLoggingSavedQuery_loggingSavedQuerySummaryFieldsExample
=== CONT TestAccLoggingSavedQuery_update
=== CONT TestAccLoggingSavedQuery_loggingSavedQueryPrivateExample
--- PASS: TestAccLoggingSavedQuery_loggingSavedQuerySummaryFieldsExample (7.36s)
--- PASS: TestAccLoggingSavedQuery_loggingSavedQueryBasicExample (7.87s)
--- PASS: TestAccLoggingSavedQuery_loggingSavedQueryPrivateExample (8.01s)
--- PASS: TestAccLoggingSavedQuery_loggingSavedQuerySqlBasicExample (8.17s)
--- PASS: TestAccLoggingSavedQuery_update (12.32s)
PASS
ok github.com/hashicorp/terraform-provider-google/google/services/logging 13.990s…aved_query_test.go Co-authored-by: Ramon Vermeulen <[email protected]>
|
@roaks3 This PR has been waiting for review for 3 weekdays. Please take a look! Use the label |
roaks3
left a comment
There was a problem hiding this comment.
Sorry for the delay. I found some very minor things to comment on, but overall LGTM
| - name: 'logging_saved_query_private' | ||
| primary_resource_id: 'saved_query' | ||
| vars: | ||
| logging_saved_query_name: 'my-saved-query' |
There was a problem hiding this comment.
Nit: It can be helpful to name these in a way that correlates to the test, particularly if they ever have issues being cleaned up (ie. my-saved-query-private, etc.).
| description: | | ||
| Characters will be counted from the start of the string. | ||
| conflicts: | ||
| - 'summaryFieldEnd' |
There was a problem hiding this comment.
Do you know if this works? I believe, at least at one point, that this needed to be an absolute name, like loggingQuery.0.summaryFieldEnd.
| "google.golang.org/api/googleapi" | ||
| ) | ||
|
|
||
| var ( |
There was a problem hiding this comment.
Hmm, you might be able to remove this block? I haven't seen it before, but guessing this is generated now to support imports that may or may not be used (and for handwritten tests I'd assume you don't need it).
There was a problem hiding this comment.
Done, thanks. Is indeed part of the generated tests.
| display_name = "My Saved Query" | ||
| parent = "projects/%{project}" | ||
| location = "global" | ||
| description = "A saved query" |
There was a problem hiding this comment.
Nit: Could remove description from one of these tests, to test it's optionality. It looks like it is specified in all tests currently.
There was a problem hiding this comment.
Created a new test in SavedQuery.yaml that creates it without a description. I hope that's ok.
|
@roaks3 I implemented your feedback. Should be ready for re-review now. |
roaks3
left a comment
There was a problem hiding this comment.
One last item I missed, otherwise LGTM and we should be able to merge.
I'll wait to re-run tests until the copyright is added.
| @@ -0,0 +1,158 @@ | |||
| --- | |||
There was a problem hiding this comment.
Sorry, missed this before. I think you need to include the Google copyright that can be found in most other yaml files.
|
Hi @roaks3, Thanks for the review. I've added the copyright as an exact copy from 1 of the other yaml files. I did notice, however, that the copyright year is 2024, so it might make sense if this is updated to 2026 at some point? |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Missing test reportYour PR includes resource fields which are not covered by any test. Resource: resource "google_logging_saved_query" "primary" {
logging_query {
summary_field_end = # value needed
}
}
|
Tests analyticsTotal tests: 83 Click here to see the affected service packages
Action takenFound 6 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
|
🟢 Tests passed during RECORDING mode: 🟢 No issues found for passed tests after REPLAYING rerun. 🟢 All tests passed! |
c790ddb
Co-authored-by: Ramon Vermeulen <[email protected]>
…tform#16182) Co-authored-by: Ramon Vermeulen <[email protected]>
…tform#16182) Co-authored-by: Ramon Vermeulen <[email protected]>
…tform#16182) Co-authored-by: Ramon Vermeulen <[email protected]>

This PR adds a resource for Cloud Logging Saved Queries, which can be used for both Logging Saved Queries and Log Analytics Saved Queries.
Fixes hashicorp/terraform-provider-google#18023
Release Note Template for Downstream PRs (will be copied)
See Write release notes for guidance.