com.pulumi.gcp.compute.kotlin.InstanceFromMachineImage.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.compute.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageAdvancedMachineFeatures
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageAttachedDisk
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageBootDisk
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageConfidentialInstanceConfig
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageGuestAccelerator
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageNetworkInterface
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageNetworkPerformanceConfig
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageParams
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageReservationAffinity
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageScheduling
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageScratchDisk
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageServiceAccount
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageShieldedInstanceConfig
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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageAdvancedMachineFeatures.Companion.toKotlin as instanceFromMachineImageAdvancedMachineFeaturesToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageAttachedDisk.Companion.toKotlin as instanceFromMachineImageAttachedDiskToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageBootDisk.Companion.toKotlin as instanceFromMachineImageBootDiskToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageConfidentialInstanceConfig.Companion.toKotlin as instanceFromMachineImageConfidentialInstanceConfigToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageGuestAccelerator.Companion.toKotlin as instanceFromMachineImageGuestAcceleratorToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageNetworkInterface.Companion.toKotlin as instanceFromMachineImageNetworkInterfaceToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageNetworkPerformanceConfig.Companion.toKotlin as instanceFromMachineImageNetworkPerformanceConfigToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageParams.Companion.toKotlin as instanceFromMachineImageParamsToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageReservationAffinity.Companion.toKotlin as instanceFromMachineImageReservationAffinityToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageScheduling.Companion.toKotlin as instanceFromMachineImageSchedulingToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageScratchDisk.Companion.toKotlin as instanceFromMachineImageScratchDiskToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageServiceAccount.Companion.toKotlin as instanceFromMachineImageServiceAccountToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.InstanceFromMachineImageShieldedInstanceConfig.Companion.toKotlin as instanceFromMachineImageShieldedInstanceConfigToKotlin
/**
* Builder for [InstanceFromMachineImage].
*/
@PulumiTagMarker
public class InstanceFromMachineImageResourceBuilder internal constructor() {
public var name: String? = null
public var args: InstanceFromMachineImageArgs = InstanceFromMachineImageArgs()
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 InstanceFromMachineImageArgsBuilder.() -> Unit) {
val builder = InstanceFromMachineImageArgsBuilder()
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(): InstanceFromMachineImage {
val builtJavaResource = com.pulumi.gcp.compute.InstanceFromMachineImage(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return InstanceFromMachineImage(builtJavaResource)
}
}
/**
* Manages a VM instance resource within GCE. For more information see
* [the official documentation](https://cloud.google.com/compute/docs/instances)
* and
* [API](https://cloud.google.com/compute/docs/reference/latest/instances).
* This resource is specifically to create a compute instance from a given
* `source_machine_image`. To create an instance without a machine image, use the
* `gcp.compute.Instance` resource.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const tpl = new gcp.compute.InstanceFromMachineImage("tpl", {
* name: "instance-from-machine-image",
* zone: "us-central1-a",
* sourceMachineImage: "projects/PROJECT-ID/global/machineImages/NAME",
* canIpForward: false,
* labels: {
* my_key: "my_value",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* tpl = gcp.compute.InstanceFromMachineImage("tpl",
* name="instance-from-machine-image",
* zone="us-central1-a",
* source_machine_image="projects/PROJECT-ID/global/machineImages/NAME",
* can_ip_forward=False,
* labels={
* "my_key": "my_value",
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var tpl = new Gcp.Compute.InstanceFromMachineImage("tpl", new()
* {
* Name = "instance-from-machine-image",
* Zone = "us-central1-a",
* SourceMachineImage = "projects/PROJECT-ID/global/machineImages/NAME",
* CanIpForward = false,
* Labels =
* {
* { "my_key", "my_value" },
* },
* });
* });
* ```
* ```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.NewInstanceFromMachineImage(ctx, "tpl", &compute.InstanceFromMachineImageArgs{
* Name: pulumi.String("instance-from-machine-image"),
* Zone: pulumi.String("us-central1-a"),
* SourceMachineImage: pulumi.String("projects/PROJECT-ID/global/machineImages/NAME"),
* CanIpForward: pulumi.Bool(false),
* Labels: pulumi.StringMap{
* "my_key": pulumi.String("my_value"),
* },
* })
* 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.InstanceFromMachineImage;
* import com.pulumi.gcp.compute.InstanceFromMachineImageArgs;
* 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 tpl = new InstanceFromMachineImage("tpl", InstanceFromMachineImageArgs.builder()
* .name("instance-from-machine-image")
* .zone("us-central1-a")
* .sourceMachineImage("projects/PROJECT-ID/global/machineImages/NAME")
* .canIpForward(false)
* .labels(Map.of("my_key", "my_value"))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* tpl:
* type: gcp:compute:InstanceFromMachineImage
* properties:
* name: instance-from-machine-image
* zone: us-central1-a
* sourceMachineImage: projects/PROJECT-ID/global/machineImages/NAME
* canIpForward: false
* labels:
* my_key: my_value
* ```
*
*/
public class InstanceFromMachineImage internal constructor(
override val javaResource: com.pulumi.gcp.compute.InstanceFromMachineImage,
) : KotlinCustomResource(javaResource, InstanceFromMachineImageMapper) {
/**
* Controls for advanced machine-related behavior features.
*/
public val advancedMachineFeatures: Output
get() = javaResource.advancedMachineFeatures().applyValue({ args0 ->
args0.let({ args0 ->
instanceFromMachineImageAdvancedMachineFeaturesToKotlin(args0)
})
})
public val allowStoppingForUpdate: Output
get() = javaResource.allowStoppingForUpdate().applyValue({ args0 -> args0 })
/**
* List of disks attached to the instance
*/
public val attachedDisks: Output>
get() = javaResource.attachedDisks().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> instanceFromMachineImageAttachedDiskToKotlin(args0) })
})
})
/**
* The boot disk for the instance.
*/
public val bootDisks: Output>
get() = javaResource.bootDisks().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
instanceFromMachineImageBootDiskToKotlin(args0)
})
})
})
/**
* Whether sending and receiving of packets with non-matching source or destination IPs is allowed.
*/
public val canIpForward: Output
get() = javaResource.canIpForward().applyValue({ args0 -> args0 })
/**
* The Confidential VM config being used by the instance. on_host_maintenance has to be set to TERMINATE or this will fail
* to create.
*/
public val confidentialInstanceConfig: Output
get() = javaResource.confidentialInstanceConfig().applyValue({ args0 ->
args0.let({ args0 ->
instanceFromMachineImageConfidentialInstanceConfigToKotlin(args0)
})
})
/**
* The CPU platform used by this instance.
*/
public val cpuPlatform: Output
get() = javaResource.cpuPlatform().applyValue({ args0 -> args0 })
/**
* Current status of the instance. This could be one of the following values: PROVISIONING, STAGING, RUNNING, STOPPING,
* SUSPENDING, SUSPENDED, REPAIRING, and TERMINATED. For more information about the status of the instance, see [Instance
* life cycle](https://cloud.google.com/compute/docs/instances/instance-life-cycle).
*/
public val currentStatus: Output
get() = javaResource.currentStatus().applyValue({ args0 -> args0 })
/**
* Whether deletion protection is enabled on this instance.
*/
public val deletionProtection: Output
get() = javaResource.deletionProtection().applyValue({ args0 -> args0 })
/**
* A brief description of the resource.
*/
public val description: Output
get() = javaResource.description().applyValue({ args0 -> args0 })
/**
* Desired status of the instance. Either "RUNNING" or "TERMINATED".
*/
public val desiredStatus: Output
get() = javaResource.desiredStatus().applyValue({ args0 -> args0 })
public val effectiveLabels: Output
© 2015 - 2024 Weber Informatics LLC | Privacy Policy