Hetzner Cloud

Pulumi Official
Package maintained by Pulumi
v1.10.1 published on Wednesday, Aug 3, 2022 by Pulumi

getImage

Example Usage

using Pulumi;
using HCloud = Pulumi.HCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var image1 = Output.Create(HCloud.GetImage.InvokeAsync(new HCloud.GetImageArgs
        {
            Id = 1234,
        }));
        var image2 = Output.Create(HCloud.GetImage.InvokeAsync(new HCloud.GetImageArgs
        {
            Name = "ubuntu-18.04",
        }));
        var image3 = Output.Create(HCloud.GetImage.InvokeAsync(new HCloud.GetImageArgs
        {
            WithSelector = "key=value",
        }));
        var main = new HCloud.Server("main", new HCloud.ServerArgs
        {
            Image = image1.Apply(image1 => image1.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 {
		image1, err := hcloud.GetImage(ctx, &GetImageArgs{
			Id: pulumi.IntRef(1234),
		}, nil)
		if err != nil {
			return err
		}
		_, err = hcloud.GetImage(ctx, &GetImageArgs{
			Name: pulumi.StringRef("ubuntu-18.04"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = hcloud.GetImage(ctx, &GetImageArgs{
			WithSelector: pulumi.StringRef("key=value"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = hcloud.NewServer(ctx, "main", &hcloud.ServerArgs{
			Image: pulumi.Int(image1.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var image1 = Output.of(HcloudFunctions.getImage(GetImageArgs.builder()
            .id("1234")
            .build()));

        final var image2 = Output.of(HcloudFunctions.getImage(GetImageArgs.builder()
            .name("ubuntu-18.04")
            .build()));

        final var image3 = Output.of(HcloudFunctions.getImage(GetImageArgs.builder()
            .withSelector("key=value")
            .build()));

        var main = new Server("main", ServerArgs.builder()        
            .image(image1.apply(getImageResult -> getImageResult.id()))
            .build());

    }
}
import pulumi
import pulumi_hcloud as hcloud

image1 = hcloud.get_image(id=1234)
image2 = hcloud.get_image(name="ubuntu-18.04")
image3 = hcloud.get_image(with_selector="key=value")
main = hcloud.Server("main", image=image1.id)
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const image1 = hcloud.getImage({
    id: 1234,
});
const image2 = hcloud.getImage({
    name: "ubuntu-18.04",
});
const image3 = hcloud.getImage({
    withSelector: "key=value",
});
const main = new hcloud.Server("main", {image: image1.then(image1 => image1.id)});
resources:
  main:
    type: hcloud:Server
    properties:
      image: ${image1.id}
variables:
  image1:
    Fn::Invoke:
      Function: hcloud:getImage
      Arguments:
        id: 1234
  image2:
    Fn::Invoke:
      Function: hcloud:getImage
      Arguments:
        name: ubuntu-18.04
  image3:
    Fn::Invoke:
      Function: hcloud:getImage
      Arguments:
        withSelector: key=value

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,
              most_recent: Optional[bool] = None,
              name: Optional[str] = None,
              selector: Optional[str] = None,
              with_selector: Optional[str] = None,
              with_statuses: Optional[Sequence[str]] = None,
              opts: Optional[InvokeOptions] = None) -> GetImageResult
def get_image_output(id: Optional[pulumi.Input[int]] = None,
              most_recent: Optional[pulumi.Input[bool]] = None,
              name: Optional[pulumi.Input[str]] = None,
              selector: Optional[pulumi.Input[str]] = None,
              with_selector: Optional[pulumi.Input[str]] = None,
              with_statuses: Optional[pulumi.Input[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)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: hcloud:index/getImage:getImage
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Id int

ID of the Image.

MostRecent bool

If more than one result is returned, use the most recent Image.

Name string

Name of the Image.

Selector string

Deprecated:

Please use the with_selector property instead.

WithSelector string

Label selector

WithStatuses List<string>

List only images with the specified status, could contain creating or available.

Id int

ID of the Image.

MostRecent bool

If more than one result is returned, use the most recent Image.

Name string

Name of the Image.

Selector string

Deprecated:

Please use the with_selector property instead.

WithSelector string

Label selector

WithStatuses []string

List only images with the specified status, could contain creating or available.

id Integer

ID of the Image.

mostRecent Boolean

If more than one result is returned, use the most recent Image.

name String

Name of the Image.

selector String

Deprecated:

Please use the with_selector property instead.

withSelector String

Label selector

withStatuses List<String>

List only images with the specified status, could contain creating or available.

id number

ID of the Image.

mostRecent boolean

If more than one result is returned, use the most recent Image.

name string

Name of the Image.

selector string

Deprecated:

Please use the with_selector property instead.

withSelector string

Label selector

withStatuses string[]

List only images with the specified status, could contain creating or available.

id int

ID of the Image.

most_recent bool

If more than one result is returned, use the most recent Image.

name str

Name of the Image.

selector str

Deprecated:

Please use the with_selector property instead.

with_selector str

Label selector

with_statuses Sequence[str]

List only images with the specified status, could contain creating or available.

id Number

ID of the Image.

mostRecent Boolean

If more than one result is returned, use the most recent Image.

name String

Name of the Image.

selector String

Deprecated:

Please use the with_selector property instead.

withSelector String

Label selector

withStatuses List<String>

List only images with the specified status, could contain creating or available.

getImage Result

The following output properties are available:

Created string

(string) Date when the Image was created (in ISO-8601 format).

Deprecated string

(string) Point in time when the image is considered to be deprecated (in ISO-8601 format).

Description string

(string) Description of the Image.

Id int

(int) Unique ID of the Image.

Labels Dictionary<string, object>
Name string

(string) Name of the Image, only present when the Image is of type system.

OsFlavor string

(string) Flavor of operating system contained in the image, could be ubuntu, centos, debian, fedora or unknown.

OsVersion string

(string) Operating system version.

RapidDeploy bool

(bool) Indicates that rapid deploy of the image is available.

Type string

(string) Type of the Image, could be system, backup or snapshot.

MostRecent bool
Selector string

Deprecated:

Please use the with_selector property instead.

WithSelector string
WithStatuses List<string>
Created string

(string) Date when the Image was created (in ISO-8601 format).

Deprecated string

(string) Point in time when the image is considered to be deprecated (in ISO-8601 format).

Description string

(string) Description of the Image.

Id int

(int) Unique ID of the Image.

Labels map[string]interface{}
Name string

(string) Name of the Image, only present when the Image is of type system.

OsFlavor string

(string) Flavor of operating system contained in the image, could be ubuntu, centos, debian, fedora or unknown.

OsVersion string

(string) Operating system version.

RapidDeploy bool

(bool) Indicates that rapid deploy of the image is available.

Type string

(string) Type of the Image, could be system, backup or snapshot.

MostRecent bool
Selector string

Deprecated:

Please use the with_selector property instead.

WithSelector string
WithStatuses []string
created String

(string) Date when the Image was created (in ISO-8601 format).

deprecated String

(string) Point in time when the image is considered to be deprecated (in ISO-8601 format).

description String

(string) Description of the Image.

id Integer

(int) Unique ID of the Image.

labels Map<String,Object>
name String

(string) Name of the Image, only present when the Image is of type system.

osFlavor String

(string) Flavor of operating system contained in the image, could be ubuntu, centos, debian, fedora or unknown.

osVersion String

(string) Operating system version.

rapidDeploy Boolean

(bool) Indicates that rapid deploy of the image is available.

type String

(string) Type of the Image, could be system, backup or snapshot.

mostRecent Boolean
selector String

Deprecated:

Please use the with_selector property instead.

withSelector String
withStatuses List<String>
created string

(string) Date when the Image was created (in ISO-8601 format).

deprecated string

(string) Point in time when the image is considered to be deprecated (in ISO-8601 format).

description string

(string) Description of the Image.

id number

(int) Unique ID of the Image.

labels {[key: string]: any}
name string

(string) Name of the Image, only present when the Image is of type system.

osFlavor string

(string) Flavor of operating system contained in the image, could be ubuntu, centos, debian, fedora or unknown.

osVersion string

(string) Operating system version.

rapidDeploy boolean

(bool) Indicates that rapid deploy of the image is available.

type string

(string) Type of the Image, could be system, backup or snapshot.

mostRecent boolean
selector string

Deprecated:

Please use the with_selector property instead.

withSelector string
withStatuses string[]
created str

(string) Date when the Image was created (in ISO-8601 format).

deprecated str

(string) Point in time when the image is considered to be deprecated (in ISO-8601 format).

description str

(string) Description of the Image.

id int

(int) Unique ID of the Image.

labels Mapping[str, Any]
name str

(string) Name of the Image, only present when the Image is of type system.

os_flavor str

(string) Flavor of operating system contained in the image, could be ubuntu, centos, debian, fedora or unknown.

os_version str

(string) Operating system version.

rapid_deploy bool

(bool) Indicates that rapid deploy of the image is available.

type str

(string) Type of the Image, could be system, backup or snapshot.

most_recent bool
selector str

Deprecated:

Please use the with_selector property instead.

with_selector str
with_statuses Sequence[str]
created String

(string) Date when the Image was created (in ISO-8601 format).

deprecated String

(string) Point in time when the image is considered to be deprecated (in ISO-8601 format).

description String

(string) Description of the Image.

id Number

(int) Unique ID of the Image.

labels Map<Any>
name String

(string) Name of the Image, only present when the Image is of type system.

osFlavor String

(string) Flavor of operating system contained in the image, could be ubuntu, centos, debian, fedora or unknown.

osVersion String

(string) Operating system version.

rapidDeploy Boolean

(bool) Indicates that rapid deploy of the image is available.

type String

(string) Type of the Image, could be system, backup or snapshot.

mostRecent Boolean
selector String

Deprecated:

Please use the with_selector property instead.

withSelector String
withStatuses List<String>

Package Details

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

This Pulumi package is based on the hcloud Terraform Provider.