| --- |
| # ---------------------------------------------------------------------------- |
| # |
| # *** 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: "GKEHub" |
| description: |- |
| Membership contains information about a member cluster. |
| --- |
| |
| # google\_gke\_hub\_membership |
| |
| Membership contains information about a member cluster. |
| |
| |
| To get more information about Membership, see: |
| |
| * [API documentation](https://cloud.google.com/anthos/multicluster-management/reference/rest/v1/projects.locations.memberships) |
| * How-to Guides |
| * [Registering a Cluster](https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster#register_cluster) |
| |
| ## Example Usage - Gkehub Membership Regional |
| |
| |
| ```hcl |
| 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}" |
| } |
| } |
| } |
| ``` |
| <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=gkehub_membership_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 - Gkehub Membership Basic |
| |
| |
| ```hcl |
| 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" |
| } |
| } |
| ``` |
| ## Example Usage - Gkehub Membership Issuer |
| |
| |
| ```hcl |
| 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}" |
| } |
| } |
| ``` |
| |
| ## Argument Reference |
| |
| The following arguments are supported: |
| |
| |
| * `membership_id` - |
| (Required) |
| The client-provided identifier of the membership. |
| |
| |
| - - - |
| |
| |
| * `description` - |
| (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html), 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](#nested_endpoint). |
| |
| * `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](#nested_authority). |
| |
| * `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. |
| |
| |
| <a name="nested_endpoint"></a>The `endpoint` block supports: |
| |
| * `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](#nested_gke_cluster). |
| |
| |
| <a name="nested_gke_cluster"></a>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`. |
| |
| <a name="nested_authority"></a>The `authority` block supports: |
| |
| * `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}"`. |
| |
| ## Attributes Reference |
| |
| 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. |
| |
| |
| ## 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 |
| |
| |
| 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](https://developer.hashicorp.com/terraform/language/import) to import Membership using one of the formats above. For example: |
| |
| ```tf |
| import { |
| id = "projects/{{project}}/locations/{{location}}/memberships/{{membership_id}}" |
| to = google_gke_hub_membership.default |
| } |
| ``` |
| |
| When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), 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}} |
| ``` |
| |
| ## User Project Overrides |
| |
| This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override). |