CustomImage

Provides a resource which can be used to create a custom image from a URL. The URL must point to an image in one of the following file formats:

  • Raw (.img) with an MBR or GPT partition table
  • qcow2
  • VHDX
  • VDI
  • VMDK

The image may be compressed using gzip or bzip2. See the DigitalOcean Custom Image documentation for additional requirements.

Example Usage

using System.Collections.Generic;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;

return await Deployment.RunAsync(() => 
{
    var flatcar = new DigitalOcean.CustomImage("flatcar", new()
    {
        Url = "https://stable.release.flatcar-linux.net/amd64-usr/2605.7.0/flatcar_production_digitalocean_image.bin.bz2",
        Regions = new[]
        {
            "nyc3",
        },
    });

    var example = new DigitalOcean.Droplet("example", new()
    {
        Image = flatcar.Id,
        Region = "nyc3",
        Size = "s-1vcpu-1gb",
        SshKeys = new[]
        {
            "12345",
        },
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		flatcar, err := digitalocean.NewCustomImage(ctx, "flatcar", &digitalocean.CustomImageArgs{
			Url: pulumi.String("https://stable.release.flatcar-linux.net/amd64-usr/2605.7.0/flatcar_production_digitalocean_image.bin.bz2"),
			Regions: pulumi.StringArray{
				pulumi.String("nyc3"),
			},
		})
		if err != nil {
			return err
		}
		_, err = digitalocean.NewDroplet(ctx, "example", &digitalocean.DropletArgs{
			Image:  flatcar.ID(),
			Region: pulumi.String("nyc3"),
			Size:   pulumi.String("s-1vcpu-1gb"),
			SshKeys: pulumi.StringArray{
				pulumi.String("12345"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.CustomImage;
import com.pulumi.digitalocean.CustomImageArgs;
import com.pulumi.digitalocean.Droplet;
import com.pulumi.digitalocean.DropletArgs;
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 flatcar = new CustomImage("flatcar", CustomImageArgs.builder()        
            .url("https://stable.release.flatcar-linux.net/amd64-usr/2605.7.0/flatcar_production_digitalocean_image.bin.bz2")
            .regions("nyc3")
            .build());

        var example = new Droplet("example", DropletArgs.builder()        
            .image(flatcar.id())
            .region("nyc3")
            .size("s-1vcpu-1gb")
            .sshKeys(12345)
            .build());

    }
}
import pulumi
import pulumi_digitalocean as digitalocean

flatcar = digitalocean.CustomImage("flatcar",
    url="https://stable.release.flatcar-linux.net/amd64-usr/2605.7.0/flatcar_production_digitalocean_image.bin.bz2",
    regions=["nyc3"])
example = digitalocean.Droplet("example",
    image=flatcar.id,
    region="nyc3",
    size="s-1vcpu-1gb",
    ssh_keys=["12345"])
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

const flatcar = new digitalocean.CustomImage("flatcar", {
    url: "https://stable.release.flatcar-linux.net/amd64-usr/2605.7.0/flatcar_production_digitalocean_image.bin.bz2",
    regions: ["nyc3"],
});
const example = new digitalocean.Droplet("example", {
    image: flatcar.id,
    region: "nyc3",
    size: "s-1vcpu-1gb",
    sshKeys: ["12345"],
});
resources:
  flatcar:
    type: digitalocean:CustomImage
    properties:
      url: https://stable.release.flatcar-linux.net/amd64-usr/2605.7.0/flatcar_production_digitalocean_image.bin.bz2
      regions:
        - nyc3
  example:
    type: digitalocean:Droplet
    properties:
      image: ${flatcar.id}
      region: nyc3
      size: s-1vcpu-1gb
      sshKeys:
        - 12345

Create CustomImage Resource

new CustomImage(name: string, args: CustomImageArgs, opts?: CustomResourceOptions);
@overload
def CustomImage(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                description: Optional[str] = None,
                distribution: Optional[str] = None,
                name: Optional[str] = None,
                regions: Optional[Sequence[str]] = None,
                tags: Optional[Sequence[str]] = None,
                url: Optional[str] = None)
@overload
def CustomImage(resource_name: str,
                args: CustomImageArgs,
                opts: Optional[ResourceOptions] = None)
func NewCustomImage(ctx *Context, name string, args CustomImageArgs, opts ...ResourceOption) (*CustomImage, error)
public CustomImage(string name, CustomImageArgs args, CustomResourceOptions? opts = null)
public CustomImage(String name, CustomImageArgs args)
public CustomImage(String name, CustomImageArgs args, CustomResourceOptions options)
type: digitalocean:CustomImage
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args CustomImageArgs
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 CustomImageArgs
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 CustomImageArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args CustomImageArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args CustomImageArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

Regions List<string>

A list of regions. (Currently only one is supported).

Url string

A URL from which the custom Linux virtual machine image may be retrieved.

Description string

An optional description for the image.

Distribution string

An optional distribution name for the image. Valid values are documented here

Name string

A name for the Custom Image.

Tags List<string>

A list of optional tags for the image.

Regions []string

A list of regions. (Currently only one is supported).

Url string

A URL from which the custom Linux virtual machine image may be retrieved.

Description string

An optional description for the image.

Distribution string

An optional distribution name for the image. Valid values are documented here

Name string

A name for the Custom Image.

Tags []string

A list of optional tags for the image.

regions List<String>

A list of regions. (Currently only one is supported).

url String

A URL from which the custom Linux virtual machine image may be retrieved.

description String

An optional description for the image.

distribution String

An optional distribution name for the image. Valid values are documented here

name String

A name for the Custom Image.

tags List<String>

A list of optional tags for the image.

regions string[]

A list of regions. (Currently only one is supported).

url string

A URL from which the custom Linux virtual machine image may be retrieved.

description string

An optional description for the image.

distribution string

An optional distribution name for the image. Valid values are documented here

name string

A name for the Custom Image.

tags string[]

A list of optional tags for the image.

regions Sequence[str]

A list of regions. (Currently only one is supported).

url str

A URL from which the custom Linux virtual machine image may be retrieved.

description str

An optional description for the image.

distribution str

An optional distribution name for the image. Valid values are documented here

name str

A name for the Custom Image.

tags Sequence[str]

A list of optional tags for the image.

regions List<String>

A list of regions. (Currently only one is supported).

url String

A URL from which the custom Linux virtual machine image may be retrieved.

description String

An optional description for the image.

distribution String

An optional distribution name for the image. Valid values are documented here

name String

A name for the Custom Image.

tags List<String>

A list of optional tags for the image.

Outputs

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

CreatedAt string
Id string

The provider-assigned unique ID for this managed resource.

ImageId int
MinDiskSize int
Public bool
SizeGigabytes double
Slug string
Status string
Type string
CreatedAt string
Id string

The provider-assigned unique ID for this managed resource.

ImageId int
MinDiskSize int
Public bool
SizeGigabytes float64
Slug string
Status string
Type string
createdAt String
id String

The provider-assigned unique ID for this managed resource.

imageId Integer
minDiskSize Integer
public_ Boolean
sizeGigabytes Double
slug String
status String
type String
createdAt string
id string

The provider-assigned unique ID for this managed resource.

imageId number
minDiskSize number
public boolean
sizeGigabytes number
slug string
status string
type string
created_at str
id str

The provider-assigned unique ID for this managed resource.

image_id int
min_disk_size int
public bool
size_gigabytes float
slug str
status str
type str
createdAt String
id String

The provider-assigned unique ID for this managed resource.

imageId Number
minDiskSize Number
public Boolean
sizeGigabytes Number
slug String
status String
type String

Look up Existing CustomImage Resource

Get an existing CustomImage 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?: CustomImageState, opts?: CustomResourceOptions): CustomImage
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        created_at: Optional[str] = None,
        description: Optional[str] = None,
        distribution: Optional[str] = None,
        image_id: Optional[int] = None,
        min_disk_size: Optional[int] = None,
        name: Optional[str] = None,
        public: Optional[bool] = None,
        regions: Optional[Sequence[str]] = None,
        size_gigabytes: Optional[float] = None,
        slug: Optional[str] = None,
        status: Optional[str] = None,
        tags: Optional[Sequence[str]] = None,
        type: Optional[str] = None,
        url: Optional[str] = None) -> CustomImage
func GetCustomImage(ctx *Context, name string, id IDInput, state *CustomImageState, opts ...ResourceOption) (*CustomImage, error)
public static CustomImage Get(string name, Input<string> id, CustomImageState? state, CustomResourceOptions? opts = null)
public static CustomImage get(String name, Output<String> id, CustomImageState 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:
CreatedAt string
Description string

An optional description for the image.

Distribution string

An optional distribution name for the image. Valid values are documented here

ImageId int
MinDiskSize int
Name string

A name for the Custom Image.

Public bool
Regions List<string>

A list of regions. (Currently only one is supported).

SizeGigabytes double
Slug string
Status string
Tags List<string>

A list of optional tags for the image.

Type string
Url string

A URL from which the custom Linux virtual machine image may be retrieved.

CreatedAt string
Description string

An optional description for the image.

Distribution string

An optional distribution name for the image. Valid values are documented here

ImageId int
MinDiskSize int
Name string

A name for the Custom Image.

Public bool
Regions []string

A list of regions. (Currently only one is supported).

SizeGigabytes float64
Slug string
Status string
Tags []string

A list of optional tags for the image.

Type string
Url string

A URL from which the custom Linux virtual machine image may be retrieved.

createdAt String
description String

An optional description for the image.

distribution String

An optional distribution name for the image. Valid values are documented here

imageId Integer
minDiskSize Integer
name String

A name for the Custom Image.

public_ Boolean
regions List<String>

A list of regions. (Currently only one is supported).

sizeGigabytes Double
slug String
status String
tags List<String>

A list of optional tags for the image.

type String
url String

A URL from which the custom Linux virtual machine image may be retrieved.

createdAt string
description string

An optional description for the image.

distribution string

An optional distribution name for the image. Valid values are documented here

imageId number
minDiskSize number
name string

A name for the Custom Image.

public boolean
regions string[]

A list of regions. (Currently only one is supported).

sizeGigabytes number
slug string
status string
tags string[]

A list of optional tags for the image.

type string
url string

A URL from which the custom Linux virtual machine image may be retrieved.

created_at str
description str

An optional description for the image.

distribution str

An optional distribution name for the image. Valid values are documented here

image_id int
min_disk_size int
name str

A name for the Custom Image.

public bool
regions Sequence[str]

A list of regions. (Currently only one is supported).

size_gigabytes float
slug str
status str
tags Sequence[str]

A list of optional tags for the image.

type str
url str

A URL from which the custom Linux virtual machine image may be retrieved.

createdAt String
description String

An optional description for the image.

distribution String

An optional distribution name for the image. Valid values are documented here

imageId Number
minDiskSize Number
name String

A name for the Custom Image.

public Boolean
regions List<String>

A list of regions. (Currently only one is supported).

sizeGigabytes Number
slug String
status String
tags List<String>

A list of optional tags for the image.

type String
url String

A URL from which the custom Linux virtual machine image may be retrieved.

Package Details

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

This Pulumi package is based on the digitalocean Terraform Provider.