1. Packages
  2. DigitalOcean
  3. API Docs
  4. CustomImage
DigitalOcean v4.27.0 published on Wednesday, Mar 13, 2024 by Pulumi

digitalocean.CustomImage

Explore with Pulumi AI

digitalocean logo
DigitalOcean v4.27.0 published on Wednesday, Mar 13, 2024 by Pulumi

    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

    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"],
    });
    
    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"])
    
    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
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    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 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());
    
        }
    }
    
    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
    A time value given in ISO8601 combined date and time format that represents when the image was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    ImageId int
    A unique number that can be used to identify and reference a specific image.
    MinDiskSize int
    The minimum disk size in GB required for a Droplet to use this image.
    Public bool
    Indicates whether the image in question is public or not.
    SizeGigabytes double
    The size of the image in gigabytes.
    Slug string
    A uniquely identifying string for each image.
    Status string
    A status string indicating the state of a custom image.
    Type string
    Describes the kind of image.
    CreatedAt string
    A time value given in ISO8601 combined date and time format that represents when the image was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    ImageId int
    A unique number that can be used to identify and reference a specific image.
    MinDiskSize int
    The minimum disk size in GB required for a Droplet to use this image.
    Public bool
    Indicates whether the image in question is public or not.
    SizeGigabytes float64
    The size of the image in gigabytes.
    Slug string
    A uniquely identifying string for each image.
    Status string
    A status string indicating the state of a custom image.
    Type string
    Describes the kind of image.
    createdAt String
    A time value given in ISO8601 combined date and time format that represents when the image was created.
    id String
    The provider-assigned unique ID for this managed resource.
    imageId Integer
    A unique number that can be used to identify and reference a specific image.
    minDiskSize Integer
    The minimum disk size in GB required for a Droplet to use this image.
    public_ Boolean
    Indicates whether the image in question is public or not.
    sizeGigabytes Double
    The size of the image in gigabytes.
    slug String
    A uniquely identifying string for each image.
    status String
    A status string indicating the state of a custom image.
    type String
    Describes the kind of image.
    createdAt string
    A time value given in ISO8601 combined date and time format that represents when the image was created.
    id string
    The provider-assigned unique ID for this managed resource.
    imageId number
    A unique number that can be used to identify and reference a specific image.
    minDiskSize number
    The minimum disk size in GB required for a Droplet to use this image.
    public boolean
    Indicates whether the image in question is public or not.
    sizeGigabytes number
    The size of the image in gigabytes.
    slug string
    A uniquely identifying string for each image.
    status string
    A status string indicating the state of a custom image.
    type string
    Describes the kind of image.
    created_at str
    A time value given in ISO8601 combined date and time format that represents when the image was created.
    id str
    The provider-assigned unique ID for this managed resource.
    image_id int
    A unique number that can be used to identify and reference a specific image.
    min_disk_size int
    The minimum disk size in GB required for a Droplet to use this image.
    public bool
    Indicates whether the image in question is public or not.
    size_gigabytes float
    The size of the image in gigabytes.
    slug str
    A uniquely identifying string for each image.
    status str
    A status string indicating the state of a custom image.
    type str
    Describes the kind of image.
    createdAt String
    A time value given in ISO8601 combined date and time format that represents when the image was created.
    id String
    The provider-assigned unique ID for this managed resource.
    imageId Number
    A unique number that can be used to identify and reference a specific image.
    minDiskSize Number
    The minimum disk size in GB required for a Droplet to use this image.
    public Boolean
    Indicates whether the image in question is public or not.
    sizeGigabytes Number
    The size of the image in gigabytes.
    slug String
    A uniquely identifying string for each image.
    status String
    A status string indicating the state of a custom image.
    type String
    Describes the kind of image.

    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
    A time value given in ISO8601 combined date and time format that represents when the image was created.
    Description string
    An optional description for the image.
    Distribution string
    An optional distribution name for the image. Valid values are documented here
    ImageId int
    A unique number that can be used to identify and reference a specific image.
    MinDiskSize int
    The minimum disk size in GB required for a Droplet to use this image.
    Name string
    A name for the Custom Image.
    Public bool
    Indicates whether the image in question is public or not.
    Regions List<string>
    A list of regions. (Currently only one is supported).
    SizeGigabytes double
    The size of the image in gigabytes.
    Slug string
    A uniquely identifying string for each image.
    Status string
    A status string indicating the state of a custom image.
    Tags List<string>
    A list of optional tags for the image.
    Type string
    Describes the kind of image.
    Url string
    A URL from which the custom Linux virtual machine image may be retrieved.
    CreatedAt string
    A time value given in ISO8601 combined date and time format that represents when the image was created.
    Description string
    An optional description for the image.
    Distribution string
    An optional distribution name for the image. Valid values are documented here
    ImageId int
    A unique number that can be used to identify and reference a specific image.
    MinDiskSize int
    The minimum disk size in GB required for a Droplet to use this image.
    Name string
    A name for the Custom Image.
    Public bool
    Indicates whether the image in question is public or not.
    Regions []string
    A list of regions. (Currently only one is supported).
    SizeGigabytes float64
    The size of the image in gigabytes.
    Slug string
    A uniquely identifying string for each image.
    Status string
    A status string indicating the state of a custom image.
    Tags []string
    A list of optional tags for the image.
    Type string
    Describes the kind of image.
    Url string
    A URL from which the custom Linux virtual machine image may be retrieved.
    createdAt String
    A time value given in ISO8601 combined date and time format that represents when the image was created.
    description String
    An optional description for the image.
    distribution String
    An optional distribution name for the image. Valid values are documented here
    imageId Integer
    A unique number that can be used to identify and reference a specific image.
    minDiskSize Integer
    The minimum disk size in GB required for a Droplet to use this image.
    name String
    A name for the Custom Image.
    public_ Boolean
    Indicates whether the image in question is public or not.
    regions List<String>
    A list of regions. (Currently only one is supported).
    sizeGigabytes Double
    The size of the image in gigabytes.
    slug String
    A uniquely identifying string for each image.
    status String
    A status string indicating the state of a custom image.
    tags List<String>
    A list of optional tags for the image.
    type String
    Describes the kind of image.
    url String
    A URL from which the custom Linux virtual machine image may be retrieved.
    createdAt string
    A time value given in ISO8601 combined date and time format that represents when the image was created.
    description string
    An optional description for the image.
    distribution string
    An optional distribution name for the image. Valid values are documented here
    imageId number
    A unique number that can be used to identify and reference a specific image.
    minDiskSize number
    The minimum disk size in GB required for a Droplet to use this image.
    name string
    A name for the Custom Image.
    public boolean
    Indicates whether the image in question is public or not.
    regions string[]
    A list of regions. (Currently only one is supported).
    sizeGigabytes number
    The size of the image in gigabytes.
    slug string
    A uniquely identifying string for each image.
    status string
    A status string indicating the state of a custom image.
    tags string[]
    A list of optional tags for the image.
    type string
    Describes the kind of image.
    url string
    A URL from which the custom Linux virtual machine image may be retrieved.
    created_at str
    A time value given in ISO8601 combined date and time format that represents when the image was created.
    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
    A unique number that can be used to identify and reference a specific image.
    min_disk_size int
    The minimum disk size in GB required for a Droplet to use this image.
    name str
    A name for the Custom Image.
    public bool
    Indicates whether the image in question is public or not.
    regions Sequence[str]
    A list of regions. (Currently only one is supported).
    size_gigabytes float
    The size of the image in gigabytes.
    slug str
    A uniquely identifying string for each image.
    status str
    A status string indicating the state of a custom image.
    tags Sequence[str]
    A list of optional tags for the image.
    type str
    Describes the kind of image.
    url str
    A URL from which the custom Linux virtual machine image may be retrieved.
    createdAt String
    A time value given in ISO8601 combined date and time format that represents when the image was created.
    description String
    An optional description for the image.
    distribution String
    An optional distribution name for the image. Valid values are documented here
    imageId Number
    A unique number that can be used to identify and reference a specific image.
    minDiskSize Number
    The minimum disk size in GB required for a Droplet to use this image.
    name String
    A name for the Custom Image.
    public Boolean
    Indicates whether the image in question is public or not.
    regions List<String>
    A list of regions. (Currently only one is supported).
    sizeGigabytes Number
    The size of the image in gigabytes.
    slug String
    A uniquely identifying string for each image.
    status String
    A status string indicating the state of a custom image.
    tags List<String>
    A list of optional tags for the image.
    type String
    Describes the kind of image.
    url String
    A URL from which the custom Linux virtual machine image may be retrieved.

    Package Details

    Repository
    DigitalOcean pulumi/pulumi-digitalocean
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the digitalocean Terraform Provider.
    digitalocean logo
    DigitalOcean v4.27.0 published on Wednesday, Mar 13, 2024 by Pulumi