Expand description
Represents the Instance membership to the Instance Group.
NOTE You can use this resource instead of the
instances
field in thegcp.compute.InstanceGroup
, however it’s not recommended to use it alongside this field. It might cause inconsistencies, as they can end up competing over control.
NOTE This resource has been added to avoid a situation, where after Instance is recreated, it’s removed from Instance Group and it’s needed to perform
apply
twice. To avoid situations like this, please use this resource with the lifecyclereplace_triggered_by
method, with the passed Instance’s ID.
To get more information about InstanceGroupMembership, see:
- API documentation
- How-to Guides
§Example Usage
§Instance Group Membership
resources:
default-network:
type: gcp:compute:Network
properties:
name: network
default-instance:
type: gcp:compute:Instance
properties:
name: instance
machineType: e2-medium
bootDisk:
initializeParams:
image: debian-cloud/debian-11
networkInterfaces:
- network: ${["default-network"].name}
default-instance-group:
type: gcp:compute:InstanceGroup
properties:
name: instance-group
default-ig-membership:
type: gcp:compute:InstanceGroupMembership
properties:
instance: ${["default-instance"].selfLink}
instanceGroup: ${["default-instance-group"].name}
§Import
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}}
When using the pulumi import
command, InstanceGroupMembership can be imported using one of the formats above. For example:
$ pulumi import gcp:compute/instanceGroupMembership:InstanceGroupMembership default projects/{{project}}/zones/{{zone}}/instanceGroups/{{instance_group}}/{{instance}}
$ pulumi import gcp:compute/instanceGroupMembership:InstanceGroupMembership default {{project}}/{{zone}}/{{instance_group}}/{{instance}}
$ pulumi import gcp:compute/instanceGroupMembership:InstanceGroupMembership default {{zone}}/{{instance_group}}/{{instance}}
$ pulumi import gcp:compute/instanceGroupMembership:InstanceGroupMembership default {{instance_group}}/{{instance}}
Structs§
- Use builder syntax to set the inputs and finish with
build_struct()
.
Functions§
- Registers a new resource with the given unique name and arguments