pulumi_wasm_providers_gcp_mini::compute

Module instance_group_manager

source
Expand description

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)

resources:
  autohealing:
    type: gcp:compute:HealthCheck
    properties:
      name: autohealing-health-check
      checkIntervalSec: 5
      timeoutSec: 5
      healthyThreshold: 2
      unhealthyThreshold: 10 # 50 seconds
      httpHealthCheck:
        requestPath: /healthz
        port: '8080'
  appserver:
    type: gcp:compute:InstanceGroupManager
    properties:
      name: appserver-igm
      baseInstanceName: app
      zone: us-central1-a
      versions:
        - instanceTemplate: ${appserverGoogleComputeInstanceTemplate.selfLinkUnique}
      allInstancesConfig:
        metadata:
          metadata_key: metadata_value
        labels:
          label_key: label_value
      targetPools:
        - ${appserverGoogleComputeTargetPool.id}
      targetSize: 2
      namedPorts:
        - name: customhttp
          port: 8888
      autoHealingPolicies:
        healthCheck: ${autohealing.id}
        initialDelaySec: 300

§With Multiple Versions (Google-Beta Provider)

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let appserver = instance_group_manager::create(
        "appserver",
        InstanceGroupManagerArgs::builder()
            .base_instance_name("app")
            .name("appserver-igm")
            .target_size(5)
            .versions(
                vec![
                    InstanceGroupManagerVersion::builder()
                    .instanceTemplate("${appserverGoogleComputeInstanceTemplate.selfLinkUnique}")
                    .name("appserver").build_struct(),
                    InstanceGroupManagerVersion::builder()
                    .instanceTemplate("${[\"appserver-canary\"].selfLinkUnique}")
                    .name("appserver-canary")
                    .targetSize(InstanceGroupManagerVersionTargetSize::builder().fixed(1)
                    .build_struct()).build_struct(),
                ],
            )
            .zone("us-central1-a")
            .build_struct(),
    );
}

§With Standby Policy (Google-Beta Provider)

resources:
  igm-sr:
    type: gcp:compute:InstanceGroupManager
    properties:
      name: tf-sr-igm
      baseInstanceName: tf-sr-igm-instance
      zone: us-central1-a
      targetSize: 5
      versions:
        - instanceTemplate: ${["sr-igm"].selfLink}
          name: primary
      standbyPolicy:
        initialDelaySec: 30
        mode: MANUAL
      targetSuspendedSize: 2
      targetStoppedSize: 1

§Import

Instance group managers can be imported using any of these accepted formats:

  • projects/{{project}}/zones/{{zone}}/instanceGroupManagers/{{name}}

  • {{project}}/{{zone}}/{{name}}

  • {{project}}/{{name}}

  • {{name}}

When using the pulumi import command, instance group managers can be imported using one of the formats above. For example:

$ pulumi import gcp:compute/instanceGroupManager:InstanceGroupManager default projects/{{project}}/zones/{{zone}}/instanceGroupManagers/{{name}}
$ pulumi import gcp:compute/instanceGroupManager:InstanceGroupManager default {{project}}/{{zone}}/{{name}}
$ pulumi import gcp:compute/instanceGroupManager:InstanceGroupManager default {{project}}/{{name}}
$ pulumi import gcp:compute/instanceGroupManager:InstanceGroupManager default {{name}}

Structs§

Functions§

  • Registers a new resource with the given unique name and arguments