<commit_before>---
subcategory: "Cloud Platform"
layout: "google"
page_title: "Google: google_project_service_identity"
sidebar_current: "docs-google-project-service-identity"
description: |-
 Generate service identity for a service.
---

# google\_project\_service\_identity

~> **Warning:** These resources are in beta, and should be used with the terraform-provider-google-beta provider.
See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources.

Generate service identity for a service.

~> **Note**: Once created, this resource cannot be updated or destroyed. These
actions are a no-op.

To get more information about Service Identity, see:

* [API documentation](https://cloud.google.com/service-usage/docs/reference/rest/v1beta1/services/generateServiceIdentity)

## Example Usage - Service Identity Basic

```hcl
data "google_project" "project" {}

resource "google_project_service_identity" "hc_sa" {
  provider = google-beta

  project = data.google_project.project.project_id<commit_msg>Document service identity emails (#4217)<commit_after>---
subcategory: "Cloud Platform"
layout: "google"
page_title: "Google: google_project_service_identity"
sidebar_current: "docs-google-project-service-identity"
description: |-
 Generate service identity for a service.
---

# google\_project\_service\_identity

~> **Warning:** These resources are in beta, and should be used with the terraform-provider-google-beta provider.
See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources.

Generate service identity for a service.

~> **Note**: Once created, this resource cannot be updated or destroyed. These
actions are a no-op.

~> **Note**: This resource can be used to retrieve the emails of the [Google-managed service accounts](https://cloud.google.com/iam/docs/service-agents) 
of the APIs that Google has configured with a Service Identity. You can run `gcloud beta services identity create --service container.googleapis.com` to
verify if an API supports this.

To get more information about Service Identity, see:

* [API documentation](https://cloud.google.com/service-usage/docs/reference/rest/v1beta1/services/generateServiceIdentity)

## Example Usage - Service Identity Basic

```hcl
data "google_project" "project" {}

resource "google_project_service_identity" "hc_sa" {
  provider = google-beta

  project = data.google_project.project.project_id
{'fraction_non_alphanumeric': 0.10497017892644135, 'fraction_numerical': 0.0031809145129224653, 'mean_word_length': 5.353535353535354, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5219817', 'n_tokens_mistral': 692, 'n_tokens_neox': 682, 'n_words': 226}