| --- |
| # ---------------------------------------------------------------------------- |
| # |
| # *** 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: |- |
| MembershipBinding is a subresource of a Membership, representing what Fleet Scopes (or other, future Fleet resources) a Membership is bound to. |
| --- |
| |
| # google\_gke\_hub\_membership\_binding |
| |
| MembershipBinding is a subresource of a Membership, representing what Fleet Scopes (or other, future Fleet resources) a Membership is bound to. |
| |
| |
| To get more information about MembershipBinding, see: |
| |
| * [API documentation](https://cloud.google.com/anthos/fleet-management/docs/reference/rest/v1/projects.locations.memberships.bindings) |
| * How-to Guides |
| * [Registering a Cluster](https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster#register_cluster) |
| |
| ## Example Usage - Gkehub Membership Binding 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 = "tf-test-membership%{random_suffix}" |
| endpoint { |
| gke_cluster { |
| resource_link = "//container.googleapis.com/${google_container_cluster.primary.id}" |
| } |
| } |
| |
| depends_on = [google_container_cluster.primary] |
| } |
| |
| resource "google_gke_hub_scope" "scope" { |
| scope_id = "tf-test-scope%{random_suffix}" |
| } |
| |
| resource "google_gke_hub_membership_binding" "membership_binding" { |
| membership_binding_id = "tf-test-membership-binding%{random_suffix}" |
| scope = google_gke_hub_scope.scope.name |
| membership_id = google_gke_hub_membership.membership.membership_id |
| location = "global" |
| labels = { |
| keyb = "valueb" |
| keya = "valuea" |
| keyc = "valuec" |
| } |
| depends_on = [ |
| google_gke_hub_membership.membership, |
| google_gke_hub_scope.scope |
| ] |
| } |
| ``` |
| |
| ## Argument Reference |
| |
| The following arguments are supported: |
| |
| |
| * `membership_binding_id` - |
| (Required) |
| The client-provided identifier of the membership binding. |
| |
| * `scope` - |
| (Required) |
| A Workspace resource name in the format |
| `projects/*/locations/*/scopes/*`. |
| |
| * `membership_id` - |
| (Required) |
| Id of the membership |
| |
| * `location` - |
| (Required) |
| Location of the membership |
| |
| |
| - - - |
| |
| |
| * `labels` - |
| (Optional) |
| Labels for this Membership binding. |
| |
| **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 `projects/{{project}}/locations/{{location}}/memberships/{{membership_id}}/bindings/{{membership_binding_id}}` |
| |
| * `name` - |
| The resource name for the membershipbinding itself |
| |
| * `uid` - |
| Google-generated UUID for this resource. |
| |
| * `create_time` - |
| Time the MembershipBinding was created in UTC. |
| |
| * `update_time` - |
| Time the MembershipBinding was updated in UTC. |
| |
| * `delete_time` - |
| Time the MembershipBinding was deleted in UTC. |
| |
| * `state` - |
| State of the membership binding resource. |
| Structure is [documented below](#nested_state). |
| |
| * `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. |
| |
| |
| <a name="nested_state"></a>The `state` block contains: |
| |
| * `code` - |
| (Output) |
| Code describes the state of a MembershipBinding resource. |
| |
| ## 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 |
| |
| |
| MembershipBinding can be imported using any of these accepted formats: |
| |
| * `projects/{{project}}/locations/{{location}}/memberships/{{membership_id}}/bindings/{{membership_binding_id}}` |
| * `{{project}}/{{location}}/{{membership_id}}/{{membership_binding_id}}` |
| * `{{location}}/{{membership_id}}/{{membership_binding_id}}` |
| |
| |
| In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import MembershipBinding using one of the formats above. For example: |
| |
| ```tf |
| import { |
| id = "projects/{{project}}/locations/{{location}}/memberships/{{membership_id}}/bindings/{{membership_binding_id}}" |
| to = google_gke_hub_membership_binding.default |
| } |
| ``` |
| |
| When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), MembershipBinding can be imported using one of the formats above. For example: |
| |
| ``` |
| $ terraform import google_gke_hub_membership_binding.default projects/{{project}}/locations/{{location}}/memberships/{{membership_id}}/bindings/{{membership_binding_id}} |
| $ terraform import google_gke_hub_membership_binding.default {{project}}/{{location}}/{{membership_id}}/{{membership_binding_id}} |
| $ terraform import google_gke_hub_membership_binding.default {{location}}/{{membership_id}}/{{membership_binding_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). |