Yandex

v0.10.0 published on Thursday, Nov 18, 2021 by Pulumi

ComputeImage

Creates a virtual machine image resource for the Yandex Compute Cloud service from an existing tarball. For more information, see the official documentation.

Example Usage

using Pulumi;
using Yandex = Pulumi.Yandex;

class MyStack : Stack
{
    public MyStack()
    {
        var foo_image = new Yandex.ComputeImage("foo-image", new Yandex.ComputeImageArgs
        {
            SourceUrl = "https://storage.yandexcloud.net/lucky-images/kube-it.img",
        });
        var vm = new Yandex.ComputeInstance("vm", new Yandex.ComputeInstanceArgs
        {
            BootDisk = new Yandex.Inputs.ComputeInstanceBootDiskArgs
            {
                InitializeParams = new Yandex.Inputs.ComputeInstanceBootDiskInitializeParamsArgs
                {
                    ImageId = foo_image.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 {
		_, err := yandex.NewComputeImage(ctx, "foo_image", &yandex.ComputeImageArgs{
			SourceUrl: pulumi.String("https://storage.yandexcloud.net/lucky-images/kube-it.img"),
		})
		if err != nil {
			return err
		}
		_, err = yandex.NewComputeInstance(ctx, "vm", &yandex.ComputeInstanceArgs{
			BootDisk: &ComputeInstanceBootDiskArgs{
				InitializeParams: &ComputeInstanceBootDiskInitializeParamsArgs{
					ImageId: foo_image.ID(),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_yandex as yandex

foo_image = yandex.ComputeImage("foo-image", source_url="https://storage.yandexcloud.net/lucky-images/kube-it.img")
vm = yandex.ComputeInstance("vm", boot_disk=yandex.ComputeInstanceBootDiskArgs(
    initialize_params=yandex.ComputeInstanceBootDiskInitializeParamsArgs(
        image_id=foo_image.id,
    ),
))
import * as pulumi from "@pulumi/pulumi";
import * as yandex from "@pulumi/yandex";

const foo_image = new yandex.ComputeImage("foo-image", {
    sourceUrl: "https://storage.yandexcloud.net/lucky-images/kube-it.img",
});
const vm = new yandex.ComputeInstance("vm", {
    bootDisk: {
        initializeParams: {
            imageId: foo_image.id,
        },
    },
});

Create a ComputeImage Resource

new ComputeImage(name: string, args?: ComputeImageArgs, opts?: CustomResourceOptions);
@overload
def ComputeImage(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 description: Optional[str] = None,
                 family: Optional[str] = None,
                 folder_id: Optional[str] = None,
                 labels: Optional[Mapping[str, str]] = None,
                 min_disk_size: Optional[int] = None,
                 name: Optional[str] = None,
                 os_type: Optional[str] = None,
                 product_ids: Optional[Sequence[str]] = None,
                 source_disk: Optional[str] = None,
                 source_family: Optional[str] = None,
                 source_image: Optional[str] = None,
                 source_snapshot: Optional[str] = None,
                 source_url: Optional[str] = None)
@overload
def ComputeImage(resource_name: str,
                 args: Optional[ComputeImageArgs] = None,
                 opts: Optional[ResourceOptions] = None)
func NewComputeImage(ctx *Context, name string, args *ComputeImageArgs, opts ...ResourceOption) (*ComputeImage, error)
public ComputeImage(string name, ComputeImageArgs? args = null, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args ComputeImageArgs
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 ComputeImageArgs
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 ComputeImageArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ComputeImageArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

ComputeImage 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 ComputeImage resource accepts the following input properties:

Description string
An optional description of the image. Provide this property when you create a resource.
Family string
The name of the image family to which this image belongs.
FolderId string
The ID of the folder that the resource belongs to. If it is not provided, the default provider folder is used.
Labels Dictionary<string, string>
A set of key/value label pairs to assign to the image.
MinDiskSize int
Minimum size in GB of the disk that will be created from this image.
Name string
Name of the disk.
OsType string
Operating system type that is contained in the image. Possible values: “LINUX”, “WINDOWS”.
ProductIds List<string>
License IDs that indicate which licenses are attached to this image.
SourceDisk string
The ID of a disk to use as the source of the image. Changing this ID forces a new resource to be created.
SourceFamily string
The name of the family to use as the source of the new image. The ID of the latest image is taken from the “standard-images” folder. Changing the family forces a new resource to be created.
SourceImage string
The ID of an existing image to use as the source of the image. Changing this ID forces a new resource to be created.
SourceSnapshot string
The ID of a snapshot to use as the source of the image. Changing this ID forces a new resource to be created.
SourceUrl string
The URL to use as the source of the image. Changing this URL forces a new resource to be created.
Description string
An optional description of the image. Provide this property when you create a resource.
Family string
The name of the image family to which this image belongs.
FolderId string
The ID of the folder that the resource belongs to. If it is not provided, the default provider folder is used.
Labels map[string]string
A set of key/value label pairs to assign to the image.
MinDiskSize int
Minimum size in GB of the disk that will be created from this image.
Name string
Name of the disk.
OsType string
Operating system type that is contained in the image. Possible values: “LINUX”, “WINDOWS”.
ProductIds []string
License IDs that indicate which licenses are attached to this image.
SourceDisk string
The ID of a disk to use as the source of the image. Changing this ID forces a new resource to be created.
SourceFamily string
The name of the family to use as the source of the new image. The ID of the latest image is taken from the “standard-images” folder. Changing the family forces a new resource to be created.
SourceImage string
The ID of an existing image to use as the source of the image. Changing this ID forces a new resource to be created.
SourceSnapshot string
The ID of a snapshot to use as the source of the image. Changing this ID forces a new resource to be created.
SourceUrl string
The URL to use as the source of the image. Changing this URL forces a new resource to be created.
description string
An optional description of the image. Provide this property when you create a resource.
family string
The name of the image family to which this image belongs.
folderId string
The ID of the folder that the resource belongs to. If it is not provided, the default provider folder is used.
labels {[key: string]: string}
A set of key/value label pairs to assign to the image.
minDiskSize number
Minimum size in GB of the disk that will be created from this image.
name string
Name of the disk.
osType string
Operating system type that is contained in the image. Possible values: “LINUX”, “WINDOWS”.
productIds string[]
License IDs that indicate which licenses are attached to this image.
sourceDisk string
The ID of a disk to use as the source of the image. Changing this ID forces a new resource to be created.
sourceFamily string
The name of the family to use as the source of the new image. The ID of the latest image is taken from the “standard-images” folder. Changing the family forces a new resource to be created.
sourceImage string
The ID of an existing image to use as the source of the image. Changing this ID forces a new resource to be created.
sourceSnapshot string
The ID of a snapshot to use as the source of the image. Changing this ID forces a new resource to be created.
sourceUrl string
The URL to use as the source of the image. Changing this URL forces a new resource to be created.
description str
An optional description of the image. Provide this property when you create a resource.
family str
The name of the image family to which this image belongs.
folder_id str
The ID of the folder that the resource belongs to. If it is not provided, the default provider folder is used.
labels Mapping[str, str]
A set of key/value label pairs to assign to the image.
min_disk_size int
Minimum size in GB of the disk that will be created from this image.
name str
Name of the disk.
os_type str
Operating system type that is contained in the image. Possible values: “LINUX”, “WINDOWS”.
product_ids Sequence[str]
License IDs that indicate which licenses are attached to this image.
source_disk str
The ID of a disk to use as the source of the image. Changing this ID forces a new resource to be created.
source_family str
The name of the family to use as the source of the new image. The ID of the latest image is taken from the “standard-images” folder. Changing the family forces a new resource to be created.
source_image str
The ID of an existing image to use as the source of the image. Changing this ID forces a new resource to be created.
source_snapshot str
The ID of a snapshot to use as the source of the image. Changing this ID forces a new resource to be created.
source_url str
The URL to use as the source of the image. Changing this URL forces a new resource to be created.

Outputs

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

CreatedAt string
Creation timestamp of the image.
Id string
The provider-assigned unique ID for this managed resource.
Size int
The size of the image, specified in GB.
Status string
The status of the image.
CreatedAt string
Creation timestamp of the image.
Id string
The provider-assigned unique ID for this managed resource.
Size int
The size of the image, specified in GB.
Status string
The status of the image.
createdAt string
Creation timestamp of the image.
id string
The provider-assigned unique ID for this managed resource.
size number
The size of the image, specified in GB.
status string
The status of the image.
created_at str
Creation timestamp of the image.
id str
The provider-assigned unique ID for this managed resource.
size int
The size of the image, specified in GB.
status str
The status of the image.

Look up an Existing ComputeImage Resource

Get an existing ComputeImage 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?: ComputeImageState, opts?: CustomResourceOptions): ComputeImage
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        created_at: Optional[str] = None,
        description: Optional[str] = None,
        family: Optional[str] = None,
        folder_id: Optional[str] = None,
        labels: Optional[Mapping[str, str]] = None,
        min_disk_size: Optional[int] = None,
        name: Optional[str] = None,
        os_type: Optional[str] = None,
        product_ids: Optional[Sequence[str]] = None,
        size: Optional[int] = None,
        source_disk: Optional[str] = None,
        source_family: Optional[str] = None,
        source_image: Optional[str] = None,
        source_snapshot: Optional[str] = None,
        source_url: Optional[str] = None,
        status: Optional[str] = None) -> ComputeImage
func GetComputeImage(ctx *Context, name string, id IDInput, state *ComputeImageState, opts ...ResourceOption) (*ComputeImage, error)
public static ComputeImage Get(string name, Input<string> id, ComputeImageState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

CreatedAt string
Creation timestamp of the image.
Description string
An optional description of the image. Provide this property when you create a resource.
Family string
The name of the image family to which this image belongs.
FolderId string
The ID of the folder that the resource belongs to. If it is not provided, the default provider folder is used.
Labels Dictionary<string, string>
A set of key/value label pairs to assign to the image.
MinDiskSize int
Minimum size in GB of the disk that will be created from this image.
Name string
Name of the disk.
OsType string
Operating system type that is contained in the image. Possible values: “LINUX”, “WINDOWS”.
ProductIds List<string>
License IDs that indicate which licenses are attached to this image.
Size int
The size of the image, specified in GB.
SourceDisk string
The ID of a disk to use as the source of the image. Changing this ID forces a new resource to be created.
SourceFamily string
The name of the family to use as the source of the new image. The ID of the latest image is taken from the “standard-images” folder. Changing the family forces a new resource to be created.
SourceImage string
The ID of an existing image to use as the source of the image. Changing this ID forces a new resource to be created.
SourceSnapshot string
The ID of a snapshot to use as the source of the image. Changing this ID forces a new resource to be created.
SourceUrl string
The URL to use as the source of the image. Changing this URL forces a new resource to be created.
Status string
The status of the image.
CreatedAt string
Creation timestamp of the image.
Description string
An optional description of the image. Provide this property when you create a resource.
Family string
The name of the image family to which this image belongs.
FolderId string
The ID of the folder that the resource belongs to. If it is not provided, the default provider folder is used.
Labels map[string]string
A set of key/value label pairs to assign to the image.
MinDiskSize int
Minimum size in GB of the disk that will be created from this image.
Name string
Name of the disk.
OsType string
Operating system type that is contained in the image. Possible values: “LINUX”, “WINDOWS”.
ProductIds []string
License IDs that indicate which licenses are attached to this image.
Size int
The size of the image, specified in GB.
SourceDisk string
The ID of a disk to use as the source of the image. Changing this ID forces a new resource to be created.
SourceFamily string
The name of the family to use as the source of the new image. The ID of the latest image is taken from the “standard-images” folder. Changing the family forces a new resource to be created.
SourceImage string
The ID of an existing image to use as the source of the image. Changing this ID forces a new resource to be created.
SourceSnapshot string
The ID of a snapshot to use as the source of the image. Changing this ID forces a new resource to be created.
SourceUrl string
The URL to use as the source of the image. Changing this URL forces a new resource to be created.
Status string
The status of the image.
createdAt string
Creation timestamp of the image.
description string
An optional description of the image. Provide this property when you create a resource.
family string
The name of the image family to which this image belongs.
folderId string
The ID of the folder that the resource belongs to. If it is not provided, the default provider folder is used.
labels {[key: string]: string}
A set of key/value label pairs to assign to the image.
minDiskSize number
Minimum size in GB of the disk that will be created from this image.
name string
Name of the disk.
osType string
Operating system type that is contained in the image. Possible values: “LINUX”, “WINDOWS”.
productIds string[]
License IDs that indicate which licenses are attached to this image.
size number
The size of the image, specified in GB.
sourceDisk string
The ID of a disk to use as the source of the image. Changing this ID forces a new resource to be created.
sourceFamily string
The name of the family to use as the source of the new image. The ID of the latest image is taken from the “standard-images” folder. Changing the family forces a new resource to be created.
sourceImage string
The ID of an existing image to use as the source of the image. Changing this ID forces a new resource to be created.
sourceSnapshot string
The ID of a snapshot to use as the source of the image. Changing this ID forces a new resource to be created.
sourceUrl string
The URL to use as the source of the image. Changing this URL forces a new resource to be created.
status string
The status of the image.
created_at str
Creation timestamp of the image.
description str
An optional description of the image. Provide this property when you create a resource.
family str
The name of the image family to which this image belongs.
folder_id str
The ID of the folder that the resource belongs to. If it is not provided, the default provider folder is used.
labels Mapping[str, str]
A set of key/value label pairs to assign to the image.
min_disk_size int
Minimum size in GB of the disk that will be created from this image.
name str
Name of the disk.
os_type str
Operating system type that is contained in the image. Possible values: “LINUX”, “WINDOWS”.
product_ids Sequence[str]
License IDs that indicate which licenses are attached to this image.
size int
The size of the image, specified in GB.
source_disk str
The ID of a disk to use as the source of the image. Changing this ID forces a new resource to be created.
source_family str
The name of the family to use as the source of the new image. The ID of the latest image is taken from the “standard-images” folder. Changing the family forces a new resource to be created.
source_image str
The ID of an existing image to use as the source of the image. Changing this ID forces a new resource to be created.
source_snapshot str
The ID of a snapshot to use as the source of the image. Changing this ID forces a new resource to be created.
source_url str
The URL to use as the source of the image. Changing this URL forces a new resource to be created.
status str
The status of the image.

Import

A VM image can be imported using the id of the resource, e.g.

 $ pulumi import yandex:index/computeImage:ComputeImage web-image image_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.