| --- |
| # ---------------------------------------------------------------------------- |
| # |
| # *** AUTO GENERATED CODE *** Type: MMv1 *** |
| # |
| # ---------------------------------------------------------------------------- |
| # |
| # This file is automatically generated by Magic Modules and manual |
| # changes will be clobbered when the file is regenerated. |
| # |
| # Please read more about how to change this file in |
| # .github/CONTRIBUTING.md. |
| # |
| # ---------------------------------------------------------------------------- |
| subcategory: "Cloud (Stackdriver) Monitoring" |
| description: |- |
| A Service is a discrete, autonomous, and network-accessible unit, |
| designed to solve an individual concern. |
| --- |
| |
| # google\_monitoring\_service |
| |
| A Service is a discrete, autonomous, and network-accessible unit, |
| designed to solve an individual concern. In Cloud Monitoring, |
| a Service acts as the root resource under which operational aspects of |
| the service are accessible |
| |
| |
| To get more information about GenericService, see: |
| |
| * [API documentation](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services) |
| * How-to Guides |
| * [Service Monitoring](https://cloud.google.com/monitoring/service-monitoring) |
| * [Monitoring API Documentation](https://cloud.google.com/monitoring/api/v3/) |
| * [Service-orientation on Wikipedia](https://en.wikipedia.org/wiki/Service-orientation) |
| |
| <div class = "oics-button" style="float: right; margin: 0 0 -15px"> |
| <a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=monitoring_service_example&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank"> |
| <img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> |
| </a> |
| </div> |
| ## Example Usage - Monitoring Service Example |
| |
| |
| ```hcl |
| resource "google_monitoring_service" "my_service" { |
| service_id = "my-service" |
| display_name = "My Service my-service" |
| |
| user_labels = { |
| my_key = "my_value" |
| my_other_key = "my_other_value" |
| } |
| |
| basic_service { |
| service_type = "APP_ENGINE" |
| service_labels = { |
| module_id = "another-module-id" |
| } |
| } |
| } |
| ``` |
| |
| ## Argument Reference |
| |
| The following arguments are supported: |
| |
| |
| * `service_id` - |
| (Required) |
| An optional service ID to use. If not given, the server will generate a |
| service ID. |
| |
| |
| - - - |
| |
| |
| * `display_name` - |
| (Optional) |
| Name used for UI elements listing this Service. |
| |
| * `user_labels` - |
| (Optional) |
| Labels which have been used to annotate the service. Label keys must start |
| with a letter. Label keys and values may contain lowercase letters, |
| numbers, underscores, and dashes. Label keys and values have a maximum |
| length of 63 characters, and must be less than 128 bytes in size. Up to 64 |
| label entries may be stored. For labels which do not have a semantic value, |
| the empty string may be supplied for the label value. |
| |
| * `basic_service` - |
| (Optional) |
| A well-known service type, defined by its service type and service labels. |
| Valid values of service types and services labels are described at |
| https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli |
| Structure is [documented below](#nested_basic_service). |
| |
| * `project` - (Optional) The ID of the project in which the resource belongs. |
| If it is not provided, the provider project is used. |
| |
| |
| <a name="nested_basic_service"></a>The `basic_service` block supports: |
| |
| * `service_type` - |
| (Optional) |
| The type of service that this basic service defines, e.g. |
| APP_ENGINE service type |
| |
| * `service_labels` - |
| (Optional) |
| Labels that specify the resource that emits the monitoring data |
| which is used for SLO reporting of this `Service`. |
| |
| ## Attributes Reference |
| |
| In addition to the arguments listed above, the following computed attributes are exported: |
| |
| * `id` - an identifier for the resource with format `projects/{{project}}/services/{{service_id}}` |
| |
| * `name` - |
| The full resource name for this service. The syntax is: |
| projects/[PROJECT_ID]/services/[SERVICE_ID]. |
| |
| * `telemetry` - |
| Configuration for how to query telemetry on a Service. |
| Structure is [documented below](#nested_telemetry). |
| |
| |
| <a name="nested_telemetry"></a>The `telemetry` block contains: |
| |
| * `resource_name` - |
| (Optional) |
| The full name of the resource that defines this service. |
| Formatted as described in |
| https://cloud.google.com/apis/design/resource_names. |
| |
| ## Timeouts |
| |
| This resource provides the following |
| [Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options: |
| |
| - `create` - Default is 20 minutes. |
| - `update` - Default is 20 minutes. |
| - `delete` - Default is 20 minutes. |
| |
| ## Import |
| |
| |
| GenericService can be imported using any of these accepted formats: |
| |
| * `projects/{{project}}/services/{{service_id}}` |
| * `{{project}}/{{service_id}}` |
| * `{{service_id}}` |
| |
| |
| In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import GenericService using one of the formats above. For example: |
| |
| ```tf |
| import { |
| id = "projects/{{project}}/services/{{service_id}}" |
| to = google_monitoring_service.default |
| } |
| ``` |
| |
| When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), GenericService can be imported using one of the formats above. For example: |
| |
| ``` |
| $ terraform import google_monitoring_service.default projects/{{project}}/services/{{service_id}} |
| $ terraform import google_monitoring_service.default {{project}}/{{service_id}} |
| $ terraform import google_monitoring_service.default {{service_id}} |
| ``` |
| |
| ## User Project Overrides |
| |
| This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override). |