"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.InstanceGroupManager = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * 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](https://cloud.google.com/compute/docs/instance-groups/manager)
 * and [API](https://cloud.google.com/compute/docs/reference/latest/instanceGroupManagers)
 *
 * > **Note:** Use [gcp.compute.RegionInstanceGroupManager](https://www.terraform.io/docs/providers/google/r/compute_region_instance_group_manager.html) to create a regional (multi-zone) instance group manager.
 *
 * ## Example Usage
 *
 * ### With Top Level Instance Template (`Google` Provider)
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const autohealing = new gcp.compute.HealthCheck("autohealing", {
 *     name: "autohealing-health-check",
 *     checkIntervalSec: 5,
 *     timeoutSec: 5,
 *     healthyThreshold: 2,
 *     unhealthyThreshold: 10,
 *     httpHealthCheck: {
 *         requestPath: "/healthz",
 *         port: 8080,
 *     },
 * });
 * const appserver = new gcp.compute.InstanceGroupManager("appserver", {
 *     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)
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const appserver = new gcp.compute.InstanceGroupManager("appserver", {
 *     name: "appserver-igm",
 *     baseInstanceName: "app",
 *     zone: "us-central1-a",
 *     targetSize: 5,
 *     versions: [
 *         {
 *             name: "appserver",
 *             instanceTemplate: appserverGoogleComputeInstanceTemplate.selfLinkUnique,
 *         },
 *         {
 *             name: "appserver-canary",
 *             instanceTemplate: appserver_canary.selfLinkUnique,
 *             targetSize: {
 *                 fixed: 1,
 *             },
 *         },
 *     ],
 * });
 * ```
 *
 * ### With Standby Policy (`Google` Provider)
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const igm_sr = new gcp.compute.InstanceGroupManager("igm-sr", {
 *     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,
 * });
 * ```
 *
 * ### With Resource Policies (`Google` Provider)
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const myImage = gcp.compute.getImage({
 *     family: "debian-11",
 *     project: "debian-cloud",
 * });
 * const workloadPolicy = new gcp.compute.ResourcePolicy("workload_policy", {
 *     name: "tf-test-gce-policy",
 *     region: "us-central1",
 *     workloadPolicy: {
 *         type: "HIGH_THROUGHPUT",
 *     },
 * });
 * const igm_basic = new gcp.compute.InstanceTemplate("igm-basic", {
 *     name: "igm-instance-template",
 *     machineType: "a4-highgpu-8g",
 *     canIpForward: false,
 *     tags: [
 *         "foo",
 *         "bar",
 *     ],
 *     disks: [{
 *         sourceImage: myImage.then(myImage => myImage.selfLink),
 *         autoDelete: true,
 *         boot: true,
 *         diskType: "hyperdisk-balanced",
 *     }],
 *     networkInterfaces: [{
 *         network: "default",
 *     }],
 *     serviceAccount: {
 *         scopes: [
 *             "userinfo-email",
 *             "compute-ro",
 *             "storage-ro",
 *         ],
 *     },
 * });
 * const igm_workload_policy = new gcp.compute.InstanceGroupManager("igm-workload-policy", {
 *     description: "Terraform test instance group manager",
 *     name: "igm-basic-workload-policy",
 *     versions: [{
 *         name: "prod",
 *         instanceTemplate: igm_basic.selfLink,
 *     }],
 *     baseInstanceName: "tf-test-igm-no-tp",
 *     zone: "us-central1-b",
 *     targetSize: 0,
 *     resourcePolicies: {
 *         workloadPolicy: workloadPolicy.selfLink,
 *     },
 * });
 * ```
 *
 * ## 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:
 *
 * ```sh
 * $ pulumi import gcp:compute/instanceGroupManager:InstanceGroupManager default projects/{{project}}/zones/{{zone}}/instanceGroupManagers/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/instanceGroupManager:InstanceGroupManager default {{project}}/{{zone}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/instanceGroupManager:InstanceGroupManager default {{project}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/instanceGroupManager:InstanceGroupManager default {{name}}
 * ```
 */
class InstanceGroupManager extends pulumi.CustomResource {
    /**
     * Get an existing InstanceGroupManager resource's state with the given name, ID, and optional extra
     * properties used to qualify the lookup.
     *
     * @param name The _unique_ name of the resulting resource.
     * @param id The _unique_ provider ID of the resource to lookup.
     * @param state Any extra arguments used during the lookup.
     * @param opts Optional settings to control the behavior of the CustomResource.
     */
    static get(name, id, state, opts) {
        return new InstanceGroupManager(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of InstanceGroupManager.  This is designed to work even
     * when multiple copies of the Pulumi SDK have been loaded into the same process.
     */
    static isInstance(obj) {
        if (obj === undefined || obj === null) {
            return false;
        }
        return obj['__pulumiType'] === InstanceGroupManager.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["allInstancesConfig"] = state?.allInstancesConfig;
            resourceInputs["autoHealingPolicies"] = state?.autoHealingPolicies;
            resourceInputs["baseInstanceName"] = state?.baseInstanceName;
            resourceInputs["creationTimestamp"] = state?.creationTimestamp;
            resourceInputs["description"] = state?.description;
            resourceInputs["fingerprint"] = state?.fingerprint;
            resourceInputs["instanceGroup"] = state?.instanceGroup;
            resourceInputs["instanceGroupManagerId"] = state?.instanceGroupManagerId;
            resourceInputs["instanceLifecyclePolicy"] = state?.instanceLifecyclePolicy;
            resourceInputs["listManagedInstancesResults"] = state?.listManagedInstancesResults;
            resourceInputs["name"] = state?.name;
            resourceInputs["namedPorts"] = state?.namedPorts;
            resourceInputs["operation"] = state?.operation;
            resourceInputs["params"] = state?.params;
            resourceInputs["project"] = state?.project;
            resourceInputs["resourcePolicies"] = state?.resourcePolicies;
            resourceInputs["selfLink"] = state?.selfLink;
            resourceInputs["standbyPolicy"] = state?.standbyPolicy;
            resourceInputs["statefulDisks"] = state?.statefulDisks;
            resourceInputs["statefulExternalIps"] = state?.statefulExternalIps;
            resourceInputs["statefulInternalIps"] = state?.statefulInternalIps;
            resourceInputs["statuses"] = state?.statuses;
            resourceInputs["targetPools"] = state?.targetPools;
            resourceInputs["targetSize"] = state?.targetSize;
            resourceInputs["targetStoppedSize"] = state?.targetStoppedSize;
            resourceInputs["targetSuspendedSize"] = state?.targetSuspendedSize;
            resourceInputs["updatePolicy"] = state?.updatePolicy;
            resourceInputs["versions"] = state?.versions;
            resourceInputs["waitForInstances"] = state?.waitForInstances;
            resourceInputs["waitForInstancesStatus"] = state?.waitForInstancesStatus;
            resourceInputs["zone"] = state?.zone;
        }
        else {
            const args = argsOrState;
            if (args?.baseInstanceName === undefined && !opts.urn) {
                throw new Error("Missing required property 'baseInstanceName'");
            }
            if (args?.versions === undefined && !opts.urn) {
                throw new Error("Missing required property 'versions'");
            }
            resourceInputs["allInstancesConfig"] = args?.allInstancesConfig;
            resourceInputs["autoHealingPolicies"] = args?.autoHealingPolicies;
            resourceInputs["baseInstanceName"] = args?.baseInstanceName;
            resourceInputs["description"] = args?.description;
            resourceInputs["instanceLifecyclePolicy"] = args?.instanceLifecyclePolicy;
            resourceInputs["listManagedInstancesResults"] = args?.listManagedInstancesResults;
            resourceInputs["name"] = args?.name;
            resourceInputs["namedPorts"] = args?.namedPorts;
            resourceInputs["params"] = args?.params;
            resourceInputs["project"] = args?.project;
            resourceInputs["resourcePolicies"] = args?.resourcePolicies;
            resourceInputs["standbyPolicy"] = args?.standbyPolicy;
            resourceInputs["statefulDisks"] = args?.statefulDisks;
            resourceInputs["statefulExternalIps"] = args?.statefulExternalIps;
            resourceInputs["statefulInternalIps"] = args?.statefulInternalIps;
            resourceInputs["targetPools"] = args?.targetPools;
            resourceInputs["targetSize"] = args?.targetSize;
            resourceInputs["targetStoppedSize"] = args?.targetStoppedSize;
            resourceInputs["targetSuspendedSize"] = args?.targetSuspendedSize;
            resourceInputs["updatePolicy"] = args?.updatePolicy;
            resourceInputs["versions"] = args?.versions;
            resourceInputs["waitForInstances"] = args?.waitForInstances;
            resourceInputs["waitForInstancesStatus"] = args?.waitForInstancesStatus;
            resourceInputs["zone"] = args?.zone;
            resourceInputs["creationTimestamp"] = undefined /*out*/;
            resourceInputs["fingerprint"] = undefined /*out*/;
            resourceInputs["instanceGroup"] = undefined /*out*/;
            resourceInputs["instanceGroupManagerId"] = undefined /*out*/;
            resourceInputs["operation"] = undefined /*out*/;
            resourceInputs["selfLink"] = undefined /*out*/;
            resourceInputs["statuses"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(InstanceGroupManager.__pulumiType, name, resourceInputs, opts);
    }
}
exports.InstanceGroupManager = InstanceGroupManager;
/** @internal */
InstanceGroupManager.__pulumiType = 'gcp:compute/instanceGroupManager:InstanceGroupManager';
//# sourceMappingURL=instanceGroupManager.js.map