Skip to content
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

Implement monitoring metrics scope and monitored project resources #10113

Closed
trodge opened this issue Sep 20, 2021 · 11 comments · Fixed by GoogleCloudPlatform/magic-modules#5218, hashicorp/terraform-provider-google-beta#3642 or #10126

Comments

@trodge
Copy link
Collaborator

trodge commented Sep 20, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment. If the issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

New or Affected Resource(s)

  • google_monitoring_monitored_project
  • google_monitoring_metrics_scope

Potential Terraform Configuration

# Propose what you think the configuration to take advantage of this feature should look like.
# We may not use it verbatim, but it's helpful in understanding your intent.
resource "google_monitoring_monitored_project" "primary" {
  metrics_scope = google_monitoring_metrics_scope.basic.name
  name          = google_project.basic.name
}

resource "google_project" "basic" {
  project_id = "id%{random_suffix}"
  name       = "id%{random_suffix}"
  org_id     = "%{org_id}"
}

resource "google_monitoring_metrics_scope" "basic" {
  name = "%{project_name}"
}

References

@mikemeiercb
Copy link

I see you submitted a corresponding PR for this (thanks!). I would recommend to keep the naming of the resources consistent with the documentation that it be called a google_monitoring_scoping_project instead of a metrics_scope to be more clear.

@philip-harvey
Copy link

Looking into getting monitoring scopes and monitored projects working as part of a larger GCP migration project and excited to find this is in progress. Should this issue be re-opened since it was reverted?

@nat-henderson
Copy link
Contributor

It was un-reverted and will be released on the 4th. :)

@philip-harvey
Copy link

I thought only google_monitoring_monitored_project was un-reverted and that google_monitoring_metrics_scope is not yet implemented? Or am I misunderstanding? Thanks.

@nat-henderson
Copy link
Contributor

No, that's correct, but monitored_project is the only resource - metrics_scope does not contain any data or editable fields, once monitored_project exists, so there's no need for metrics_scope.

@philip-harvey
Copy link

philip-harvey commented Oct 11, 2021

Any ideas on where to find documentation on how to use this now that it is in the Beta provider?
The example given above requires google_monitoring_metrics_scope

@philip-harvey
Copy link

I think I managed to work out what it is looking for.

resource "google_monitoring_monitored_project" "monitored-project" {
  provider = google-beta
  metrics_scope = google_project.scoping-project.name
  name = google_project.monitored-project.name
}

@nat-henderson
Copy link
Contributor

Yep! Unfortunately due to #10252, we currently only show docs for this on the beta provider page, and it is not easy to find. Here it is:

https://registry.terraform.io/providers/hashicorp/google-beta/latest/docs/resources/monitoring_monitored_project

And the relevant example is also not being generated well - your example is better than what winds up on that page. We'll look into that as part of #10252.

@amitcodex
Copy link

Can we specify multiple projects to be monitored by the scoping project?

@nat-henderson
Copy link
Contributor

With multiple instances of the resource, yes.

@github-actions
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.