All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.gcp.compute.kotlin.RegionInstanceGroupManager.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 8.10.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.compute.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerAllInstancesConfig
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerAutoHealingPolicies
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerInstanceLifecyclePolicy
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerNamedPort
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerParams
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerStatefulDisk
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerStatefulExternalIp
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerStatefulInternalIp
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerStatus
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerUpdatePolicy
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerVersion
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerAllInstancesConfig.Companion.toKotlin as regionInstanceGroupManagerAllInstancesConfigToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerAutoHealingPolicies.Companion.toKotlin as regionInstanceGroupManagerAutoHealingPoliciesToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerInstanceLifecyclePolicy.Companion.toKotlin as regionInstanceGroupManagerInstanceLifecyclePolicyToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerNamedPort.Companion.toKotlin as regionInstanceGroupManagerNamedPortToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerParams.Companion.toKotlin as regionInstanceGroupManagerParamsToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerStatefulDisk.Companion.toKotlin as regionInstanceGroupManagerStatefulDiskToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerStatefulExternalIp.Companion.toKotlin as regionInstanceGroupManagerStatefulExternalIpToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerStatefulInternalIp.Companion.toKotlin as regionInstanceGroupManagerStatefulInternalIpToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerStatus.Companion.toKotlin as regionInstanceGroupManagerStatusToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerUpdatePolicy.Companion.toKotlin as regionInstanceGroupManagerUpdatePolicyToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.RegionInstanceGroupManagerVersion.Companion.toKotlin as regionInstanceGroupManagerVersionToKotlin

/**
 * Builder for [RegionInstanceGroupManager].
 */
@PulumiTagMarker
public class RegionInstanceGroupManagerResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: RegionInstanceGroupManagerArgs = RegionInstanceGroupManagerArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend RegionInstanceGroupManagerArgsBuilder.() -> Unit) {
        val builder = RegionInstanceGroupManagerArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): RegionInstanceGroupManager {
        val builtJavaResource =
            com.pulumi.gcp.compute.RegionInstanceGroupManager(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return RegionInstanceGroupManager(builtJavaResource)
    }
}

/**
 * The Google Compute Engine Regional Instance Group Manager API creates and manages pools
 * of homogeneous Compute Engine virtual machine instances from a common instance
 * template.
 * To get more information about regionInstanceGroupManagers, see:
 * * [API documentation](https://cloud.google.com/compute/docs/reference/latest/regionInstanceGroupManagers)
 * * How-to Guides
 *     * [Regional Instance Groups Guide](https://cloud.google.com/compute/docs/instance-groups/distributing-instances-with-regional-instance-groups)
 * > **Note:** Use [gcp.compute.InstanceGroupManager](https://www.terraform.io/docs/providers/google/r/compute_instance_group_manager.html) to create a zonal 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.RegionInstanceGroupManager("appserver", {
 *     name: "appserver-igm",
 *     baseInstanceName: "app",
 *     region: "us-central1",
 *     distributionPolicyZones: [
 *         "us-central1-a",
 *         "us-central1-f",
 *     ],
 *     versions: [{
 *         instanceTemplate: appserverGoogleComputeInstanceTemplate.selfLinkUnique,
 *     }],
 *     allInstancesConfig: {
 *         metadata: {
 *             metadata_key: "metadata_value",
 *         },
 *         labels: {
 *             label_key: "label_value",
 *         },
 *     },
 *     targetPools: [appserverGoogleComputeTargetPool.id],
 *     targetSize: 2,
 *     namedPorts: [{
 *         name: "custom",
 *         port: 8888,
 *     }],
 *     autoHealingPolicies: {
 *         healthCheck: autohealing.id,
 *         initialDelaySec: 300,
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * autohealing = gcp.compute.HealthCheck("autohealing",
 *     name="autohealing-health-check",
 *     check_interval_sec=5,
 *     timeout_sec=5,
 *     healthy_threshold=2,
 *     unhealthy_threshold=10,
 *     http_health_check=gcp.compute.HealthCheckHttpHealthCheckArgs(
 *         request_path="/healthz",
 *         port=8080,
 *     ))
 * appserver = gcp.compute.RegionInstanceGroupManager("appserver",
 *     name="appserver-igm",
 *     base_instance_name="app",
 *     region="us-central1",
 *     distribution_policy_zones=[
 *         "us-central1-a",
 *         "us-central1-f",
 *     ],
 *     versions=[gcp.compute.RegionInstanceGroupManagerVersionArgs(
 *         instance_template=appserver_google_compute_instance_template["selfLinkUnique"],
 *     )],
 *     all_instances_config=gcp.compute.RegionInstanceGroupManagerAllInstancesConfigArgs(
 *         metadata={
 *             "metadata_key": "metadata_value",
 *         },
 *         labels={
 *             "label_key": "label_value",
 *         },
 *     ),
 *     target_pools=[appserver_google_compute_target_pool["id"]],
 *     target_size=2,
 *     named_ports=[gcp.compute.RegionInstanceGroupManagerNamedPortArgs(
 *         name="custom",
 *         port=8888,
 *     )],
 *     auto_healing_policies=gcp.compute.RegionInstanceGroupManagerAutoHealingPoliciesArgs(
 *         health_check=autohealing.id,
 *         initial_delay_sec=300,
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var autohealing = new Gcp.Compute.HealthCheck("autohealing", new()
 *     {
 *         Name = "autohealing-health-check",
 *         CheckIntervalSec = 5,
 *         TimeoutSec = 5,
 *         HealthyThreshold = 2,
 *         UnhealthyThreshold = 10,
 *         HttpHealthCheck = new Gcp.Compute.Inputs.HealthCheckHttpHealthCheckArgs
 *         {
 *             RequestPath = "/healthz",
 *             Port = 8080,
 *         },
 *     });
 *     var appserver = new Gcp.Compute.RegionInstanceGroupManager("appserver", new()
 *     {
 *         Name = "appserver-igm",
 *         BaseInstanceName = "app",
 *         Region = "us-central1",
 *         DistributionPolicyZones = new[]
 *         {
 *             "us-central1-a",
 *             "us-central1-f",
 *         },
 *         Versions = new[]
 *         {
 *             new Gcp.Compute.Inputs.RegionInstanceGroupManagerVersionArgs
 *             {
 *                 InstanceTemplate = appserverGoogleComputeInstanceTemplate.SelfLinkUnique,
 *             },
 *         },
 *         AllInstancesConfig = new Gcp.Compute.Inputs.RegionInstanceGroupManagerAllInstancesConfigArgs
 *         {
 *             Metadata =
 *             {
 *                 { "metadata_key", "metadata_value" },
 *             },
 *             Labels =
 *             {
 *                 { "label_key", "label_value" },
 *             },
 *         },
 *         TargetPools = new[]
 *         {
 *             appserverGoogleComputeTargetPool.Id,
 *         },
 *         TargetSize = 2,
 *         NamedPorts = new[]
 *         {
 *             new Gcp.Compute.Inputs.RegionInstanceGroupManagerNamedPortArgs
 *             {
 *                 Name = "custom",
 *                 Port = 8888,
 *             },
 *         },
 *         AutoHealingPolicies = new Gcp.Compute.Inputs.RegionInstanceGroupManagerAutoHealingPoliciesArgs
 *         {
 *             HealthCheck = autohealing.Id,
 *             InitialDelaySec = 300,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		autohealing, err := compute.NewHealthCheck(ctx, "autohealing", &compute.HealthCheckArgs{
 * 			Name:               pulumi.String("autohealing-health-check"),
 * 			CheckIntervalSec:   pulumi.Int(5),
 * 			TimeoutSec:         pulumi.Int(5),
 * 			HealthyThreshold:   pulumi.Int(2),
 * 			UnhealthyThreshold: pulumi.Int(10),
 * 			HttpHealthCheck: &compute.HealthCheckHttpHealthCheckArgs{
 * 				RequestPath: pulumi.String("/healthz"),
 * 				Port:        pulumi.Int(8080),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewRegionInstanceGroupManager(ctx, "appserver", &compute.RegionInstanceGroupManagerArgs{
 * 			Name:             pulumi.String("appserver-igm"),
 * 			BaseInstanceName: pulumi.String("app"),
 * 			Region:           pulumi.String("us-central1"),
 * 			DistributionPolicyZones: pulumi.StringArray{
 * 				pulumi.String("us-central1-a"),
 * 				pulumi.String("us-central1-f"),
 * 			},
 * 			Versions: compute.RegionInstanceGroupManagerVersionArray{
 * 				&compute.RegionInstanceGroupManagerVersionArgs{
 * 					InstanceTemplate: pulumi.Any(appserverGoogleComputeInstanceTemplate.SelfLinkUnique),
 * 				},
 * 			},
 * 			AllInstancesConfig: &compute.RegionInstanceGroupManagerAllInstancesConfigArgs{
 * 				Metadata: pulumi.StringMap{
 * 					"metadata_key": pulumi.String("metadata_value"),
 * 				},
 * 				Labels: pulumi.StringMap{
 * 					"label_key": pulumi.String("label_value"),
 * 				},
 * 			},
 * 			TargetPools: pulumi.StringArray{
 * 				appserverGoogleComputeTargetPool.Id,
 * 			},
 * 			TargetSize: pulumi.Int(2),
 * 			NamedPorts: compute.RegionInstanceGroupManagerNamedPortArray{
 * 				&compute.RegionInstanceGroupManagerNamedPortArgs{
 * 					Name: pulumi.String("custom"),
 * 					Port: pulumi.Int(8888),
 * 				},
 * 			},
 * 			AutoHealingPolicies: &compute.RegionInstanceGroupManagerAutoHealingPoliciesArgs{
 * 				HealthCheck:     autohealing.ID(),
 * 				InitialDelaySec: pulumi.Int(300),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * 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.RegionInstanceGroupManager;
 * import com.pulumi.gcp.compute.RegionInstanceGroupManagerArgs;
 * import com.pulumi.gcp.compute.inputs.RegionInstanceGroupManagerVersionArgs;
 * import com.pulumi.gcp.compute.inputs.RegionInstanceGroupManagerAllInstancesConfigArgs;
 * import com.pulumi.gcp.compute.inputs.RegionInstanceGroupManagerNamedPortArgs;
 * import com.pulumi.gcp.compute.inputs.RegionInstanceGroupManagerAutoHealingPoliciesArgs;
 * 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()
 *             .name("autohealing-health-check")
 *             .checkIntervalSec(5)
 *             .timeoutSec(5)
 *             .healthyThreshold(2)
 *             .unhealthyThreshold(10)
 *             .httpHealthCheck(HealthCheckHttpHealthCheckArgs.builder()
 *                 .requestPath("/healthz")
 *                 .port("8080")
 *                 .build())
 *             .build());
 *         var appserver = new RegionInstanceGroupManager("appserver", RegionInstanceGroupManagerArgs.builder()
 *             .name("appserver-igm")
 *             .baseInstanceName("app")
 *             .region("us-central1")
 *             .distributionPolicyZones(
 *                 "us-central1-a",
 *                 "us-central1-f")
 *             .versions(RegionInstanceGroupManagerVersionArgs.builder()
 *                 .instanceTemplate(appserverGoogleComputeInstanceTemplate.selfLinkUnique())
 *                 .build())
 *             .allInstancesConfig(RegionInstanceGroupManagerAllInstancesConfigArgs.builder()
 *                 .metadata(Map.of("metadata_key", "metadata_value"))
 *                 .labels(Map.of("label_key", "label_value"))
 *                 .build())
 *             .targetPools(appserverGoogleComputeTargetPool.id())
 *             .targetSize(2)
 *             .namedPorts(RegionInstanceGroupManagerNamedPortArgs.builder()
 *                 .name("custom")
 *                 .port(8888)
 *                 .build())
 *             .autoHealingPolicies(RegionInstanceGroupManagerAutoHealingPoliciesArgs.builder()
 *                 .healthCheck(autohealing.id())
 *                 .initialDelaySec(300)
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * 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:RegionInstanceGroupManager
 *     properties:
 *       name: appserver-igm
 *       baseInstanceName: app
 *       region: us-central1
 *       distributionPolicyZones:
 *         - us-central1-a
 *         - us-central1-f
 *       versions:
 *         - instanceTemplate: ${appserverGoogleComputeInstanceTemplate.selfLinkUnique}
 *       allInstancesConfig:
 *         metadata:
 *           metadata_key: metadata_value
 *         labels:
 *           label_key: label_value
 *       targetPools:
 *         - ${appserverGoogleComputeTargetPool.id}
 *       targetSize: 2
 *       namedPorts:
 *         - name: custom
 *           port: 8888
 *       autoHealingPolicies:
 *         healthCheck: ${autohealing.id}
 *         initialDelaySec: 300
 * ```
 * 
 * ### With Multiple Versions
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const appserver = new gcp.compute.RegionInstanceGroupManager("appserver", {
 *     name: "appserver-igm",
 *     baseInstanceName: "app",
 *     region: "us-central1",
 *     targetSize: 5,
 *     versions: [
 *         {
 *             instanceTemplate: appserverGoogleComputeInstanceTemplate.selfLinkUnique,
 *         },
 *         {
 *             instanceTemplate: appserver_canary.selfLinkUnique,
 *             targetSize: {
 *                 fixed: 1,
 *             },
 *         },
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * appserver = gcp.compute.RegionInstanceGroupManager("appserver",
 *     name="appserver-igm",
 *     base_instance_name="app",
 *     region="us-central1",
 *     target_size=5,
 *     versions=[
 *         gcp.compute.RegionInstanceGroupManagerVersionArgs(
 *             instance_template=appserver_google_compute_instance_template["selfLinkUnique"],
 *         ),
 *         gcp.compute.RegionInstanceGroupManagerVersionArgs(
 *             instance_template=appserver_canary["selfLinkUnique"],
 *             target_size=gcp.compute.RegionInstanceGroupManagerVersionTargetSizeArgs(
 *                 fixed=1,
 *             ),
 *         ),
 *     ])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var appserver = new Gcp.Compute.RegionInstanceGroupManager("appserver", new()
 *     {
 *         Name = "appserver-igm",
 *         BaseInstanceName = "app",
 *         Region = "us-central1",
 *         TargetSize = 5,
 *         Versions = new[]
 *         {
 *             new Gcp.Compute.Inputs.RegionInstanceGroupManagerVersionArgs
 *             {
 *                 InstanceTemplate = appserverGoogleComputeInstanceTemplate.SelfLinkUnique,
 *             },
 *             new Gcp.Compute.Inputs.RegionInstanceGroupManagerVersionArgs
 *             {
 *                 InstanceTemplate = appserver_canary.SelfLinkUnique,
 *                 TargetSize = new Gcp.Compute.Inputs.RegionInstanceGroupManagerVersionTargetSizeArgs
 *                 {
 *                     Fixed = 1,
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := compute.NewRegionInstanceGroupManager(ctx, "appserver", &compute.RegionInstanceGroupManagerArgs{
 * 			Name:             pulumi.String("appserver-igm"),
 * 			BaseInstanceName: pulumi.String("app"),
 * 			Region:           pulumi.String("us-central1"),
 * 			TargetSize:       pulumi.Int(5),
 * 			Versions: compute.RegionInstanceGroupManagerVersionArray{
 * 				&compute.RegionInstanceGroupManagerVersionArgs{
 * 					InstanceTemplate: pulumi.Any(appserverGoogleComputeInstanceTemplate.SelfLinkUnique),
 * 				},
 * 				&compute.RegionInstanceGroupManagerVersionArgs{
 * 					InstanceTemplate: pulumi.Any(appserver_canary.SelfLinkUnique),
 * 					TargetSize: &compute.RegionInstanceGroupManagerVersionTargetSizeArgs{
 * 						Fixed: pulumi.Int(1),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.gcp.compute.RegionInstanceGroupManager;
 * import com.pulumi.gcp.compute.RegionInstanceGroupManagerArgs;
 * import com.pulumi.gcp.compute.inputs.RegionInstanceGroupManagerVersionArgs;
 * import com.pulumi.gcp.compute.inputs.RegionInstanceGroupManagerVersionTargetSizeArgs;
 * 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 RegionInstanceGroupManager("appserver", RegionInstanceGroupManagerArgs.builder()
 *             .name("appserver-igm")
 *             .baseInstanceName("app")
 *             .region("us-central1")
 *             .targetSize(5)
 *             .versions(
 *                 RegionInstanceGroupManagerVersionArgs.builder()
 *                     .instanceTemplate(appserverGoogleComputeInstanceTemplate.selfLinkUnique())
 *                     .build(),
 *                 RegionInstanceGroupManagerVersionArgs.builder()
 *                     .instanceTemplate(appserver_canary.selfLinkUnique())
 *                     .targetSize(RegionInstanceGroupManagerVersionTargetSizeArgs.builder()
 *                         .fixed(1)
 *                         .build())
 *                     .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   appserver:
 *     type: gcp:compute:RegionInstanceGroupManager
 *     properties:
 *       name: appserver-igm
 *       baseInstanceName: app
 *       region: us-central1
 *       targetSize: 5
 *       versions:
 *         - instanceTemplate: ${appserverGoogleComputeInstanceTemplate.selfLinkUnique}
 *         - instanceTemplate: ${["appserver-canary"].selfLinkUnique}
 *           targetSize:
 *             fixed: 1
 * ```
 * 
 * ## Import
 * Instance group managers can be imported using any of these accepted formats:
 * * `{{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/regionInstanceGroupManager:RegionInstanceGroupManager default {{name}}
 * ```
 */
public class RegionInstanceGroupManager internal constructor(
    override val javaResource: com.pulumi.gcp.compute.RegionInstanceGroupManager,
) : KotlinCustomResource(javaResource, RegionInstanceGroupManagerMapper) {
    /**
     * 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.
     */
    public val allInstancesConfig: Output?
        get() = javaResource.allInstancesConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    regionInstanceGroupManagerAllInstancesConfigToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * 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](https://cloud.google.com/compute/docs/instance-groups/creating-groups-of-managed-instances#monitoring_groups).
     */
    public val autoHealingPolicies: Output?
        get() = javaResource.autoHealingPolicies().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    regionInstanceGroupManagerAutoHealingPoliciesToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The base instance name to use for
     * instances in this group. The value must be a valid
     * [RFC1035](https://www.ietf.org/rfc/rfc1035.txt) 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.
     */
    public val baseInstanceName: Output
        get() = javaResource.baseInstanceName().applyValue({ args0 -> args0 })

    /**
     * Creation timestamp in RFC3339 text format.
     */
    public val creationTimestamp: Output
        get() = javaResource.creationTimestamp().applyValue({ args0 -> args0 })

    /**
     * An optional textual description of the instance
     * group manager.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The shape to which the group converges either proactively or on resize events (depending on the value set in update_policy.0.instance_redistribution_type). For more information see the [official documentation](https://cloud.google.com/compute/docs/instance-groups/regional-mig-distribution-shape).
     */
    public val distributionPolicyTargetShape: Output
        get() = javaResource.distributionPolicyTargetShape().applyValue({ args0 -> args0 })

    /**
     * The distribution policy for this managed instance
     * group. You can specify one or more values. For more information, see the [official documentation](https://cloud.google.com/compute/docs/instance-groups/distributing-instances-with-regional-instance-groups#selectingzones).
     */
    public val distributionPolicyZones: Output>
        get() = javaResource.distributionPolicyZones().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            })
        })

    /**
     * The fingerprint of the instance group manager.
     */
    public val fingerprint: Output
        get() = javaResource.fingerprint().applyValue({ args0 -> args0 })

    /**
     * The full URL of the instance group created by the manager.
     */
    public val instanceGroup: Output
        get() = javaResource.instanceGroup().applyValue({ args0 -> args0 })

    /**
     * The instance lifecycle policy for this managed instance group.
     */
    public val instanceLifecyclePolicy: Output
        get() = javaResource.instanceLifecyclePolicy().applyValue({ args0 ->
            args0.let({ args0 ->
                regionInstanceGroupManagerInstanceLifecyclePolicyToKotlin(args0)
            })
        })

    /**
     * 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.
     */
    public val listManagedInstancesResults: Output?
        get() = javaResource.listManagedInstancesResults().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the instance group manager. Must be 1-63
     * characters long and comply with
     * [RFC1035](https://www.ietf.org/rfc/rfc1035.txt). Supported characters
     * include lowercase letters, numbers, and hyphens.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The named port configuration. See the section below
     * for details on configuration.
     */
    public val namedPorts: Output>?
        get() = javaResource.namedPorts().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> regionInstanceGroupManagerNamedPortToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * Input only additional params for instance group manager creation. Structure is documented below. For more information, see [API](https://cloud.google.com/compute/docs/reference/rest/beta/instanceGroupManagers/insert).
     * - - -
     */
    public val params: Output?
        get() = javaResource.params().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    regionInstanceGroupManagerParamsToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The ID of the project in which the resource belongs. If it
     * is not provided, the provider project is used.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * The region where the managed instance group resides. If not provided, the provider region is used.
     * - - -
     */
    public val region: Output
        get() = javaResource.region().applyValue({ args0 -> args0 })

    /**
     * The URL of the created resource.
     */
    public val selfLink: Output
        get() = javaResource.selfLink().applyValue({ args0 -> args0 })

    /**
     * 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](https://cloud.google.com/compute/docs/instance-groups/configuring-stateful-disks-in-migs). Proactive cross zone instance redistribution must be disabled before you can update stateful disks on existing instance group managers. This can be controlled via the `update_policy`.
     */
    public val statefulDisks: Output>?
        get() = javaResource.statefulDisks().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        regionInstanceGroupManagerStatefulDiskToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * 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.
     */
    public val statefulExternalIps: Output>?
        get() = javaResource.statefulExternalIps().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        regionInstanceGroupManagerStatefulExternalIpToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * 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.
     */
    public val statefulInternalIps: Output>?
        get() = javaResource.statefulInternalIps().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        regionInstanceGroupManagerStatefulInternalIpToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * The status of this managed instance group.
     */
    public val statuses: Output>
        get() = javaResource.statuses().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    regionInstanceGroupManagerStatusToKotlin(args0)
                })
            })
        })

    /**
     * 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.
     */
    public val targetPools: Output>?
        get() = javaResource.targetPools().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * 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.
     */
    public val targetSize: Output
        get() = javaResource.targetSize().applyValue({ args0 -> args0 })

    /**
     * The update policy for this managed instance group. Structure is documented below. For more information, see the [official documentation](https://cloud.google.com/compute/docs/instance-groups/updating-managed-instance-groups) and [API](https://cloud.google.com/compute/docs/reference/rest/beta/regionInstanceGroupManagers/patch)
     */
    public val updatePolicy: Output
        get() = javaResource.updatePolicy().applyValue({ args0 ->
            args0.let({ args0 ->
                regionInstanceGroupManagerUpdatePolicyToKotlin(args0)
            })
        })

    /**
     * Application versions managed by this instance group. Each
     * version deals with a specific instance template, allowing canary release scenarios.
     * Structure is documented below.
     */
    public val versions: Output>
        get() = javaResource.versions().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    regionInstanceGroupManagerVersionToKotlin(args0)
                })
            })
        })

    /**
     * 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, the provider will
     * continue trying until it times out.
     */
    public val waitForInstances: Output?
        get() = javaResource.waitForInstances().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * 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`
     */
    public val waitForInstancesStatus: Output?
        get() = javaResource.waitForInstancesStatus().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object RegionInstanceGroupManagerMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.compute.RegionInstanceGroupManager::class == javaResource::class

    override fun map(javaResource: Resource): RegionInstanceGroupManager =
        RegionInstanceGroupManager(javaResource as com.pulumi.gcp.compute.RegionInstanceGroupManager)
}

/**
 * @see [RegionInstanceGroupManager].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [RegionInstanceGroupManager].
 */
public suspend fun regionInstanceGroupManager(
    name: String,
    block: suspend RegionInstanceGroupManagerResourceBuilder.() -> Unit,
): RegionInstanceGroupManager {
    val builder = RegionInstanceGroupManagerResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [RegionInstanceGroupManager].
 * @param name The _unique_ name of the resulting resource.
 */
public fun regionInstanceGroupManager(name: String): RegionInstanceGroupManager {
    val builder = RegionInstanceGroupManagerResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy