Google Service Directory Service

This page shows how to write Terraform for Service Directory Service and write them securely.

google_service_directory_service (Terraform)

The Service in Service Directory can be configured in Terraform with the resource name google_service_directory_service. The following sections describe 1 example of how to use the resource and its parameters.

Example Usage from GitHub
resource "google_service_directory_service" "elixir_application" {
  provider   = google-beta
  service_id = var.service_name
  namespace  =

  metadata = {

Review your Terraform file for Google best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).


The following arguments are supported:

  • namespace - (Required) The resource name of the namespace this service will belong to.

  • service_id - (Required) The Resource ID must be 1-63 characters long, including digits, lowercase letters or the hyphen character.

  • metadata - (Optional) Metadata for the service. This data can be consumed by service clients. The entire metadata dictionary may contain up to 2000 characters, spread across all key-value pairs. Metadata that goes beyond any these limits will be rejected.

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format [[name]]

  • name - The resource name for the service in the format projects/*/locations/*/namespaces/*/services/*.

Explanation in Terraform Registry

An individual service. A service contains a name and optional metadata.

Warning: This resource is in beta, and should be used with the terraform-provider-google-beta provider. See Provider Versions for more details on beta resources. To get more information about Service, see:

Frequently asked questions

What is Google Service Directory Service?

Google Service Directory Service is a resource for Service Directory of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Service Directory Service?

For Terraform, the fosk06/elixir-cluster-terraform-module source code example is useful. See the Terraform Example section for further details.


Automate config file reviews on your commits

Fix issues in your infrastructure as code with auto-generated patches.