blob: ef2bd2fafa56fed715ee716bd89175c477f7c2d4 [file] [log] [blame]
---
# ----------------------------------------------------------------------------
#
# *** 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: "Service Directory"
description: |-
A container for `services`.
---
# google\_service\_directory\_namespace
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](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources.
To get more information about Namespace, see:
* [API documentation](https://cloud.google.com/service-directory/docs/reference/rest/v1beta1/projects.locations.namespaces)
* How-to Guides
* [Configuring a namespace](https://cloud.google.com/service-directory/docs/configuring-service-directory#configuring_a_namespace)
<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=service_directory_namespace_basic&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 - Service Directory Namespace Basic
```hcl
resource "google_service_directory_namespace" "example" {
provider = google-beta
namespace_id = "example-namespace"
location = "us-central1"
labels = {
key = "value"
foo = "bar"
}
}
```
## Argument Reference
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.
**Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
Please refer to the field `effective_labels` for all of the labels present on the resource.
* `project` - (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
## Attributes Reference
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/*`.
* `terraform_labels` -
The combination of labels configured directly on the resource
and default labels configured on the provider.
* `effective_labels` -
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services.
## 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
Namespace can be imported using any of these accepted formats:
* `projects/{{project}}/locations/{{location}}/namespaces/{{namespace_id}}`
* `{{project}}/{{location}}/{{namespace_id}}`
* `{{location}}/{{namespace_id}}`
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Namespace using one of the formats above. For example:
```tf
import {
id = "projects/{{project}}/locations/{{location}}/namespaces/{{namespace_id}}"
to = google_service_directory_namespace.default
}
```
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), Namespace can be imported using one of the formats above. For example:
```
$ terraform import google_service_directory_namespace.default projects/{{project}}/locations/{{location}}/namespaces/{{namespace_id}}
$ terraform import google_service_directory_namespace.default {{project}}/{{location}}/{{namespace_id}}
$ terraform import google_service_directory_namespace.default {{location}}/{{namespace_id}}
```