Skip to content

Conversation

@crazygit
Copy link
Contributor

Release Note Template for Downstream PRs (will be copied)

See Write release notes for guidance.


@google-cla
Copy link

google-cla bot commented Sep 22, 2025

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.

@crazygit
Copy link
Contributor Author

The Problem

The original example code for the google_logging_metric resource is as follows:

resource "google_logging_project_bucket_config" "logging_metric" {
    location  = "global"
    project   = "my-project-name"
    bucket_id = "_Default"
}

resource "google_logging_metric" "logging_metric" {
  name        = "my-(custom)/metric"
  filter      = "resource.type=gae_app AND severity>=ERROR"
  bucket_name = google_logging_project_bucket_config.logging_metric.id
}

When using google_logging_project_bucket_config.logging_metric.id for the bucket_name, the terraform apply command succeeds, and the logs-based metric is created in Google Cloud. However, the metric fails to ingest any log data. As a result, it is not visible or queryable in Metrics Explorer, even after new logs matching the filter have been generated.

This appears to happen because while both .id and .name attributes resolve to the full resource path, only .name correctly links the metric to the log bucket's ingestion pipeline.

Further investigation reveals a critical difference in the values resolved by the .id and .name attributes:

google_logging_project_bucket_config.logging_metric.id resolves to a path containing the numeric Project ID:
projects/1234567890/locations/global/buckets/your-bucket-id

google_logging_project_bucket_config.logging_metric.name resolves to a path containing the string-based Project name:
projects/your-project-name/locations/global/buckets/your-bucket-id

The Google Cloud Logging API requires the resource name containing the string-based Project name for the bucket_name argument. Using the numeric ID allows the resource to be created without error, but it appears to cause a misconfiguration in the log ingestion routing, leading to the metric not receiving data.

@github-actions github-actions bot requested a review from shuyama1 September 22, 2025 09:21
@github-actions
Copy link

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.

@shuyama1, 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.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 2 files changed, 2 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 2 files changed, 2 insertions(+), 2 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 77
Passed tests: 74
Skipped tests: 2
Affected tests: 1

Click here to see the affected service packages
  • logging

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccLoggingFolderSettings_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccLoggingFolderSettings_update [Debug log]

🔴 Tests failed when rerunning REPLAYING mode:
TestAccLoggingFolderSettings_update [Error message] [Debug log]

Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.

Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer.


🟢 All tests passed!

View the build log or the debug log for each test

Copy link
Member

@shuyama1 shuyama1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test passed on TC.

Failures of TestAccLoggingFolderSettings_update is unrelated to this change. It's already failing at the main. Created the fix #15229

@shuyama1 shuyama1 added this pull request to the merge queue Sep 24, 2025
Merged via the queue into GoogleCloudPlatform:main with commit 27bdf16 Sep 24, 2025
24 of 25 checks passed
BBBmau pushed a commit to BBBmau/magic-modules that referenced this pull request Sep 26, 2025
jkrish-c pushed a commit to jkrish-c/magic-modules that referenced this pull request Oct 14, 2025
g-dreva pushed a commit to g-dreva/magic-modules that referenced this pull request Oct 15, 2025
BBBmau pushed a commit to BBBmau/magic-modules that referenced this pull request Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants