Yandex

Pulumi Official
Package maintained by Pulumi
v0.13.0 published on Tuesday, Feb 22, 2022 by Pulumi

ComputeDisk

Persistent disks are used for data storage and function similarly to physical hard and solid state drives.

A disk can be attached or detached from the virtual machine and can be located locally. A disk can be moved between virtual machines within the same availability zone. Each disk can be attached to only one virtual machine at a time.

For more information about disks in Yandex.Cloud, see:

Example Usage

using Pulumi;
using Yandex = Pulumi.Yandex;

class MyStack : Stack
{
    public MyStack()
    {
        var @default = new Yandex.ComputeDisk("default", new Yandex.ComputeDiskArgs
        {
            ImageId = "ubuntu-16.04-v20180727",
            Labels = 
            {
                { "environment", "test" },
            },
            Type = "network-ssd",
            Zone = "ru-central1-a",
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-yandex/sdk/go/yandex"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := yandex.NewComputeDisk(ctx, "default", &yandex.ComputeDiskArgs{
			ImageId: pulumi.String("ubuntu-16.04-v20180727"),
			Labels: pulumi.StringMap{
				"environment": pulumi.String("test"),
			},
			Type: pulumi.String("network-ssd"),
			Zone: pulumi.String("ru-central1-a"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_yandex as yandex

default = yandex.ComputeDisk("default",
    image_id="ubuntu-16.04-v20180727",
    labels={
        "environment": "test",
    },
    type="network-ssd",
    zone="ru-central1-a")
import * as pulumi from "@pulumi/pulumi";
import * as yandex from "@pulumi/yandex";

const defaultComputeDisk = new yandex.ComputeDisk("default", {
    imageId: "ubuntu-16.04-v20180727",
    labels: {
        environment: "test",
    },
    type: "network-ssd",
    zone: "ru-central1-a",
});

Coming soon!

Non-Replicated Disk

using Pulumi;
using Yandex = Pulumi.Yandex;

class MyStack : Stack
{
    public MyStack()
    {
        var @this = new Yandex.ComputeDiskPlacementGroup("this", new Yandex.ComputeDiskPlacementGroupArgs
        {
            Zone = "ru-central1-b",
        });
        var nr = new Yandex.ComputeDisk("nr", new Yandex.ComputeDiskArgs
        {
            Size = 93,
            Type = "network-ssd-nonreplicated",
            Zone = "ru-central1-b",
            DiskPlacementPolicy = new Yandex.Inputs.ComputeDiskDiskPlacementPolicyArgs
            {
                DiskPlacementGroupId = @this.Id,
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-yandex/sdk/go/yandex"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		this, err := yandex.NewComputeDiskPlacementGroup(ctx, "this", &yandex.ComputeDiskPlacementGroupArgs{
			Zone: pulumi.String("ru-central1-b"),
		})
		if err != nil {
			return err
		}
		_, err = yandex.NewComputeDisk(ctx, "nr", &yandex.ComputeDiskArgs{
			Size: pulumi.Int(93),
			Type: pulumi.String("network-ssd-nonreplicated"),
			Zone: pulumi.String("ru-central1-b"),
			DiskPlacementPolicy: &ComputeDiskDiskPlacementPolicyArgs{
				DiskPlacementGroupId: this.ID(),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_yandex as yandex

this = yandex.ComputeDiskPlacementGroup("this", zone="ru-central1-b")
nr = yandex.ComputeDisk("nr",
    size=93,
    type="network-ssd-nonreplicated",
    zone="ru-central1-b",
    disk_placement_policy=yandex.ComputeDiskDiskPlacementPolicyArgs(
        disk_placement_group_id=this.id,
    ))
import * as pulumi from "@pulumi/pulumi";
import * as yandex from "@pulumi/yandex";

const _this = new yandex.ComputeDiskPlacementGroup("this", {zone: "ru-central1-b"});
const nr = new yandex.ComputeDisk("nr", {
    size: 93,
    type: "network-ssd-nonreplicated",
    zone: "ru-central1-b",
    diskPlacementPolicy: {
        diskPlacementGroupId: _this.id,
    },
});

Coming soon!

Create a ComputeDisk Resource

new ComputeDisk(name: string, args?: ComputeDiskArgs, opts?: CustomResourceOptions);
@overload
def ComputeDisk(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                block_size: Optional[int] = None,
                description: Optional[str] = None,
                disk_placement_policy: Optional[ComputeDiskDiskPlacementPolicyArgs] = None,
                folder_id: Optional[str] = None,
                image_id: Optional[str] = None,
                labels: Optional[Mapping[str, str]] = None,
                name: Optional[str] = None,
                size: Optional[int] = None,
                snapshot_id: Optional[str] = None,
                type: Optional[str] = None,
                zone: Optional[str] = None)
@overload
def ComputeDisk(resource_name: str,
                args: Optional[ComputeDiskArgs] = None,
                opts: Optional[ResourceOptions] = None)
func NewComputeDisk(ctx *Context, name string, args *ComputeDiskArgs, opts ...ResourceOption) (*ComputeDisk, error)
public ComputeDisk(string name, ComputeDiskArgs? args = null, CustomResourceOptions? opts = null)
public ComputeDisk(String name, ComputeDiskArgs args)
public ComputeDisk(String name, ComputeDiskArgs args, CustomResourceOptions options)
type: yandex:ComputeDisk
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args ComputeDiskArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args ComputeDiskArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ComputeDiskArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ComputeDiskArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ComputeDiskArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

ComputeDisk Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The ComputeDisk resource accepts the following input properties:

BlockSize int
Description string

(Optional) Description of the disk. Provide this property when you create a resource.

DiskPlacementPolicy ComputeDiskDiskPlacementPolicyArgs

Disk placement policy configuration. The structure is documented below.

FolderId string

(Optional) The ID of the folder that the disk belongs to. If it is not provided, the default provider folder is used.

ImageId string

The source image to use for disk creation.

Labels Dictionary<string, string>

Labels to assign to this disk. A list of key/value pairs.

Name string

Name of the disk. Provide this property when you create a resource.

Size int

Size of the persistent disk, specified in GB. You can specify this field when creating a persistent disk using the image_id or snapshot_id parameter, or specify it alone to create an empty persistent disk. If you specify this field along with image_id or snapshot_id, the size value must not be less than the size of the source image or the size of the snapshot.

SnapshotId string

The source snapshot to use for disk creation.

Type string

Type of disk to create. Provide this when creating a disk.

Zone string

Availability zone where the disk will reside.

BlockSize int
Description string

(Optional) Description of the disk. Provide this property when you create a resource.

DiskPlacementPolicy ComputeDiskDiskPlacementPolicyArgs

Disk placement policy configuration. The structure is documented below.

FolderId string

(Optional) The ID of the folder that the disk belongs to. If it is not provided, the default provider folder is used.

ImageId string

The source image to use for disk creation.

Labels map[string]string

Labels to assign to this disk. A list of key/value pairs.

Name string

Name of the disk. Provide this property when you create a resource.

Size int

Size of the persistent disk, specified in GB. You can specify this field when creating a persistent disk using the image_id or snapshot_id parameter, or specify it alone to create an empty persistent disk. If you specify this field along with image_id or snapshot_id, the size value must not be less than the size of the source image or the size of the snapshot.

SnapshotId string

The source snapshot to use for disk creation.

Type string

Type of disk to create. Provide this when creating a disk.

Zone string

Availability zone where the disk will reside.

blockSize Integer
description String

(Optional) Description of the disk. Provide this property when you create a resource.

diskPlacementPolicy ComputeDiskDiskPlacementPolicyArgs

Disk placement policy configuration. The structure is documented below.

folderId String

(Optional) The ID of the folder that the disk belongs to. If it is not provided, the default provider folder is used.

imageId String

The source image to use for disk creation.

labels Map

Labels to assign to this disk. A list of key/value pairs.

name String

Name of the disk. Provide this property when you create a resource.

size Integer

Size of the persistent disk, specified in GB. You can specify this field when creating a persistent disk using the image_id or snapshot_id parameter, or specify it alone to create an empty persistent disk. If you specify this field along with image_id or snapshot_id, the size value must not be less than the size of the source image or the size of the snapshot.

snapshotId String

The source snapshot to use for disk creation.

type String

Type of disk to create. Provide this when creating a disk.

zone String

Availability zone where the disk will reside.

blockSize number
description string

(Optional) Description of the disk. Provide this property when you create a resource.

diskPlacementPolicy ComputeDiskDiskPlacementPolicyArgs

Disk placement policy configuration. The structure is documented below.

folderId string

(Optional) The ID of the folder that the disk belongs to. If it is not provided, the default provider folder is used.

imageId string

The source image to use for disk creation.

labels {[key: string]: string}

Labels to assign to this disk. A list of key/value pairs.

name string

Name of the disk. Provide this property when you create a resource.

size number

Size of the persistent disk, specified in GB. You can specify this field when creating a persistent disk using the image_id or snapshot_id parameter, or specify it alone to create an empty persistent disk. If you specify this field along with image_id or snapshot_id, the size value must not be less than the size of the source image or the size of the snapshot.

snapshotId string

The source snapshot to use for disk creation.

type string

Type of disk to create. Provide this when creating a disk.

zone string

Availability zone where the disk will reside.

block_size int
description str

(Optional) Description of the disk. Provide this property when you create a resource.

disk_placement_policy ComputeDiskDiskPlacementPolicyArgs

Disk placement policy configuration. The structure is documented below.

folder_id str

(Optional) The ID of the folder that the disk belongs to. If it is not provided, the default provider folder is used.

image_id str

The source image to use for disk creation.

labels Mapping[str, str]

Labels to assign to this disk. A list of key/value pairs.

name str

Name of the disk. Provide this property when you create a resource.

size int

Size of the persistent disk, specified in GB. You can specify this field when creating a persistent disk using the image_id or snapshot_id parameter, or specify it alone to create an empty persistent disk. If you specify this field along with image_id or snapshot_id, the size value must not be less than the size of the source image or the size of the snapshot.

snapshot_id str

The source snapshot to use for disk creation.

type str

Type of disk to create. Provide this when creating a disk.

zone str

Availability zone where the disk will reside.

blockSize Number
description String

(Optional) Description of the disk. Provide this property when you create a resource.

diskPlacementPolicy Property Map

Disk placement policy configuration. The structure is documented below.

folderId String

(Optional) The ID of the folder that the disk belongs to. If it is not provided, the default provider folder is used.

imageId String

The source image to use for disk creation.

labels Map

Labels to assign to this disk. A list of key/value pairs.

name String

Name of the disk. Provide this property when you create a resource.

size Number

Size of the persistent disk, specified in GB. You can specify this field when creating a persistent disk using the image_id or snapshot_id parameter, or specify it alone to create an empty persistent disk. If you specify this field along with image_id or snapshot_id, the size value must not be less than the size of the source image or the size of the snapshot.

snapshotId String

The source snapshot to use for disk creation.

type String

Type of disk to create. Provide this when creating a disk.

zone String

Availability zone where the disk will reside.

Outputs

All input properties are implicitly available as output properties. Additionally, the ComputeDisk resource produces the following output properties:

CreatedAt string

Creation timestamp of the disk.

Id string

The provider-assigned unique ID for this managed resource.

ProductIds List<string>
Status string

The status of the disk.

CreatedAt string

Creation timestamp of the disk.

Id string

The provider-assigned unique ID for this managed resource.

ProductIds []string
Status string

The status of the disk.

createdAt String

Creation timestamp of the disk.

id String

The provider-assigned unique ID for this managed resource.

productIds List
status String

The status of the disk.

createdAt string

Creation timestamp of the disk.

id string

The provider-assigned unique ID for this managed resource.

productIds string[]
status string

The status of the disk.

created_at str

Creation timestamp of the disk.

id str

The provider-assigned unique ID for this managed resource.

product_ids Sequence[str]
status str

The status of the disk.

createdAt String

Creation timestamp of the disk.

id String

The provider-assigned unique ID for this managed resource.

productIds List
status String

The status of the disk.

Look up an Existing ComputeDisk Resource

Get an existing ComputeDisk resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ComputeDiskState, opts?: CustomResourceOptions): ComputeDisk
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        block_size: Optional[int] = None,
        created_at: Optional[str] = None,
        description: Optional[str] = None,
        disk_placement_policy: Optional[ComputeDiskDiskPlacementPolicyArgs] = None,
        folder_id: Optional[str] = None,
        image_id: Optional[str] = None,
        labels: Optional[Mapping[str, str]] = None,
        name: Optional[str] = None,
        product_ids: Optional[Sequence[str]] = None,
        size: Optional[int] = None,
        snapshot_id: Optional[str] = None,
        status: Optional[str] = None,
        type: Optional[str] = None,
        zone: Optional[str] = None) -> ComputeDisk
func GetComputeDisk(ctx *Context, name string, id IDInput, state *ComputeDiskState, opts ...ResourceOption) (*ComputeDisk, error)
public static ComputeDisk Get(string name, Input<string> id, ComputeDiskState? state, CustomResourceOptions? opts = null)
public static ComputeDisk get(String name, Output<String> id, ComputeDiskState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
BlockSize int
CreatedAt string

Creation timestamp of the disk.

Description string

(Optional) Description of the disk. Provide this property when you create a resource.

DiskPlacementPolicy ComputeDiskDiskPlacementPolicyArgs

Disk placement policy configuration. The structure is documented below.

FolderId string

(Optional) The ID of the folder that the disk belongs to. If it is not provided, the default provider folder is used.

ImageId string

The source image to use for disk creation.

Labels Dictionary<string, string>

Labels to assign to this disk. A list of key/value pairs.

Name string

Name of the disk. Provide this property when you create a resource.

ProductIds List<string>
Size int

Size of the persistent disk, specified in GB. You can specify this field when creating a persistent disk using the image_id or snapshot_id parameter, or specify it alone to create an empty persistent disk. If you specify this field along with image_id or snapshot_id, the size value must not be less than the size of the source image or the size of the snapshot.

SnapshotId string

The source snapshot to use for disk creation.

Status string

The status of the disk.

Type string

Type of disk to create. Provide this when creating a disk.

Zone string

Availability zone where the disk will reside.

BlockSize int
CreatedAt string

Creation timestamp of the disk.

Description string

(Optional) Description of the disk. Provide this property when you create a resource.

DiskPlacementPolicy ComputeDiskDiskPlacementPolicyArgs

Disk placement policy configuration. The structure is documented below.

FolderId string

(Optional) The ID of the folder that the disk belongs to. If it is not provided, the default provider folder is used.

ImageId string

The source image to use for disk creation.

Labels map[string]string

Labels to assign to this disk. A list of key/value pairs.

Name string

Name of the disk. Provide this property when you create a resource.

ProductIds []string
Size int

Size of the persistent disk, specified in GB. You can specify this field when creating a persistent disk using the image_id or snapshot_id parameter, or specify it alone to create an empty persistent disk. If you specify this field along with image_id or snapshot_id, the size value must not be less than the size of the source image or the size of the snapshot.

SnapshotId string

The source snapshot to use for disk creation.

Status string

The status of the disk.

Type string

Type of disk to create. Provide this when creating a disk.

Zone string

Availability zone where the disk will reside.

blockSize Integer
createdAt String

Creation timestamp of the disk.

description String

(Optional) Description of the disk. Provide this property when you create a resource.

diskPlacementPolicy ComputeDiskDiskPlacementPolicyArgs

Disk placement policy configuration. The structure is documented below.

folderId String

(Optional) The ID of the folder that the disk belongs to. If it is not provided, the default provider folder is used.

imageId String

The source image to use for disk creation.

labels Map

Labels to assign to this disk. A list of key/value pairs.

name String

Name of the disk. Provide this property when you create a resource.

productIds List
size Integer

Size of the persistent disk, specified in GB. You can specify this field when creating a persistent disk using the image_id or snapshot_id parameter, or specify it alone to create an empty persistent disk. If you specify this field along with image_id or snapshot_id, the size value must not be less than the size of the source image or the size of the snapshot.

snapshotId String

The source snapshot to use for disk creation.

status String

The status of the disk.

type String

Type of disk to create. Provide this when creating a disk.

zone String

Availability zone where the disk will reside.

blockSize number
createdAt string

Creation timestamp of the disk.

description string

(Optional) Description of the disk. Provide this property when you create a resource.

diskPlacementPolicy ComputeDiskDiskPlacementPolicyArgs

Disk placement policy configuration. The structure is documented below.

folderId string

(Optional) The ID of the folder that the disk belongs to. If it is not provided, the default provider folder is used.

imageId string

The source image to use for disk creation.

labels {[key: string]: string}

Labels to assign to this disk. A list of key/value pairs.

name string

Name of the disk. Provide this property when you create a resource.

productIds string[]
size number

Size of the persistent disk, specified in GB. You can specify this field when creating a persistent disk using the image_id or snapshot_id parameter, or specify it alone to create an empty persistent disk. If you specify this field along with image_id or snapshot_id, the size value must not be less than the size of the source image or the size of the snapshot.

snapshotId string

The source snapshot to use for disk creation.

status string

The status of the disk.

type string

Type of disk to create. Provide this when creating a disk.

zone string

Availability zone where the disk will reside.

block_size int
created_at str

Creation timestamp of the disk.

description str

(Optional) Description of the disk. Provide this property when you create a resource.

disk_placement_policy ComputeDiskDiskPlacementPolicyArgs

Disk placement policy configuration. The structure is documented below.

folder_id str

(Optional) The ID of the folder that the disk belongs to. If it is not provided, the default provider folder is used.

image_id str

The source image to use for disk creation.

labels Mapping[str, str]

Labels to assign to this disk. A list of key/value pairs.

name str

Name of the disk. Provide this property when you create a resource.

product_ids Sequence[str]
size int

Size of the persistent disk, specified in GB. You can specify this field when creating a persistent disk using the image_id or snapshot_id parameter, or specify it alone to create an empty persistent disk. If you specify this field along with image_id or snapshot_id, the size value must not be less than the size of the source image or the size of the snapshot.

snapshot_id str

The source snapshot to use for disk creation.

status str

The status of the disk.

type str

Type of disk to create. Provide this when creating a disk.

zone str

Availability zone where the disk will reside.

blockSize Number
createdAt String

Creation timestamp of the disk.

description String

(Optional) Description of the disk. Provide this property when you create a resource.

diskPlacementPolicy Property Map

Disk placement policy configuration. The structure is documented below.

folderId String

(Optional) The ID of the folder that the disk belongs to. If it is not provided, the default provider folder is used.

imageId String

The source image to use for disk creation.

labels Map

Labels to assign to this disk. A list of key/value pairs.

name String

Name of the disk. Provide this property when you create a resource.

productIds List
size Number

Size of the persistent disk, specified in GB. You can specify this field when creating a persistent disk using the image_id or snapshot_id parameter, or specify it alone to create an empty persistent disk. If you specify this field along with image_id or snapshot_id, the size value must not be less than the size of the source image or the size of the snapshot.

snapshotId String

The source snapshot to use for disk creation.

status String

The status of the disk.

type String

Type of disk to create. Provide this when creating a disk.

zone String

Availability zone where the disk will reside.

Supporting Types

ComputeDiskDiskPlacementPolicy

DiskPlacementGroupId string

Specifies Disk Placement Group id.

DiskPlacementGroupId string

Specifies Disk Placement Group id.

diskPlacementGroupId String

Specifies Disk Placement Group id.

diskPlacementGroupId string

Specifies Disk Placement Group id.

disk_placement_group_id str

Specifies Disk Placement Group id.

diskPlacementGroupId String

Specifies Disk Placement Group id.

Import

A disk can be imported using any of these accepted formats

 $ pulumi import yandex:index/computeDisk:ComputeDisk default disk_id

Package Details

Repository
https://github.com/pulumi/pulumi-yandex
License
Apache-2.0
Notes

This Pulumi package is based on the yandex Terraform Provider.