digitalocean.getImages
Explore with Pulumi AI
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
Use the filter
block with a key
string and values
list to filter images.
For example to find all Ubuntu images:
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const ubuntu = digitalocean.getImages({
filters: [{
key: "distribution",
values: ["Ubuntu"],
}],
});
import pulumi
import pulumi_digitalocean as digitalocean
ubuntu = digitalocean.get_images(filters=[{
"key": "distribution",
"values": ["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, &digitalocean.GetImagesArgs{
Filters: []digitalocean.GetImagesFilter{
{
Key: "distribution",
Values: []string{
"Ubuntu",
},
},
},
}, nil)
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 ubuntu = DigitalOcean.GetImages.Invoke(new()
{
Filters = new[]
{
new DigitalOcean.Inputs.GetImagesFilterInputArgs
{
Key = "distribution",
Values = new[]
{
"Ubuntu",
},
},
},
});
});
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());
}
}
variables:
ubuntu:
fn::invoke:
Function: digitalocean:getImages
Arguments:
filters:
- key: distribution
values:
- Ubuntu
You can filter on multiple fields and sort the results as well:
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const available = digitalocean.getImages({
filters: [
{
key: "distribution",
values: ["Ubuntu"],
},
{
key: "regions",
values: ["nyc3"],
},
],
sorts: [{
key: "created",
direction: "desc",
}],
});
import pulumi
import pulumi_digitalocean as digitalocean
available = digitalocean.get_images(filters=[
{
"key": "distribution",
"values": ["Ubuntu"],
},
{
"key": "regions",
"values": ["nyc3"],
},
],
sorts=[{
"key": "created",
"direction": "desc",
}])
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, &digitalocean.GetImagesArgs{
Filters: []digitalocean.GetImagesFilter{
{
Key: "distribution",
Values: []string{
"Ubuntu",
},
},
{
Key: "regions",
Values: []string{
"nyc3",
},
},
},
Sorts: []digitalocean.GetImagesSort{
{
Key: "created",
Direction: pulumi.StringRef("desc"),
},
},
}, nil)
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 available = DigitalOcean.GetImages.Invoke(new()
{
Filters = new[]
{
new DigitalOcean.Inputs.GetImagesFilterInputArgs
{
Key = "distribution",
Values = new[]
{
"Ubuntu",
},
},
new DigitalOcean.Inputs.GetImagesFilterInputArgs
{
Key = "regions",
Values = new[]
{
"nyc3",
},
},
},
Sorts = new[]
{
new DigitalOcean.Inputs.GetImagesSortInputArgs
{
Key = "created",
Direction = "desc",
},
},
});
});
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 available = DigitaloceanFunctions.getImages(GetImagesArgs.builder()
.filters(
GetImagesFilterArgs.builder()
.key("distribution")
.values("Ubuntu")
.build(),
GetImagesFilterArgs.builder()
.key("regions")
.values("nyc3")
.build())
.sorts(GetImagesSortArgs.builder()
.key("created")
.direction("desc")
.build())
.build());
}
}
variables:
available:
fn::invoke:
Function: digitalocean:getImages
Arguments:
filters:
- key: distribution
values:
- Ubuntu
- key: regions
values:
- nyc3
sorts:
- key: created
direction: desc
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.
Digital Ocean. Inputs. Get Images Filter> - Filter the results.
The
filter
block is documented below. - Sorts
List<Pulumi.
Digital Ocean. Inputs. Get Images Sort> - Sort the results.
The
sort
block is documented below.
- Filters
[]Get
Images Filter - Filter the results.
The
filter
block is documented below. - Sorts
[]Get
Images Sort - Sort the results.
The
sort
block is documented below.
- filters
List<Get
Images Filter> - Filter the results.
The
filter
block is documented below. - sorts
List<Get
Images Sort> - Sort the results.
The
sort
block is documented below.
- filters
Get
Images Filter[] - Filter the results.
The
filter
block is documented below. - sorts
Get
Images Sort[] - Sort the results.
The
sort
block is documented below.
- filters
Sequence[Get
Images Filter] - Filter the results.
The
filter
block is documented below. - sorts
Sequence[Get
Images Sort] - 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.
Digital Ocean. Outputs. Get Images Image> - A set of images satisfying any
filter
andsort
criteria. Each image has the following attributes: - Filters
List<Pulumi.
Digital Ocean. Outputs. Get Images Filter> - Sorts
List<Pulumi.
Digital Ocean. Outputs. Get Images Sort>
- Id string
- The provider-assigned unique ID for this managed resource.
- Images
[]Get
Images Image - A set of images satisfying any
filter
andsort
criteria. Each image has the following attributes: - Filters
[]Get
Images Filter - Sorts
[]Get
Images Sort
- id String
- The provider-assigned unique ID for this managed resource.
- images
List<Get
Images Image> - A set of images satisfying any
filter
andsort
criteria. Each image has the following attributes: - filters
List<Get
Images Filter> - sorts
List<Get
Images Sort>
- id string
- The provider-assigned unique ID for this managed resource.
- images
Get
Images Image[] - A set of images satisfying any
filter
andsort
criteria. Each image has the following attributes: - filters
Get
Images Filter[] - sorts
Get
Images Sort[]
- id str
- The provider-assigned unique ID for this managed resource.
- images
Sequence[Get
Images Image] - A set of images satisfying any
filter
andsort
criteria. Each image has the following attributes: - filters
Sequence[Get
Images Filter] - sorts
Sequence[Get
Images Sort]
- id String
- The provider-assigned unique ID for this managed resource.
- images List<Property Map>
- A set of images satisfying any
filter
andsort
criteria. Each image has the following attributes: - 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
, ortype
. - Values List<string>
- A list of values to match against the
key
field. Only retrieves images where thekey
field takes on one or more of the values provided here. - All bool
- Set to
true
to require that a field match all of thevalues
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 thevalues
are present in the list or set. - Match
By string - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
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
, ortype
. - Values []string
- A list of values to match against the
key
field. Only retrieves images where thekey
field takes on one or more of the values provided here. - All bool
- Set to
true
to require that a field match all of thevalues
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 thevalues
are present in the list or set. - Match
By string - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
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
, ortype
. - values List<String>
- A list of values to match against the
key
field. Only retrieves images where thekey
field takes on one or more of the values provided here. - all Boolean
- Set to
true
to require that a field match all of thevalues
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 thevalues
are present in the list or set. - match
By String - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
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
, ortype
. - values string[]
- A list of values to match against the
key
field. Only retrieves images where thekey
field takes on one or more of the values provided here. - all boolean
- Set to
true
to require that a field match all of thevalues
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 thevalues
are present in the list or set. - match
By string - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
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
, ortype
. - values Sequence[str]
- A list of values to match against the
key
field. Only retrieves images where thekey
field takes on one or more of the values provided here. - all bool
- Set to
true
to require that a field match all of thevalues
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 thevalues
are present in the list or set. - match_
by str - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
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
, ortype
. - values List<String>
- A list of values to match against the
key
field. Only retrieves images where thekey
field takes on one or more of the values provided here. - all Boolean
- Set to
true
to require that a field match all of thevalues
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 thevalues
are present in the list or set. - match
By String - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
as substrings to find within the string field.
GetImagesImage
- Created string
- When the image was created
- Description string
- a description of the image
- Distribution string
- The name of the distribution of the OS of the image.
- Error
Message string - Any applicable error message pertaining to the image
- Id int
- The ID of the image.
- Image string
- The id of the image (legacy parameter).
- Min
Disk intSize - The minimum 'disk' required for the image.
- Name string
- The name of the image.
- 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 List<string>
- A set of the regions that the image is available in.
- Size
Gigabytes double - The size of the image in GB.
- Slug string
- Unique text identifier of the image.
- Status string
- Current status of the image
- List<string>
- A set of tags applied to the image
- Type string
- Type of the image.
- Created string
- When the image was created
- Description string
- a description of the image
- Distribution string
- The name of the distribution of the OS of the image.
- Error
Message string - Any applicable error message pertaining to the image
- Id int
- The ID of the image.
- Image string
- The id of the image (legacy parameter).
- Min
Disk intSize - The minimum 'disk' required for the image.
- Name string
- The name of the image.
- 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 []string
- A set of the regions that the image is available in.
- Size
Gigabytes float64 - The size of the image in GB.
- Slug string
- Unique text identifier of the image.
- Status string
- Current status of the image
- []string
- A set of tags applied to the image
- Type string
- Type of the image.
- created String
- When the image was created
- description String
- a description of the image
- distribution String
- The name of the distribution of the OS of the image.
- error
Message String - Any applicable error message pertaining to the image
- id Integer
- The ID of the image.
- image String
- The id of the image (legacy parameter).
- min
Disk IntegerSize - The minimum 'disk' required for the image.
- name String
- The name of the image.
- 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 List<String>
- A set of the regions that the image is available in.
- size
Gigabytes Double - The size of the image in GB.
- slug String
- Unique text identifier of the image.
- status String
- Current status of the image
- List<String>
- A set of tags applied to the image
- type String
- Type of the image.
- created string
- When the image was created
- description string
- a description of the image
- distribution string
- The name of the distribution of the OS of the image.
- error
Message string - Any applicable error message pertaining to the image
- id number
- The ID of the image.
- image string
- The id of the image (legacy parameter).
- min
Disk numberSize - The minimum 'disk' required for the image.
- name string
- The name of the image.
- 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 string[]
- A set of the regions that the image is available in.
- size
Gigabytes number - The size of the image in GB.
- slug string
- Unique text identifier of the image.
- status string
- Current status of the image
- string[]
- A set of tags applied to the image
- type string
- Type of the image.
- created str
- When the image was created
- description str
- a description of the image
- distribution str
- The name of the distribution of the OS of the image.
- error_
message str - Any applicable error message pertaining to the image
- id int
- The ID of the image.
- image str
- The id of the image (legacy parameter).
- min_
disk_ intsize - The minimum 'disk' required for the image.
- name str
- The name of the image.
- 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 Sequence[str]
- A set of the regions that the image is available in.
- size_
gigabytes float - The size of the image in GB.
- slug str
- Unique text identifier of the image.
- status str
- Current status of the image
- Sequence[str]
- A set of tags applied to the image
- type str
- Type of the image.
- created String
- When the image was created
- description String
- a description of the image
- distribution String
- The name of the distribution of the OS of the image.
- error
Message String - Any applicable error message pertaining to the image
- id Number
- The ID of the image.
- image String
- The id of the image (legacy parameter).
- min
Disk NumberSize - The minimum 'disk' required for the image.
- name String
- The name of the image.
- 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 List<String>
- A set of the regions that the image is available in.
- size
Gigabytes Number - The size of the image in GB.
- slug String
- Unique text identifier of the image.
- status String
- Current status of the image
- List<String>
- A set of tags applied to the image
- type String
- Type of the image.
GetImagesSort
Package Details
- Repository
- DigitalOcean pulumi/pulumi-digitalocean
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
digitalocean
Terraform Provider.