Google Service Directory Namespace

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

google_service_directory_namespace (Terraform)

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

Example Usage from GitHub
resource "google_service_directory_namespace" "elixir_application" {
  provider     = google-beta
  namespace_id = var.namespace_name
  location     = var.gcp_region

  labels = {

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:

  • location - (Required) The location for the Namespace. A full list of valid locations can be found by running gcloud beta service-directory locations list.

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

  • labels - (Optional) Resource labels associated with this Namespace. No more than 64 user labels can be associated with a given resource. Label keys and values can be no longer than 63 characters.

  • project - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

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 namespace in the format projects/*/locations/*/namespaces/*.

Explanation in Terraform Registry

A container for services. Namespaces allow administrators to group services together and define permissions for a collection of services.

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 Namespace, see:

Frequently asked questions

What is Google Service Directory Namespace?

Google Service Directory Namespace 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 Namespace?

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.