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

com.pulumi.azure.compute.ImplicitDataDiskFromSource Maven / Gradle / Ivy

Go to download

A Pulumi package for creating and managing Microsoft Azure cloud resources, based on the Terraform azurerm provider. We recommend using the [Azure Native provider](https://github.com/pulumi/pulumi-azure-native) to provision Azure infrastructure. Azure Native provides complete coverage of Azure resources and same-day access to new resources and resource updates.

There is a newer version: 6.10.0-alpha.1731737215
Show newest version
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.azure.compute;

import com.pulumi.azure.Utilities;
import com.pulumi.azure.compute.ImplicitDataDiskFromSourceArgs;
import com.pulumi.azure.compute.inputs.ImplicitDataDiskFromSourceState;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.Boolean;
import java.lang.Integer;
import java.lang.String;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * Manages an implicit Data Disk of a Virtual Machine.
 * 
 * > **Note:** The Implicit Data Disk will be deleted instantly after this resource is destroyed. If you want to detach this disk only, you may set `detach_implicit_data_disk_on_deletion` field to `true` within the `virtual_machine` block in the provider `features` block.
 * 
 * ## Example Usage
 * 
 * <!--Start PulumiCodeChooser -->
 * 
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.network.VirtualNetwork;
 * import com.pulumi.azure.network.VirtualNetworkArgs;
 * import com.pulumi.azure.network.Subnet;
 * import com.pulumi.azure.network.SubnetArgs;
 * import com.pulumi.azure.network.NetworkInterface;
 * import com.pulumi.azure.network.NetworkInterfaceArgs;
 * import com.pulumi.azure.network.inputs.NetworkInterfaceIpConfigurationArgs;
 * import com.pulumi.azure.compute.VirtualMachine;
 * import com.pulumi.azure.compute.VirtualMachineArgs;
 * import com.pulumi.azure.compute.inputs.VirtualMachineStorageImageReferenceArgs;
 * import com.pulumi.azure.compute.inputs.VirtualMachineStorageOsDiskArgs;
 * import com.pulumi.azure.compute.inputs.VirtualMachineOsProfileArgs;
 * import com.pulumi.azure.compute.inputs.VirtualMachineOsProfileLinuxConfigArgs;
 * import com.pulumi.azure.compute.ManagedDisk;
 * import com.pulumi.azure.compute.ManagedDiskArgs;
 * import com.pulumi.azure.compute.Snapshot;
 * import com.pulumi.azure.compute.SnapshotArgs;
 * import com.pulumi.azure.compute.ImplicitDataDiskFromSource;
 * import com.pulumi.azure.compute.ImplicitDataDiskFromSourceArgs;
 * 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) {
 *         final var config = ctx.config();
 *         final var prefix = config.get("prefix").orElse("example");
 *         final var vmName = String.format("%s-vm", prefix);
 * 
 *         var example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name(String.format("%s-resources", prefix))
 *             .location("West Europe")
 *             .build());
 * 
 *         var main = new VirtualNetwork("main", VirtualNetworkArgs.builder()
 *             .name(String.format("%s-network", prefix))
 *             .addressSpaces("10.0.0.0/16")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .build());
 * 
 *         var internal = new Subnet("internal", SubnetArgs.builder()
 *             .name("internal")
 *             .resourceGroupName(example.name())
 *             .virtualNetworkName(main.name())
 *             .addressPrefixes("10.0.2.0/24")
 *             .build());
 * 
 *         var mainNetworkInterface = new NetworkInterface("mainNetworkInterface", NetworkInterfaceArgs.builder()
 *             .name(String.format("%s-nic", prefix))
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .ipConfigurations(NetworkInterfaceIpConfigurationArgs.builder()
 *                 .name("internal")
 *                 .subnetId(internal.id())
 *                 .privateIpAddressAllocation("Dynamic")
 *                 .build())
 *             .build());
 * 
 *         var exampleVirtualMachine = new VirtualMachine("exampleVirtualMachine", VirtualMachineArgs.builder()
 *             .name(vmName)
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .networkInterfaceIds(mainNetworkInterface.id())
 *             .vmSize("Standard_F2")
 *             .storageImageReference(VirtualMachineStorageImageReferenceArgs.builder()
 *                 .publisher("Canonical")
 *                 .offer("0001-com-ubuntu-server-jammy")
 *                 .sku("22_04-lts")
 *                 .version("latest")
 *                 .build())
 *             .storageOsDisk(VirtualMachineStorageOsDiskArgs.builder()
 *                 .name("myosdisk1")
 *                 .caching("ReadWrite")
 *                 .createOption("FromImage")
 *                 .managedDiskType("Standard_LRS")
 *                 .build())
 *             .osProfile(VirtualMachineOsProfileArgs.builder()
 *                 .computerName(vmName)
 *                 .adminUsername("testadmin")
 *                 .adminPassword("Password1234!")
 *                 .build())
 *             .osProfileLinuxConfig(VirtualMachineOsProfileLinuxConfigArgs.builder()
 *                 .disablePasswordAuthentication(false)
 *                 .build())
 *             .build());
 * 
 *         var exampleManagedDisk = new ManagedDisk("exampleManagedDisk", ManagedDiskArgs.builder()
 *             .name(String.format("%s-disk1", vmName))
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .storageAccountType("Standard_LRS")
 *             .createOption("Empty")
 *             .diskSizeGb(10)
 *             .build());
 * 
 *         var exampleSnapshot = new Snapshot("exampleSnapshot", SnapshotArgs.builder()
 *             .name(String.format("%s-snapshot1", vmName))
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .createOption("Copy")
 *             .sourceUri(exampleManagedDisk.id())
 *             .build());
 * 
 *         var exampleImplicitDataDiskFromSource = new ImplicitDataDiskFromSource("exampleImplicitDataDiskFromSource", ImplicitDataDiskFromSourceArgs.builder()
 *             .name(String.format("%s-implicitdisk1", vmName))
 *             .virtualMachineId(testAzurermVirtualMachine.id())
 *             .lun("0")
 *             .caching("None")
 *             .createOption("Copy")
 *             .diskSizeGb(20)
 *             .sourceResourceId(test.id())
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## Import * * The implicit Data Disk of the Virtual Machine can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:compute/implicitDataDiskFromSource:ImplicitDataDiskFromSource example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/virtualMachines/machine1/dataDisks/disk1 * ``` * */ @ResourceType(type="azure:compute/implicitDataDiskFromSource:ImplicitDataDiskFromSource") public class ImplicitDataDiskFromSource extends com.pulumi.resources.CustomResource { /** * Specifies the caching requirements for this Data Disk. Possible values are `ReadOnly` and `ReadWrite`. * */ @Export(name="caching", refs={String.class}, tree="[0]") private Output caching; /** * @return Specifies the caching requirements for this Data Disk. Possible values are `ReadOnly` and `ReadWrite`. * */ public Output> caching() { return Codegen.optional(this.caching); } /** * Specifies the Create Option of the Data Disk. The only possible value is `Copy`. Changing this forces a new resource to be created. * */ @Export(name="createOption", refs={String.class}, tree="[0]") private Output createOption; /** * @return Specifies the Create Option of the Data Disk. The only possible value is `Copy`. Changing this forces a new resource to be created. * */ public Output createOption() { return this.createOption; } /** * Specifies the size of the Data Disk in gigabytes. Changing this forces a new resource to be created. * */ @Export(name="diskSizeGb", refs={Integer.class}, tree="[0]") private Output diskSizeGb; /** * @return Specifies the size of the Data Disk in gigabytes. Changing this forces a new resource to be created. * */ public Output diskSizeGb() { return this.diskSizeGb; } /** * The Logical Unit Number of the Data Disk, which needs to be unique within the Virtual Machine. Changing this forces a new resource to be created. * */ @Export(name="lun", refs={Integer.class}, tree="[0]") private Output lun; /** * @return The Logical Unit Number of the Data Disk, which needs to be unique within the Virtual Machine. Changing this forces a new resource to be created. * */ public Output lun() { return this.lun; } /** * Specifies the name of this Data Disk. Changing this forces a new resource to be created. * */ @Export(name="name", refs={String.class}, tree="[0]") private Output name; /** * @return Specifies the name of this Data Disk. Changing this forces a new resource to be created. * */ public Output name() { return this.name; } /** * The ID of the source resource which this Data Disk was created from. Changing this forces a new resource to be created. * */ @Export(name="sourceResourceId", refs={String.class}, tree="[0]") private Output sourceResourceId; /** * @return The ID of the source resource which this Data Disk was created from. Changing this forces a new resource to be created. * */ public Output sourceResourceId() { return this.sourceResourceId; } /** * The ID of the Virtual Machine to which the Data Disk should be attached. Changing this forces a new resource to be created. * */ @Export(name="virtualMachineId", refs={String.class}, tree="[0]") private Output virtualMachineId; /** * @return The ID of the Virtual Machine to which the Data Disk should be attached. Changing this forces a new resource to be created. * */ public Output virtualMachineId() { return this.virtualMachineId; } /** * Specifies if Write Accelerator is enabled on the disk. This can only be enabled on `Premium_LRS` managed disks with no caching and [M-Series VMs](https://docs.microsoft.com/azure/virtual-machines/workloads/sap/how-to-enable-write-accelerator). Defaults to `false`. * */ @Export(name="writeAcceleratorEnabled", refs={Boolean.class}, tree="[0]") private Output writeAcceleratorEnabled; /** * @return Specifies if Write Accelerator is enabled on the disk. This can only be enabled on `Premium_LRS` managed disks with no caching and [M-Series VMs](https://docs.microsoft.com/azure/virtual-machines/workloads/sap/how-to-enable-write-accelerator). Defaults to `false`. * */ public Output> writeAcceleratorEnabled() { return Codegen.optional(this.writeAcceleratorEnabled); } /** * * @param name The _unique_ name of the resulting resource. */ public ImplicitDataDiskFromSource(java.lang.String name) { this(name, ImplicitDataDiskFromSourceArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public ImplicitDataDiskFromSource(java.lang.String name, ImplicitDataDiskFromSourceArgs args) { this(name, args, null); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. * @param options A bag of options that control this resource's behavior. */ public ImplicitDataDiskFromSource(java.lang.String name, ImplicitDataDiskFromSourceArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:compute/implicitDataDiskFromSource:ImplicitDataDiskFromSource", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private ImplicitDataDiskFromSource(java.lang.String name, Output id, @Nullable ImplicitDataDiskFromSourceState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:compute/implicitDataDiskFromSource:ImplicitDataDiskFromSource", name, state, makeResourceOptions(options, id), false); } private static ImplicitDataDiskFromSourceArgs makeArgs(ImplicitDataDiskFromSourceArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? ImplicitDataDiskFromSourceArgs.Empty : args; } private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() .version(Utilities.getVersion()) .build(); return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); } /** * Get an existing Host 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 * @param options Optional settings to control the behavior of the CustomResource. */ public static ImplicitDataDiskFromSource get(java.lang.String name, Output id, @Nullable ImplicitDataDiskFromSourceState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new ImplicitDataDiskFromSource(name, id, state, options); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy