Instance Group Manager Args
The Google Compute Engine Instance Group Manager API creates and manages pools of homogeneous Compute Engine virtual machine instances from a common instance template. For more information, see the official documentation and API
Note: Use gcp.compute.RegionInstanceGroupManager to create a regional (multi-zone) instance group manager.
Example Usage
With Top Level Instance Template (Google
Provider)
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.HealthCheck;
import com.pulumi.gcp.compute.HealthCheckArgs;
import com.pulumi.gcp.compute.inputs.HealthCheckHttpHealthCheckArgs;
import com.pulumi.gcp.compute.InstanceGroupManager;
import com.pulumi.gcp.compute.InstanceGroupManagerArgs;
import com.pulumi.gcp.compute.inputs.InstanceGroupManagerVersionArgs;
import com.pulumi.gcp.compute.inputs.InstanceGroupManagerAllInstancesConfigArgs;
import com.pulumi.gcp.compute.inputs.InstanceGroupManagerNamedPortArgs;
import com.pulumi.gcp.compute.inputs.InstanceGroupManagerAutoHealingPoliciesArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var autohealing = new HealthCheck("autohealing", HealthCheckArgs.builder()
.checkIntervalSec(5)
.timeoutSec(5)
.healthyThreshold(2)
.unhealthyThreshold(10)
.httpHealthCheck(HealthCheckHttpHealthCheckArgs.builder()
.requestPath("/healthz")
.port("8080")
.build())
.build());
var appserver = new InstanceGroupManager("appserver", InstanceGroupManagerArgs.builder()
.baseInstanceName("app")
.zone("us-central1-a")
.versions(InstanceGroupManagerVersionArgs.builder()
.instanceTemplate(google_compute_instance_template.appserver().self_link_unique())
.build())
.allInstancesConfig(InstanceGroupManagerAllInstancesConfigArgs.builder()
.metadata(Map.of("metadata_key", "metadata_value"))
.labels(Map.of("label_key", "label_value"))
.build())
.targetPools(google_compute_target_pool.appserver().id())
.targetSize(2)
.namedPorts(InstanceGroupManagerNamedPortArgs.builder()
.name("customhttp")
.port(8888)
.build())
.autoHealingPolicies(InstanceGroupManagerAutoHealingPoliciesArgs.builder()
.healthCheck(autohealing.id())
.initialDelaySec(300)
.build())
.build());
}
}
With Multiple Versions (Google-Beta
Provider)
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.InstanceGroupManager;
import com.pulumi.gcp.compute.InstanceGroupManagerArgs;
import com.pulumi.gcp.compute.inputs.InstanceGroupManagerVersionArgs;
import com.pulumi.gcp.compute.inputs.InstanceGroupManagerVersionTargetSizeArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var appserver = new InstanceGroupManager("appserver", InstanceGroupManagerArgs.builder()
.baseInstanceName("app")
.zone("us-central1-a")
.targetSize(5)
.versions(
InstanceGroupManagerVersionArgs.builder()
.name("appserver")
.instanceTemplate(google_compute_instance_template.appserver().self_link_unique())
.build(),
InstanceGroupManagerVersionArgs.builder()
.name("appserver-canary")
.instanceTemplate(google_compute_instance_template.appserver-canary().self_link_unique())
.targetSize(InstanceGroupManagerVersionTargetSizeArgs.builder()
.fixed(1)
.build())
.build())
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.build());
}
}
Import
Instance group managers can be imported using any of these accepted formats
$ pulumi import gcp:compute/instanceGroupManager:InstanceGroupManager appserver projects/{{project}}/zones/{{zone}}/instanceGroupManagers/{{name}}
$ pulumi import gcp:compute/instanceGroupManager:InstanceGroupManager appserver {{project}}/{{zone}}/{{name}}
$ pulumi import gcp:compute/instanceGroupManager:InstanceGroupManager appserver {{project}}/{{name}}
$ pulumi import gcp:compute/instanceGroupManager:InstanceGroupManager appserver {{name}}
Constructors
Properties
) Properties to set on all instances in the group. After setting allInstancesConfig on the group, you must update the group's instances to apply the configuration.
The autohealing policies for this managed instance group. You can specify only one value. Structure is documented below. For more information, see the official documentation.
The base instance name to use for instances in this group. The value must be a valid RFC1035 name. Supported characters are lowercase letters, numbers, and hyphens (-). Instances are named by appending a hyphen and a random four-character string to the base instance name.
An optional textual description of the instance group manager.
The instance lifecycle policy for this managed instance group.
Pagination behavior of the listManagedInstances
API method for this managed instance group. Valid values are: PAGELESS
, PAGINATED
. If PAGELESS
(default), Pagination is disabled for the group's listManagedInstances
API method. maxResults
and pageToken
query parameters are ignored and all instances are returned in a single response. If PAGINATED
, pagination is enabled, maxResults
and pageToken
query parameters are respected.
The named port configuration. See the section below for details on configuration.
Disks created on the instances that will be preserved on instance delete, update, etc. Structure is documented below. For more information see the official documentation.
External network IPs assigned to the instances that will be preserved on instance delete, update, etc. This map is keyed with the network interface name. Structure is documented below.
Internal network IPs assigned to the instances that will be preserved on instance delete, update, etc. This map is keyed with the network interface name. Structure is documented below.
The full URL of all target pools to which new instances in the group are added. Updating the target pools attribute does not affect existing instances.
The target number of running instances for this managed instance group. This value should always be explicitly set unless this resource is attached to an autoscaler, in which case it should never be set. Defaults to 0.
The update policy for this managed instance group. Structure is documented below. For more information, see the official documentation and API
Application versions managed by this instance group. Each version deals with a specific instance template, allowing canary release scenarios. Structure is documented below.
Whether to wait for all instances to be created/updated before returning. Note that if this is set to true and the operation does not succeed, this provider will continue trying until it times out.
When used with wait_for_instances
it specifies the status to wait for. When STABLE
is specified this resource will wait until the instances are stable before returning. When UPDATED
is set, it will wait for the version target to be reached and any per instance configs to be effective as well as all instances to be stable before returning. The possible values are STABLE
and UPDATED