Represents the Instance membership to the Instance Group.
To get more information about InstanceGroupMembership, see:
resource "google_compute_network" "default-network" {
name = "network"
}
resource "google_compute_instance" "default-instance" {
name = "instance"
machine_type = "e2-medium"
boot_disk {
initialize_params {
image = "debian-cloud/debian-11"
}
}
network_interface {
network = google_compute_network.default-network.name
}
}
resource "google_compute_instance_group" "default-instance-group" {
name = "instance-group"
}
resource "google_compute_instance_group_membership" "default-ig-membership" {
instance = google_compute_instance.default-instance.self_link
instance_group = google_compute_instance_group.default-instance-group.name
}
The following arguments are supported:
instance
-
(Required)
An instance being added to the InstanceGroup
instance_group
-
(Required)
Represents an Instance Group resource name that the instance belongs to.
zone
-
(Optional)
A reference to the zone where the instance group resides.
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 {{project}}/{{zone}}/{{instance_group}}/{{instance}}
This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.delete
- Default is 20 minutes.InstanceGroupMembership can be imported using any of these accepted formats:
projects/{{project}}/zones/{{zone}}/instanceGroups/{{instance_group}}/{{instance}}
{{project}}/{{zone}}/{{instance_group}}/{{instance}}
{{zone}}/{{instance_group}}/{{instance}}
{{instance_group}}/{{instance}}
In Terraform v1.5.0 and later, use an import
block to import InstanceGroupMembership using one of the formats above. For example:
import {
id = "projects/{{project}}/zones/{{zone}}/instanceGroups/{{instance_group}}/{{instance}}"
to = google_compute_instance_group_membership.default
}
When using the terraform import
command, InstanceGroupMembership can be imported using one of the formats above. For example:
$ terraform import google_compute_instance_group_membership.default projects/{{project}}/zones/{{zone}}/instanceGroups/{{instance_group}}/{{instance}}
$ terraform import google_compute_instance_group_membership.default {{project}}/{{zone}}/{{instance_group}}/{{instance}}
$ terraform import google_compute_instance_group_membership.default {{zone}}/{{instance_group}}/{{instance}}
$ terraform import google_compute_instance_group_membership.default {{instance_group}}/{{instance}}
This resource supports User Project Overrides.