"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.RegionPerInstanceConfig = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * A config defined for a single managed instance that belongs to an instance group manager. It preserves the instance name
 * across instance group manager operations and can define stateful disks or metadata that are unique to the instance.
 * This resource works with regional instance group managers.
 *
 * To get more information about RegionPerInstanceConfig, see:
 *
 * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/instanceGroupManagers)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/compute/docs/instance-groups/stateful-migs#per-instance_configs)
 *
 * ## Example Usage
 *
 * ### Stateful Rigm
 *
 * ```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 igm_basic = new gcp.compute.InstanceTemplate("igm-basic", {
 *     name: "my-template",
 *     machineType: "e2-medium",
 *     canIpForward: false,
 *     tags: [
 *         "foo",
 *         "bar",
 *     ],
 *     disks: [{
 *         sourceImage: myImage.then(myImage => myImage.selfLink),
 *         autoDelete: true,
 *         boot: true,
 *     }],
 *     networkInterfaces: [{
 *         network: "default",
 *     }],
 *     serviceAccount: {
 *         scopes: [
 *             "userinfo-email",
 *             "compute-ro",
 *             "storage-ro",
 *         ],
 *     },
 * });
 * const rigm = new gcp.compute.RegionInstanceGroupManager("rigm", {
 *     description: "Demo test instance group manager",
 *     name: "my-rigm",
 *     versions: [{
 *         name: "prod",
 *         instanceTemplate: igm_basic.selfLink,
 *     }],
 *     updatePolicy: {
 *         type: "OPPORTUNISTIC",
 *         instanceRedistributionType: "NONE",
 *         minimalAction: "RESTART",
 *     },
 *     baseInstanceName: "rigm",
 *     region: "us-central1",
 *     targetSize: 2,
 * });
 * const _default = new gcp.compute.Disk("default", {
 *     name: "my-disk-name",
 *     type: "pd-ssd",
 *     zone: "us-central1-a",
 *     image: "debian-11-bullseye-v20220719",
 *     physicalBlockSizeBytes: 4096,
 * });
 * const withDisk = new gcp.compute.RegionPerInstanceConfig("with_disk", {
 *     region: igm.region,
 *     regionInstanceGroupManager: rigm.name,
 *     name: "instance-1",
 *     preservedState: {
 *         metadata: {
 *             foo: "bar",
 *             instance_template: igm_basic.selfLink,
 *         },
 *         disks: [{
 *             deviceName: "my-stateful-disk",
 *             source: _default.id,
 *             mode: "READ_ONLY",
 *         }],
 *     },
 * });
 * ```
 *
 * ## Import
 *
 * RegionPerInstanceConfig can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/regions/{{region}}/instanceGroupManagers/{{region_instance_group_manager}}/{{name}}`
 *
 * * `{{project}}/{{region}}/{{region_instance_group_manager}}/{{name}}`
 *
 * * `{{region}}/{{region_instance_group_manager}}/{{name}}`
 *
 * * `{{region_instance_group_manager}}/{{name}}`
 *
 * When using the `pulumi import` command, RegionPerInstanceConfig can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:compute/regionPerInstanceConfig:RegionPerInstanceConfig default projects/{{project}}/regions/{{region}}/instanceGroupManagers/{{region_instance_group_manager}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/regionPerInstanceConfig:RegionPerInstanceConfig default {{project}}/{{region}}/{{region_instance_group_manager}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/regionPerInstanceConfig:RegionPerInstanceConfig default {{region}}/{{region_instance_group_manager}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/regionPerInstanceConfig:RegionPerInstanceConfig default {{region_instance_group_manager}}/{{name}}
 * ```
 */
class RegionPerInstanceConfig extends pulumi.CustomResource {
    /**
     * Get an existing RegionPerInstanceConfig 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 RegionPerInstanceConfig(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of RegionPerInstanceConfig.  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'] === RegionPerInstanceConfig.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["minimalAction"] = state?.minimalAction;
            resourceInputs["mostDisruptiveAllowedAction"] = state?.mostDisruptiveAllowedAction;
            resourceInputs["name"] = state?.name;
            resourceInputs["preservedState"] = state?.preservedState;
            resourceInputs["project"] = state?.project;
            resourceInputs["region"] = state?.region;
            resourceInputs["regionInstanceGroupManager"] = state?.regionInstanceGroupManager;
            resourceInputs["removeInstanceOnDestroy"] = state?.removeInstanceOnDestroy;
            resourceInputs["removeInstanceStateOnDestroy"] = state?.removeInstanceStateOnDestroy;
        }
        else {
            const args = argsOrState;
            if (args?.regionInstanceGroupManager === undefined && !opts.urn) {
                throw new Error("Missing required property 'regionInstanceGroupManager'");
            }
            resourceInputs["minimalAction"] = args?.minimalAction;
            resourceInputs["mostDisruptiveAllowedAction"] = args?.mostDisruptiveAllowedAction;
            resourceInputs["name"] = args?.name;
            resourceInputs["preservedState"] = args?.preservedState;
            resourceInputs["project"] = args?.project;
            resourceInputs["region"] = args?.region;
            resourceInputs["regionInstanceGroupManager"] = args?.regionInstanceGroupManager;
            resourceInputs["removeInstanceOnDestroy"] = args?.removeInstanceOnDestroy;
            resourceInputs["removeInstanceStateOnDestroy"] = args?.removeInstanceStateOnDestroy;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(RegionPerInstanceConfig.__pulumiType, name, resourceInputs, opts);
    }
}
exports.RegionPerInstanceConfig = RegionPerInstanceConfig;
/** @internal */
RegionPerInstanceConfig.__pulumiType = 'gcp:compute/regionPerInstanceConfig:RegionPerInstanceConfig';
//# sourceMappingURL=regionPerInstanceConfig.js.map