DigitalOcean

v4.16.0 published on Wednesday, Sep 28, 2022 by Pulumi

getImages

Get information on images for use in other resources (e.g. creating a Droplet based on a snapshot), with the ability to filter and sort the results. If no filters are specified, all images will be returned.

This data source is useful if the image in question is not managed by the provider or you need to utilize any of the image’s data.

Note: You can use the digitalocean.getImage data source to obtain metadata about a single image if you already know the slug, unique name, or id to retrieve.

Example Usage

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

return await Deployment.RunAsync(() => 
{
    var ubuntu = DigitalOcean.GetImages.Invoke(new()
    {
        Filters = new[]
        {
            new DigitalOcean.Inputs.GetImagesFilterInputArgs
            {
                Key = "distribution",
                Values = new[]
                {
                    "Ubuntu",
                },
            },
        },
    });

});
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 {
		_, err := digitalocean.GetImages(ctx, &GetImagesArgs{
			Filters: []GetImagesFilter{
				GetImagesFilter{
					Key: "distribution",
					Values: []string{
						"Ubuntu",
					},
				},
			},
		}, nil)
		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.DigitaloceanFunctions;
import com.pulumi.digitalocean.inputs.GetImagesArgs;
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) {
        final var ubuntu = DigitaloceanFunctions.getImages(GetImagesArgs.builder()
            .filters(GetImagesFilterArgs.builder()
                .key("distribution")
                .values("Ubuntu")
                .build())
            .build());

    }
}
import pulumi
import pulumi_digitalocean as digitalocean

ubuntu = digitalocean.get_images(filters=[digitalocean.GetImagesFilterArgs(
    key="distribution",
    values=["Ubuntu"],
)])
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

const ubuntu = pulumi.output(digitalocean.getImages({
    filters: [{
        key: "distribution",
        values: ["Ubuntu"],
    }],
}));
variables:
  ubuntu:
    Fn::Invoke:
      Function: digitalocean:getImages
      Arguments:
        filters:
          - key: distribution
            values:
              - Ubuntu

Using getImages

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getImages(args: GetImagesArgs, opts?: InvokeOptions): Promise<GetImagesResult>
function getImagesOutput(args: GetImagesOutputArgs, opts?: InvokeOptions): Output<GetImagesResult>
def get_images(filters: Optional[Sequence[GetImagesFilter]] = None,
               sorts: Optional[Sequence[GetImagesSort]] = None,
               opts: Optional[InvokeOptions] = None) -> GetImagesResult
def get_images_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetImagesFilterArgs]]]] = None,
               sorts: Optional[pulumi.Input[Sequence[pulumi.Input[GetImagesSortArgs]]]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetImagesResult]
func GetImages(ctx *Context, args *GetImagesArgs, opts ...InvokeOption) (*GetImagesResult, error)
func GetImagesOutput(ctx *Context, args *GetImagesOutputArgs, opts ...InvokeOption) GetImagesResultOutput

> Note: This function is named GetImages in the Go SDK.

public static class GetImages 
{
    public static Task<GetImagesResult> InvokeAsync(GetImagesArgs args, InvokeOptions? opts = null)
    public static Output<GetImagesResult> Invoke(GetImagesInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetImagesResult> getImages(GetImagesArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: digitalocean:index/getImages:getImages
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Filters List<Pulumi.DigitalOcean.Inputs.GetImagesFilter>

Filter the results. The filter block is documented below.

Sorts List<Pulumi.DigitalOcean.Inputs.GetImagesSort>

Sort the results. The sort block is documented below.

Filters []GetImagesFilter

Filter the results. The filter block is documented below.

Sorts []GetImagesSort

Sort the results. The sort block is documented below.

filters List<GetImagesFilter>

Filter the results. The filter block is documented below.

sorts List<GetImagesSort>

Sort the results. The sort block is documented below.

filters GetImagesFilter[]

Filter the results. The filter block is documented below.

sorts GetImagesSort[]

Sort the results. The sort block is documented below.

filters Sequence[GetImagesFilter]

Filter the results. The filter block is documented below.

sorts Sequence[GetImagesSort]

Sort the results. The sort block is documented below.

filters List<Property Map>

Filter the results. The filter block is documented below.

sorts List<Property Map>

Sort the results. The sort block is documented below.

getImages Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Images List<Pulumi.DigitalOcean.Outputs.GetImagesImage>

A set of images satisfying any filter and sort criteria. Each image has the following attributes:

  • slug: Unique text identifier of the image.
  • id: The ID of the image.
  • name: The name of the image.
  • type: Type of the image.
Filters List<Pulumi.DigitalOcean.Outputs.GetImagesFilter>
Sorts List<Pulumi.DigitalOcean.Outputs.GetImagesSort>
Id string

The provider-assigned unique ID for this managed resource.

Images []GetImagesImage

A set of images satisfying any filter and sort criteria. Each image has the following attributes:

  • slug: Unique text identifier of the image.
  • id: The ID of the image.
  • name: The name of the image.
  • type: Type of the image.
Filters []GetImagesFilter
Sorts []GetImagesSort
id String

The provider-assigned unique ID for this managed resource.

images List<GetImagesImage>

A set of images satisfying any filter and sort criteria. Each image has the following attributes:

  • slug: Unique text identifier of the image.
  • id: The ID of the image.
  • name: The name of the image.
  • type: Type of the image.
filters List<GetImagesFilter>
sorts List<GetImagesSort>
id string

The provider-assigned unique ID for this managed resource.

images GetImagesImage[]

A set of images satisfying any filter and sort criteria. Each image has the following attributes:

  • slug: Unique text identifier of the image.
  • id: The ID of the image.
  • name: The name of the image.
  • type: Type of the image.
filters GetImagesFilter[]
sorts GetImagesSort[]
id str

The provider-assigned unique ID for this managed resource.

images Sequence[GetImagesImage]

A set of images satisfying any filter and sort criteria. Each image has the following attributes:

  • slug: Unique text identifier of the image.
  • id: The ID of the image.
  • name: The name of the image.
  • type: Type of the image.
filters Sequence[GetImagesFilter]
sorts Sequence[GetImagesSort]
id String

The provider-assigned unique ID for this managed resource.

images List<Property Map>

A set of images satisfying any filter and sort criteria. Each image has the following attributes:

  • slug: Unique text identifier of the image.
  • id: The ID of the image.
  • name: The name of the image.
  • type: Type of the image.
filters List<Property Map>
sorts List<Property Map>

Supporting Types

GetImagesFilter

Key string

Filter the images by this key. This may be one of distribution, error_message, id, image, min_disk_size, name, private, regions, size_gigabytes, slug, status, tags, or type.

Values List<string>

A list of values to match against the key field. Only retrieves images where the key field takes on one or more of the values provided here.

All bool

Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.

MatchBy string

One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.

Key string

Filter the images by this key. This may be one of distribution, error_message, id, image, min_disk_size, name, private, regions, size_gigabytes, slug, status, tags, or type.

Values []string

A list of values to match against the key field. Only retrieves images where the key field takes on one or more of the values provided here.

All bool

Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.

MatchBy string

One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.

key String

Filter the images by this key. This may be one of distribution, error_message, id, image, min_disk_size, name, private, regions, size_gigabytes, slug, status, tags, or type.

values List<String>

A list of values to match against the key field. Only retrieves images where the key field takes on one or more of the values provided here.

all Boolean

Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.

matchBy String

One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.

key string

Filter the images by this key. This may be one of distribution, error_message, id, image, min_disk_size, name, private, regions, size_gigabytes, slug, status, tags, or type.

values string[]

A list of values to match against the key field. Only retrieves images where the key field takes on one or more of the values provided here.

all boolean

Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.

matchBy string

One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.

key str

Filter the images by this key. This may be one of distribution, error_message, id, image, min_disk_size, name, private, regions, size_gigabytes, slug, status, tags, or type.

values Sequence[str]

A list of values to match against the key field. Only retrieves images where the key field takes on one or more of the values provided here.

all bool

Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.

match_by str

One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.

key String

Filter the images by this key. This may be one of distribution, error_message, id, image, min_disk_size, name, private, regions, size_gigabytes, slug, status, tags, or type.

values List<String>

A list of values to match against the key field. Only retrieves images where the key field takes on one or more of the values provided here.

all Boolean

Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.

matchBy String

One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.

GetImagesImage

Created string
Description string
Distribution string

The name of the distribution of the OS of the image.

  • min_disk_size: The minimum 'disk' required for the image.
  • size_gigabytes: The size of the image in GB.
ErrorMessage string
Id int
Image string

The id of the image (legacy parameter).

MinDiskSize int
Name string
Private bool

Is image a public image or not. Public images represent Linux distributions or One-Click Applications, while non-public images represent snapshots and backups and are only available within your account.

  • regions: A set of the regions that the image is available in.
  • tags: A set of tags applied to the image
  • created: When the image was created
  • status: Current status of the image
  • error_message: Any applicable error message pertaining to the image
Regions List<string>
SizeGigabytes double
Slug string
Status string
Tags List<string>
Type string
Created string
Description string
Distribution string

The name of the distribution of the OS of the image.

  • min_disk_size: The minimum 'disk' required for the image.
  • size_gigabytes: The size of the image in GB.
ErrorMessage string
Id int
Image string

The id of the image (legacy parameter).

MinDiskSize int
Name string
Private bool

Is image a public image or not. Public images represent Linux distributions or One-Click Applications, while non-public images represent snapshots and backups and are only available within your account.

  • regions: A set of the regions that the image is available in.
  • tags: A set of tags applied to the image
  • created: When the image was created
  • status: Current status of the image
  • error_message: Any applicable error message pertaining to the image
Regions []string
SizeGigabytes float64
Slug string
Status string
Tags []string
Type string
created String
description String
distribution String

The name of the distribution of the OS of the image.

  • min_disk_size: The minimum 'disk' required for the image.
  • size_gigabytes: The size of the image in GB.
errorMessage String
id Integer
image String

The id of the image (legacy parameter).

minDiskSize Integer
name String
private_ Boolean

Is image a public image or not. Public images represent Linux distributions or One-Click Applications, while non-public images represent snapshots and backups and are only available within your account.

  • regions: A set of the regions that the image is available in.
  • tags: A set of tags applied to the image
  • created: When the image was created
  • status: Current status of the image
  • error_message: Any applicable error message pertaining to the image
regions List<String>
sizeGigabytes Double
slug String
status String
tags List<String>
type String
created string
description string
distribution string

The name of the distribution of the OS of the image.

  • min_disk_size: The minimum 'disk' required for the image.
  • size_gigabytes: The size of the image in GB.
errorMessage string
id number
image string

The id of the image (legacy parameter).

minDiskSize number
name string
private boolean

Is image a public image or not. Public images represent Linux distributions or One-Click Applications, while non-public images represent snapshots and backups and are only available within your account.

  • regions: A set of the regions that the image is available in.
  • tags: A set of tags applied to the image
  • created: When the image was created
  • status: Current status of the image
  • error_message: Any applicable error message pertaining to the image
regions string[]
sizeGigabytes number
slug string
status string
tags string[]
type string
created str
description str
distribution str

The name of the distribution of the OS of the image.

  • min_disk_size: The minimum 'disk' required for the image.
  • size_gigabytes: The size of the image in GB.
error_message str
id int
image str

The id of the image (legacy parameter).

min_disk_size int
name str
private bool

Is image a public image or not. Public images represent Linux distributions or One-Click Applications, while non-public images represent snapshots and backups and are only available within your account.

  • regions: A set of the regions that the image is available in.
  • tags: A set of tags applied to the image
  • created: When the image was created
  • status: Current status of the image
  • error_message: Any applicable error message pertaining to the image
regions Sequence[str]
size_gigabytes float
slug str
status str
tags Sequence[str]
type str
created String
description String
distribution String

The name of the distribution of the OS of the image.

  • min_disk_size: The minimum 'disk' required for the image.
  • size_gigabytes: The size of the image in GB.
errorMessage String
id Number
image String

The id of the image (legacy parameter).

minDiskSize Number
name String
private Boolean

Is image a public image or not. Public images represent Linux distributions or One-Click Applications, while non-public images represent snapshots and backups and are only available within your account.

  • regions: A set of the regions that the image is available in.
  • tags: A set of tags applied to the image
  • created: When the image was created
  • status: Current status of the image
  • error_message: Any applicable error message pertaining to the image
regions List<String>
sizeGigabytes Number
slug String
status String
tags List<String>
type String

GetImagesSort

Key string

Sort the images by this key. This may be one of distribution, error_message, id, image, min_disk_size, name, private, size_gigabytes, slug, status, or type.

Direction string

The sort direction. This may be either asc or desc.

Key string

Sort the images by this key. This may be one of distribution, error_message, id, image, min_disk_size, name, private, size_gigabytes, slug, status, or type.

Direction string

The sort direction. This may be either asc or desc.

key String

Sort the images by this key. This may be one of distribution, error_message, id, image, min_disk_size, name, private, size_gigabytes, slug, status, or type.

direction String

The sort direction. This may be either asc or desc.

key string

Sort the images by this key. This may be one of distribution, error_message, id, image, min_disk_size, name, private, size_gigabytes, slug, status, or type.

direction string

The sort direction. This may be either asc or desc.

key str

Sort the images by this key. This may be one of distribution, error_message, id, image, min_disk_size, name, private, size_gigabytes, slug, status, or type.

direction str

The sort direction. This may be either asc or desc.

key String

Sort the images by this key. This may be one of distribution, error_message, id, image, min_disk_size, name, private, size_gigabytes, slug, status, or type.

direction String

The sort direction. This may be either asc or desc.

Package Details

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

This Pulumi package is based on the digitalocean Terraform Provider.