New resource: google_cloud_trace_sink (beta) - #18330
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Googlers: For automatic test runs see go/terraform-auto-test-runs. @slevenick, 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. |
7012d72 to
a21b849
Compare
| @@ -0,0 +1,21 @@ | |||
| # Copyright 2025 Google Inc. | |||
| @@ -0,0 +1,92 @@ | |||
| # Copyright 2025 Google Inc. | |||
| create_url: projects/{{project}}/traceSinks | ||
| update_verb: PATCH | ||
| update_mask: true | ||
| id_format: '{{name}}' |
There was a problem hiding this comment.
I think this should match the import_format
| api: 'https://cloud.google.com/trace/docs/reference/rest/v2beta1/projects.traceSinks' | ||
| min_version: beta | ||
| base_url: projects/{{project}}/traceSinks | ||
| self_link: '{{name}}' |
| } | ||
| d.SetId(d.Get("name").(string)) | ||
|
|
||
| // The import id carries the project number, but the project field is normally |
There was a problem hiding this comment.
Prefer not doing this conversion
| @@ -0,0 +1,34 @@ | |||
| // The Cloud Trace API requires the sink's canonical resource name in the request | |||
There was a problem hiding this comment.
Prefer not doing this conversion
It messes with quota and cross-API boundaries in a way that's not pleasant to deal with
|
@slevenick This PR has been waiting for review for 3 weekdays. Please take a look! Use the label |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 01f710b: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode Action takenFound 11 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
View the replaying VCR build log Step 2: Recording Mode
Caution Issues requiring attention before PR completion 🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details. Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer. View the recording VCR build log or the debug logs folder for detailed results. @DrFaust92, @slevenick VCR tests complete for 01f710b! |
|
@GoogleCloudPlatform/terraform-team @slevenick This PR has been waiting for review for 1 week. Please take a look! Use the label |
|
Rebased on latest main and re-ran CI — the earlier Review feedback is addressed:
The remaining encoder just assembles |
|
@GoogleCloudPlatform/terraform-team @slevenick This PR has been waiting for review for 2 weeks. Please take a look! Use the label |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit abb2a42: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode Action takenFound 9 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
View the replaying VCR build log Step 2: Recording Mode
Caution Issues requiring attention before PR completion 🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details. 🔴 Replaying Rerun Failed: Some tests failed due to non-determinism when VCR replayed the response. See the table above for details. Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer. View the recording VCR build log or the debug logs folder for detailed results. @DrFaust92, @slevenick VCR tests complete for abb2a42! |
Adds the Cloud Trace product and a `google_cloud_trace_sink` beta resource for
exporting traces to BigQuery via the v2beta1 `projects.traceSinks` API.
The Cloud Trace API identifies a sink by its canonical resource name, which
references the project by its project *number* (not ID) and is required in the
create body, the BigQuery `destination`, and the read/update/delete URLs. The
resource resolves the project number in an encoder, keys off the server-returned
canonical name (`self_link: '{{name}}'`), and normalizes `project` back to the ID
on import.
Revives the work from GoogleCloudPlatform#14074 and closes the trace-sink half of
hashicorp/terraform-provider-google#23579.
Rework google_cloud_trace_sink per review feedback: - self_link/id_format use the expanded name and match import_format - drop the Resource Manager ID->number conversion in the encoder and the custom import; the project field is now supplied as the project number, keeping the resource within a single API boundary - fix copyright year
abb2a42 to
5088fbd
Compare
|
Rebased onto latest All six review comments from the 2026-07-21 pass are addressed:
The two red checks are pre-existing, not from this PR
Worth flagging: the
One open questionTaking Would you prefer a validation on the field to reject non-numeric input with a clear message, or is the doc note enough? |
Adds a new
CloudTraceproduct and a betagoogle_cloud_trace_sinkresource for exporting traces to a BigQuery dataset via the Cloud Tracev2beta1projects.traceSinksAPI.Fixes hashicorp/terraform-provider-google#23579 (the trace-sink half —
google_observability_trace_scopealready covers trace scopes).Revives and finishes the abandoned work from #14074, whose approach never worked against the live API for the reason described below.
Note for reviewers: the API addresses sinks by project number
The Cloud Trace API identifies a sink by its canonical resource name, which references the project by its project number, not its project ID. Confirmed empirically against the live API, the number is required in three places:
namein the request body and the BigQuerydestinationmust both use the project number (the create URL accepts the ID).GET .../projects/{id}/traceSinks/{sink}→400;.../projects/{number}/...→200).Rather than resolve the number via a cross-API Resource Manager lookup, the
projectfield is supplied as the project number, keeping the resource within a single API boundary:self_link/id_format/import_formatall expand toprojects/{{project}}/traceSinks/{{sink_id}}, so read/update/delete hit the number-form URL and import uses the stock generated path.namethe create body requires fromproject+sink_id(no cross-API call).projectand the BigQuerydestinationreference the project by number is documented, and the example builds both fromdata.google_project.project.number.Testing
Acceptance tests pass against a real project (beta provider):
TestAccCloudTraceSink_updatecovers create → import → update destination → import.Release Note