Namespace represents a namespace across the Fleet.
To get more information about Namespace, see:
resource "google_gke_hub_scope" "scope" {
scope_id = "tf-test-scope%{random_suffix}"
}
resource "google_gke_hub_namespace" "namespace" {
scope_namespace_id = "tf-test-namespace%{random_suffix}"
scope_id = google_gke_hub_scope.scope.scope_id
scope = google_gke_hub_scope.scope.name
namespace_labels = {
keyb = "valueb"
keya = "valuea"
keyc = "valuec"
}
labels = {
keyb = "valueb"
keya = "valuea"
keyc = "valuec"
}
depends_on = [google_gke_hub_scope.scope]
}
The following arguments are supported:
scope_namespace_id
-
(Required)
The client-provided identifier of the namespace.
scope
-
(Required)
The name of the Scope instance.
scope_id
-
(Required)
Id of the scope
namespace_labels
-
(Optional)
Namespace-level cluster namespace labels. These labels are applied
to the related namespace of the member clusters bound to the parent
Scope. Scope-level labels (namespace_labels
in the Fleet Scope
resource) take precedence over Namespace-level labels if they share
a key. Keys and values must be Kubernetes-conformant.
labels
-
(Optional)
Labels for this Namespace.
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.
In addition to the arguments listed above, the following computed attributes are exported:
id
- an identifier for the resource with format projects/{{project}}/locations/global/scopes/{{scope_id}}/namespaces/{{scope_namespace_id}}
name
-
The resource name for the namespace
uid
-
Google-generated UUID for this resource.
create_time
-
Time the Namespace was created in UTC.
update_time
-
Time the Namespace was updated in UTC.
delete_time
-
Time the Namespace was deleted in UTC.
state
-
State of the namespace resource.
Structure is documented below.
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.
code
-
(Output)
Code describes the state of a Namespace resource.This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.update
- Default is 20 minutes.delete
- Default is 20 minutes.Namespace can be imported using any of these accepted formats:
projects/{{project}}/locations/global/scopes/{{scope_id}}/namespaces/{{scope_namespace_id}}
{{project}}/{{scope_id}}/{{scope_namespace_id}}
{{scope_id}}/{{scope_namespace_id}}
In Terraform v1.5.0 and later, use an import
block to import Namespace using one of the formats above. For example:
import {
id = "projects/{{project}}/locations/global/scopes/{{scope_id}}/namespaces/{{scope_namespace_id}}"
to = google_gke_hub_namespace.default
}
When using the terraform import
command, Namespace can be imported using one of the formats above. For example:
$ terraform import google_gke_hub_namespace.default projects/{{project}}/locations/global/scopes/{{scope_id}}/namespaces/{{scope_namespace_id}}
$ terraform import google_gke_hub_namespace.default {{project}}/{{scope_id}}/{{scope_namespace_id}}
$ terraform import google_gke_hub_namespace.default {{scope_id}}/{{scope_namespace_id}}
This resource supports User Project Overrides.