1. Packages
  2. Packages
  3. Hcloud Provider
  4. API Docs
  5. getImage
Viewing docs for Hetzner Cloud v1.41.0
published on Wednesday, Jul 29, 2026 by Pulumi
hcloud logo
Viewing docs for Hetzner Cloud v1.41.0
published on Wednesday, Jul 29, 2026 by Pulumi

    Provides details about a Hetzner Cloud Image.

    It is recommended to always provide the image architecture (using ‘‘with_architecture’’).

    See the Image API documentation for more details.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as hcloud from "@pulumi/hcloud";
    
    const byId = hcloud.getImage({
        id: 114690387,
    });
    const byNameX86 = hcloud.getImage({
        name: "debian-12",
        withArchitecture: "x86",
    });
    const byNameArm = hcloud.getImage({
        name: "debian-12",
        withArchitecture: "arm",
    });
    const byLabel = hcloud.getImage({
        withSelector: "key=value",
        mostRecent: true,
    });
    const main = new hcloud.Server("main", {image: byName.id});
    
    import pulumi
    import pulumi_hcloud as hcloud
    
    by_id = hcloud.get_image(id=114690387)
    by_name_x86 = hcloud.get_image(name="debian-12",
        with_architecture="x86")
    by_name_arm = hcloud.get_image(name="debian-12",
        with_architecture="arm")
    by_label = hcloud.get_image(with_selector="key=value",
        most_recent=True)
    main = hcloud.Server("main", image=by_name["id"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-hcloud/sdk/go/hcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := hcloud.GetImage(ctx, &hcloud.GetImageArgs{
    			Id: pulumi.IntRef(114690387),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = hcloud.GetImage(ctx, &hcloud.GetImageArgs{
    			Name:             pulumi.StringRef("debian-12"),
    			WithArchitecture: pulumi.StringRef("x86"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = hcloud.GetImage(ctx, &hcloud.GetImageArgs{
    			Name:             pulumi.StringRef("debian-12"),
    			WithArchitecture: pulumi.StringRef("arm"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = hcloud.GetImage(ctx, &hcloud.GetImageArgs{
    			WithSelector: pulumi.StringRef("key=value"),
    			MostRecent:   pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = hcloud.NewServer(ctx, "main", &hcloud.ServerArgs{
    			Image: pulumi.Any(byName.Id),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using HCloud = Pulumi.HCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var byId = HCloud.GetImage.Invoke(new()
        {
            Id = 114690387,
        });
    
        var byNameX86 = HCloud.GetImage.Invoke(new()
        {
            Name = "debian-12",
            WithArchitecture = "x86",
        });
    
        var byNameArm = HCloud.GetImage.Invoke(new()
        {
            Name = "debian-12",
            WithArchitecture = "arm",
        });
    
        var byLabel = HCloud.GetImage.Invoke(new()
        {
            WithSelector = "key=value",
            MostRecent = true,
        });
    
        var main = new HCloud.Server("main", new()
        {
            Image = byName.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.hcloud.HcloudFunctions;
    import com.pulumi.hcloud.inputs.GetImageArgs;
    import com.pulumi.hcloud.Server;
    import com.pulumi.hcloud.ServerArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 byId = HcloudFunctions.getImage(GetImageArgs.builder()
                .id(114690387)
                .build());
    
            final var byNameX86 = HcloudFunctions.getImage(GetImageArgs.builder()
                .name("debian-12")
                .withArchitecture("x86")
                .build());
    
            final var byNameArm = HcloudFunctions.getImage(GetImageArgs.builder()
                .name("debian-12")
                .withArchitecture("arm")
                .build());
    
            final var byLabel = HcloudFunctions.getImage(GetImageArgs.builder()
                .withSelector("key=value")
                .mostRecent(true)
                .build());
    
            var main = new Server("main", ServerArgs.builder()
                .image(byName.id())
                .build());
    
        }
    }
    
    resources:
      main:
        type: hcloud:Server
        properties:
          image: ${byName.id}
    variables:
      byId:
        fn::invoke:
          function: hcloud:getImage
          arguments:
            id: 1.14690387e+08
      byNameX86:
        fn::invoke:
          function: hcloud:getImage
          arguments:
            name: debian-12
            withArchitecture: x86
      byNameArm:
        fn::invoke:
          function: hcloud:getImage
          arguments:
            name: debian-12
            withArchitecture: arm
      byLabel:
        fn::invoke:
          function: hcloud:getImage
          arguments:
            withSelector: key=value
            mostRecent: true
    
    pulumi {
      required_providers {
        hcloud = {
          source = "pulumi/hcloud"
        }
      }
    }
    
    data "hcloud_getimage" "byId" {
      id = 114690387
    }
    data "hcloud_getimage" "byNameX86" {
      name              = "debian-12"
      with_architecture = "x86"
    }
    data "hcloud_getimage" "byNameArm" {
      name              = "debian-12"
      with_architecture = "arm"
    }
    data "hcloud_getimage" "byLabel" {
      with_selector = "key=value"
      most_recent   = true
    }
    
    resource "hcloud_server" "main" {
      image = byName.id
    }
    

    Using getImage

    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 getImage(args: GetImageArgs, opts?: InvokeOptions): Promise<GetImageResult>
    function getImageOutput(args: GetImageOutputArgs, opts?: InvokeOptions): Output<GetImageResult>
    def get_image(id: Optional[int] = None,
                  include_deprecated: Optional[bool] = None,
                  most_recent: Optional[bool] = None,
                  name: Optional[str] = None,
                  selector: Optional[str] = None,
                  with_architecture: Optional[str] = None,
                  with_selector: Optional[str] = None,
                  with_statuses: Optional[Sequence[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> GetImageResult
    def get_image_output(id: pulumi.Input[Optional[int]] = None,
                  include_deprecated: pulumi.Input[Optional[bool]] = None,
                  most_recent: pulumi.Input[Optional[bool]] = None,
                  name: pulumi.Input[Optional[str]] = None,
                  selector: pulumi.Input[Optional[str]] = None,
                  with_architecture: pulumi.Input[Optional[str]] = None,
                  with_selector: pulumi.Input[Optional[str]] = None,
                  with_statuses: pulumi.Input[Optional[Sequence[pulumi.Input[str]]]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetImageResult]
    func GetImage(ctx *Context, args *GetImageArgs, opts ...InvokeOption) (*GetImageResult, error)
    func GetImageOutput(ctx *Context, args *GetImageOutputArgs, opts ...InvokeOption) GetImageResultOutput

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

    public static class GetImage 
    {
        public static Task<GetImageResult> InvokeAsync(GetImageArgs args, InvokeOptions? opts = null)
        public static Output<GetImageResult> Invoke(GetImageInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetImageResult> getImage(GetImageArgs args, InvokeOptions options)
    public static Output<GetImageResult> getImage(GetImageArgs args, InvokeOptions options)
    
    fn::invoke:
      function: hcloud:index/getImage:getImage
      arguments:
        # arguments dictionary
    data "hcloud_get_image" "name" {
        # arguments
    }

    The following arguments are supported:

    Id int
    ID of the Image.
    IncludeDeprecated bool
    Include deprecated images.
    MostRecent bool
    Sort results by created date, and return the most recent result.
    Name string
    Name of the Image, only present when the type is system.
    Selector string
    Filter results using a Label Selector.

    Deprecated: Please use the withSelector property instead.

    WithArchitecture string
    Filter results by architecture, for example x86 (default) or arm.
    WithSelector string
    Filter results using a Label Selector.
    WithStatuses List<string>
    Filter results by statuses, for example creating or available.
    Id int
    ID of the Image.
    IncludeDeprecated bool
    Include deprecated images.
    MostRecent bool
    Sort results by created date, and return the most recent result.
    Name string
    Name of the Image, only present when the type is system.
    Selector string
    Filter results using a Label Selector.

    Deprecated: Please use the withSelector property instead.

    WithArchitecture string
    Filter results by architecture, for example x86 (default) or arm.
    WithSelector string
    Filter results using a Label Selector.
    WithStatuses []string
    Filter results by statuses, for example creating or available.
    id number
    ID of the Image.
    include_deprecated bool
    Include deprecated images.
    most_recent bool
    Sort results by created date, and return the most recent result.
    name string
    Name of the Image, only present when the type is system.
    selector string
    Filter results using a Label Selector.

    Deprecated: Please use the withSelector property instead.

    with_architecture string
    Filter results by architecture, for example x86 (default) or arm.
    with_selector string
    Filter results using a Label Selector.
    with_statuses list(string)
    Filter results by statuses, for example creating or available.
    id Integer
    ID of the Image.
    includeDeprecated Boolean
    Include deprecated images.
    mostRecent Boolean
    Sort results by created date, and return the most recent result.
    name String
    Name of the Image, only present when the type is system.
    selector String
    Filter results using a Label Selector.

    Deprecated: Please use the withSelector property instead.

    withArchitecture String
    Filter results by architecture, for example x86 (default) or arm.
    withSelector String
    Filter results using a Label Selector.
    withStatuses List<String>
    Filter results by statuses, for example creating or available.
    id number
    ID of the Image.
    includeDeprecated boolean
    Include deprecated images.
    mostRecent boolean
    Sort results by created date, and return the most recent result.
    name string
    Name of the Image, only present when the type is system.
    selector string
    Filter results using a Label Selector.

    Deprecated: Please use the withSelector property instead.

    withArchitecture string
    Filter results by architecture, for example x86 (default) or arm.
    withSelector string
    Filter results using a Label Selector.
    withStatuses string[]
    Filter results by statuses, for example creating or available.
    id int
    ID of the Image.
    include_deprecated bool
    Include deprecated images.
    most_recent bool
    Sort results by created date, and return the most recent result.
    name str
    Name of the Image, only present when the type is system.
    selector str
    Filter results using a Label Selector.

    Deprecated: Please use the withSelector property instead.

    with_architecture str
    Filter results by architecture, for example x86 (default) or arm.
    with_selector str
    Filter results using a Label Selector.
    with_statuses Sequence[str]
    Filter results by statuses, for example creating or available.
    id Number
    ID of the Image.
    includeDeprecated Boolean
    Include deprecated images.
    mostRecent Boolean
    Sort results by created date, and return the most recent result.
    name String
    Name of the Image, only present when the type is system.
    selector String
    Filter results using a Label Selector.

    Deprecated: Please use the withSelector property instead.

    withArchitecture String
    Filter results by architecture, for example x86 (default) or arm.
    withSelector String
    Filter results using a Label Selector.
    withStatuses List<String>
    Filter results by statuses, for example creating or available.

    getImage Result

    The following output properties are available:

    Architecture string
    CPU architecture compatible with the Image.
    Created string
    Point in time when the Image was created (in RFC3339 format).
    Deprecated string
    Point in time when the Image was marked as deprecated (in RFC3339 format).
    Description string
    Description of the Image.
    Labels Dictionary<string, string>
    User-defined labels (key-value pairs) for the resource.
    OsFlavor string
    Flavor of the operating system contained in the Image.
    OsVersion string
    Version of the operating system contained in the Image.
    RapidDeploy bool
    Whether the Image is optimized for a rapid deployment.
    Type string
    Type of the Image, for example system, backup or snapshot.
    Id int
    ID of the Image.
    IncludeDeprecated bool
    Include deprecated images.
    MostRecent bool
    Sort results by created date, and return the most recent result.
    Name string
    Name of the Image, only present when the type is system.
    Selector string
    Filter results using a Label Selector.

    Deprecated: Please use the withSelector property instead.

    WithArchitecture string
    Filter results by architecture, for example x86 (default) or arm.
    WithSelector string
    Filter results using a Label Selector.
    WithStatuses List<string>
    Filter results by statuses, for example creating or available.
    Architecture string
    CPU architecture compatible with the Image.
    Created string
    Point in time when the Image was created (in RFC3339 format).
    Deprecated string
    Point in time when the Image was marked as deprecated (in RFC3339 format).
    Description string
    Description of the Image.
    Labels map[string]string
    User-defined labels (key-value pairs) for the resource.
    OsFlavor string
    Flavor of the operating system contained in the Image.
    OsVersion string
    Version of the operating system contained in the Image.
    RapidDeploy bool
    Whether the Image is optimized for a rapid deployment.
    Type string
    Type of the Image, for example system, backup or snapshot.
    Id int
    ID of the Image.
    IncludeDeprecated bool
    Include deprecated images.
    MostRecent bool
    Sort results by created date, and return the most recent result.
    Name string
    Name of the Image, only present when the type is system.
    Selector string
    Filter results using a Label Selector.

    Deprecated: Please use the withSelector property instead.

    WithArchitecture string
    Filter results by architecture, for example x86 (default) or arm.
    WithSelector string
    Filter results using a Label Selector.
    WithStatuses []string
    Filter results by statuses, for example creating or available.
    architecture string
    CPU architecture compatible with the Image.
    created string
    Point in time when the Image was created (in RFC3339 format).
    deprecated string
    Point in time when the Image was marked as deprecated (in RFC3339 format).
    description string
    Description of the Image.
    labels map(string)
    User-defined labels (key-value pairs) for the resource.
    os_flavor string
    Flavor of the operating system contained in the Image.
    os_version string
    Version of the operating system contained in the Image.
    rapid_deploy bool
    Whether the Image is optimized for a rapid deployment.
    type string
    Type of the Image, for example system, backup or snapshot.
    id number
    ID of the Image.
    include_deprecated bool
    Include deprecated images.
    most_recent bool
    Sort results by created date, and return the most recent result.
    name string
    Name of the Image, only present when the type is system.
    selector string
    Filter results using a Label Selector.

    Deprecated: Please use the withSelector property instead.

    with_architecture string
    Filter results by architecture, for example x86 (default) or arm.
    with_selector string
    Filter results using a Label Selector.
    with_statuses list(string)
    Filter results by statuses, for example creating or available.
    architecture String
    CPU architecture compatible with the Image.
    created String
    Point in time when the Image was created (in RFC3339 format).
    deprecated String
    Point in time when the Image was marked as deprecated (in RFC3339 format).
    description String
    Description of the Image.
    labels Map<String,String>
    User-defined labels (key-value pairs) for the resource.
    osFlavor String
    Flavor of the operating system contained in the Image.
    osVersion String
    Version of the operating system contained in the Image.
    rapidDeploy Boolean
    Whether the Image is optimized for a rapid deployment.
    type String
    Type of the Image, for example system, backup or snapshot.
    id Integer
    ID of the Image.
    includeDeprecated Boolean
    Include deprecated images.
    mostRecent Boolean
    Sort results by created date, and return the most recent result.
    name String
    Name of the Image, only present when the type is system.
    selector String
    Filter results using a Label Selector.

    Deprecated: Please use the withSelector property instead.

    withArchitecture String
    Filter results by architecture, for example x86 (default) or arm.
    withSelector String
    Filter results using a Label Selector.
    withStatuses List<String>
    Filter results by statuses, for example creating or available.
    architecture string
    CPU architecture compatible with the Image.
    created string
    Point in time when the Image was created (in RFC3339 format).
    deprecated string
    Point in time when the Image was marked as deprecated (in RFC3339 format).
    description string
    Description of the Image.
    labels {[key: string]: string}
    User-defined labels (key-value pairs) for the resource.
    osFlavor string
    Flavor of the operating system contained in the Image.
    osVersion string
    Version of the operating system contained in the Image.
    rapidDeploy boolean
    Whether the Image is optimized for a rapid deployment.
    type string
    Type of the Image, for example system, backup or snapshot.
    id number
    ID of the Image.
    includeDeprecated boolean
    Include deprecated images.
    mostRecent boolean
    Sort results by created date, and return the most recent result.
    name string
    Name of the Image, only present when the type is system.
    selector string
    Filter results using a Label Selector.

    Deprecated: Please use the withSelector property instead.

    withArchitecture string
    Filter results by architecture, for example x86 (default) or arm.
    withSelector string
    Filter results using a Label Selector.
    withStatuses string[]
    Filter results by statuses, for example creating or available.
    architecture str
    CPU architecture compatible with the Image.
    created str
    Point in time when the Image was created (in RFC3339 format).
    deprecated str
    Point in time when the Image was marked as deprecated (in RFC3339 format).
    description str
    Description of the Image.
    labels Mapping[str, str]
    User-defined labels (key-value pairs) for the resource.
    os_flavor str
    Flavor of the operating system contained in the Image.
    os_version str
    Version of the operating system contained in the Image.
    rapid_deploy bool
    Whether the Image is optimized for a rapid deployment.
    type str
    Type of the Image, for example system, backup or snapshot.
    id int
    ID of the Image.
    include_deprecated bool
    Include deprecated images.
    most_recent bool
    Sort results by created date, and return the most recent result.
    name str
    Name of the Image, only present when the type is system.
    selector str
    Filter results using a Label Selector.

    Deprecated: Please use the withSelector property instead.

    with_architecture str
    Filter results by architecture, for example x86 (default) or arm.
    with_selector str
    Filter results using a Label Selector.
    with_statuses Sequence[str]
    Filter results by statuses, for example creating or available.
    architecture String
    CPU architecture compatible with the Image.
    created String
    Point in time when the Image was created (in RFC3339 format).
    deprecated String
    Point in time when the Image was marked as deprecated (in RFC3339 format).
    description String
    Description of the Image.
    labels Map<String>
    User-defined labels (key-value pairs) for the resource.
    osFlavor String
    Flavor of the operating system contained in the Image.
    osVersion String
    Version of the operating system contained in the Image.
    rapidDeploy Boolean
    Whether the Image is optimized for a rapid deployment.
    type String
    Type of the Image, for example system, backup or snapshot.
    id Number
    ID of the Image.
    includeDeprecated Boolean
    Include deprecated images.
    mostRecent Boolean
    Sort results by created date, and return the most recent result.
    name String
    Name of the Image, only present when the type is system.
    selector String
    Filter results using a Label Selector.

    Deprecated: Please use the withSelector property instead.

    withArchitecture String
    Filter results by architecture, for example x86 (default) or arm.
    withSelector String
    Filter results using a Label Selector.
    withStatuses List<String>
    Filter results by statuses, for example creating or available.

    Package Details

    Repository
    Hetzner Cloud pulumi/pulumi-hcloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the hcloud Terraform Provider.
    hcloud logo
    Viewing docs for Hetzner Cloud v1.41.0
    published on Wednesday, Jul 29, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial