Disk Pool Managed Disk Attachment Args
Manages a Disk Pool Managed Disk Attachment. !>Note: Azure are officially halting the preview of Azure Disk Pools, and it will not be made generally available. New customers will not be able to register the Microsoft.StoragePool resource provider on their subscription and deploy new Disk Pools. Existing subscriptions registered with Microsoft.StoragePool may continue to deploy and manage disk pools for the time being.
Note: Must be either a premium SSD, standard SSD, or an ultra disk in the same region and availability zone as the disk pool. Note: Ultra disks must have a disk sector size of 512 bytes. Note: Must be a shared disk, with a maxShares value of two or greater. Note: You must provide the StoragePool resource provider RBAC permissions to the disks that will be added to the disk pool.
Example Usage
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.inputs.SubnetDelegationArgs;
import com.pulumi.azure.network.inputs.SubnetDelegationServiceDelegationArgs;
import com.pulumi.azure.compute.DiskPool;
import com.pulumi.azure.compute.DiskPoolArgs;
import com.pulumi.azure.compute.ManagedDisk;
import com.pulumi.azure.compute.ManagedDiskArgs;
import com.pulumi.azuread.AzureadFunctions;
import com.pulumi.azuread.inputs.GetServicePrincipalArgs;
import com.pulumi.azure.authorization.Assignment;
import com.pulumi.azure.authorization.AssignmentArgs;
import com.pulumi.azure.compute.DiskPoolManagedDiskAttachment;
import com.pulumi.azure.compute.DiskPoolManagedDiskAttachmentArgs;
import com.pulumi.codegen.internal.KeyedValue;
import com.pulumi.resources.CustomResourceOptions;
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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.addressSpaces("10.0.0.0/16")
.build());
var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.virtualNetworkName(exampleVirtualNetwork.name())
.addressPrefixes("10.0.0.0/24")
.delegations(SubnetDelegationArgs.builder()
.name("diskspool")
.serviceDelegation(SubnetDelegationServiceDelegationArgs.builder()
.actions("Microsoft.Network/virtualNetworks/read")
.name("Microsoft.StoragePool/diskPools")
.build())
.build())
.build());
var exampleDiskPool = new DiskPool("exampleDiskPool", DiskPoolArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.subnetId(exampleSubnet.id())
.zones("1")
.skuName("Basic_B1")
.build());
var exampleManagedDisk = new ManagedDisk("exampleManagedDisk", ManagedDiskArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.createOption("Empty")
.storageAccountType("Premium_LRS")
.diskSizeGb(4)
.maxShares(2)
.zone("1")
.build());
final var exampleServicePrincipal = AzureadFunctions.getServicePrincipal(GetServicePrincipalArgs.builder()
.displayName("StoragePool Resource Provider")
.build());
final var roles =
"Disk Pool Operator",
"Virtual Machine Contributor";
for (var i = 0; i < roles.length(); i++) {
new Assignment("exampleAssignment-" + i, AssignmentArgs.builder()
.principalId(exampleServicePrincipal.applyValue(getServicePrincipalResult -> getServicePrincipalResult.id()))
.roleDefinitionName(roles[range.value()])
.scope(exampleManagedDisk.id())
.build());
}
var exampleDiskPoolManagedDiskAttachment = new DiskPoolManagedDiskAttachment("exampleDiskPoolManagedDiskAttachment", DiskPoolManagedDiskAttachmentArgs.builder()
.diskPoolId(exampleDiskPool.id())
.managedDiskId(exampleManagedDisk.id())
.build(), CustomResourceOptions.builder()
.dependsOn(exampleAssignment)
.build());
}
}
Import
Disks Pool Managed Disk Attachments can be imported using the resource id
, e.g.
$ pulumi import azure:compute/diskPoolManagedDiskAttachment:DiskPoolManagedDiskAttachment example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.StoragePool/diskPools/storagePool1/managedDisks|/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.Compute/disks/disk1