Membership contains information about a member cluster.
To get more information about Membership, see:
resource "google_container_cluster" "primary" {
name = "basic-cluster"
location = "us-central1-a"
initial_node_count = 1
deletion_protection = false
network = "default"
subnetwork = "default"
}
resource "google_gke_hub_membership" "membership" {
membership_id = "basic"
location = "us-west1"
endpoint {
gke_cluster {
resource_link = "//container.googleapis.com/${google_container_cluster.primary.id}"
}
}
}
resource "google_container_cluster" "primary" {
name = "basic-cluster"
location = "us-central1-a"
initial_node_count = 1
deletion_protection = "true"
network = "default"
subnetwork = "default"
}
resource "google_gke_hub_membership" "membership" {
membership_id = "basic"
endpoint {
gke_cluster {
resource_link = "//container.googleapis.com/${google_container_cluster.primary.id}"
}
}
labels = {
env = "test"
}
}
resource "google_container_cluster" "primary" {
name = "basic-cluster"
location = "us-central1-a"
initial_node_count = 1
workload_identity_config {
workload_pool = "my-project-name.svc.id.goog"
}
deletion_protection = "true"
network = "default"
subnetwork = "default"
}
resource "google_gke_hub_membership" "membership" {
membership_id = "basic"
endpoint {
gke_cluster {
resource_link = google_container_cluster.primary.id
}
}
authority {
issuer = "https://container.googleapis.com/v1/${google_container_cluster.primary.id}"
}
}
The following arguments are supported:
membership_id
-
(Required)
The client-provided identifier of the membership.description
-
(Optional, Beta, Deprecated)
The name of this entity type to be displayed on the console. This field is unavailable in v1 of the API.
~> Warning: description
is deprecated and will be removed in a future major release.
labels
-
(Optional)
Labels to apply to this membership.
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.
endpoint
-
(Optional)
If this Membership is a Kubernetes API server hosted on GKE, this is a self link to its GCP resource.
Structure is documented below.
authority
-
(Optional)
Authority encodes how Google will recognize identities from this Membership.
See the workload identity documentation for more details:
https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity
Structure is documented below.
location
-
(Optional)
Location of the membership.
The default value is global
.
project
- (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
gke_cluster
-
(Optional)
If this Membership is a Kubernetes API server hosted on GKE, this is a self link to its GCP resource.
Structure is documented below.The gke_cluster
block supports:
resource_link
-
(Required)
Self-link of the GCP resource for the GKE cluster.
For example: //container.googleapis.com/projects/my-project/zones/us-west1-a/clusters/my-cluster
.
It can be at the most 1000 characters in length. If the cluster is provisioned with Terraform,
this can be "//container.googleapis.com/${google_container_cluster.my-cluster.id}"
or
google_container_cluster.my-cluster.id
.issuer
-
(Required)
A JSON Web Token (JWT) issuer URI. issuer
must start with https://
and // be a valid
with length <2000 characters. For example: https://container.googleapis.com/v1/projects/my-project/locations/us-west1/clusters/my-cluster
(must be locations
rather than zones
). If the cluster is provisioned with Terraform, this is "https://container.googleapis.com/v1/${google_container_cluster.my-cluster.id}"
.In addition to the arguments listed above, the following computed attributes are exported:
id
- an identifier for the resource with format projects/{{project}}/locations/{{location}}/memberships/{{membership_id}}
name
-
The unique identifier of the membership.
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.
This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.update
- Default is 20 minutes.delete
- Default is 20 minutes.Membership can be imported using any of these accepted formats:
projects/{{project}}/locations/{{location}}/memberships/{{membership_id}}
{{project}}/{{location}}/{{membership_id}}
{{location}}/{{membership_id}}
In Terraform v1.5.0 and later, use an import
block to import Membership using one of the formats above. For example:
import {
id = "projects/{{project}}/locations/{{location}}/memberships/{{membership_id}}"
to = google_gke_hub_membership.default
}
When using the terraform import
command, Membership can be imported using one of the formats above. For example:
$ terraform import google_gke_hub_membership.default projects/{{project}}/locations/{{location}}/memberships/{{membership_id}}
$ terraform import google_gke_hub_membership.default {{project}}/{{location}}/{{membership_id}}
$ terraform import google_gke_hub_membership.default {{location}}/{{membership_id}}
This resource supports User Project Overrides.