1. Packages
  2. Lxd Provider
  3. API Docs
  4. getImage
lxd 2.5.0 published on Thursday, Mar 13, 2025 by terraform-lxd

lxd.getImage

Explore with Pulumi AI

lxd 2.5.0 published on Thursday, Mar 13, 2025 by terraform-lxd

# lxd.getImage

Provides information about an existing LXD image.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as lxd from "@pulumi/lxd";

const debianCustom = lxd.getImage({
    name: "debian_custom",
});
const inst = new lxd.Instance("inst", {image: debianCustom.then(debianCustom => debianCustom.fingerprint)});
Copy
import pulumi
import pulumi_lxd as lxd

debian_custom = lxd.get_image(name="debian_custom")
inst = lxd.Instance("inst", image=debian_custom.fingerprint)
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/lxd/v2/lxd"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		debianCustom, err := lxd.GetImage(ctx, &lxd.GetImageArgs{
			Name: pulumi.StringRef("debian_custom"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = lxd.NewInstance(ctx, "inst", &lxd.InstanceArgs{
			Image: pulumi.String(debianCustom.Fingerprint),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Lxd = Pulumi.Lxd;

return await Deployment.RunAsync(() => 
{
    var debianCustom = Lxd.GetImage.Invoke(new()
    {
        Name = "debian_custom",
    });

    var inst = new Lxd.Instance("inst", new()
    {
        Image = debianCustom.Apply(getImageResult => getImageResult.Fingerprint),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.lxd.LxdFunctions;
import com.pulumi.lxd.inputs.GetImageArgs;
import com.pulumi.lxd.Instance;
import com.pulumi.lxd.InstanceArgs;
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 debianCustom = LxdFunctions.getImage(GetImageArgs.builder()
            .name("debian_custom")
            .build());

        var inst = new Instance("inst", InstanceArgs.builder()
            .image(debianCustom.applyValue(getImageResult -> getImageResult.fingerprint()))
            .build());

    }
}
Copy
resources:
  inst:
    type: lxd:Instance
    properties:
      image: ${debianCustom.fingerprint}
variables:
  debianCustom:
    fn::invoke:
      function: lxd:getImage
      arguments:
        name: debian_custom
Copy

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>
Copy
def get_image(architecture: Optional[str] = None,
              fingerprint: Optional[str] = None,
              name: Optional[str] = None,
              project: Optional[str] = None,
              remote: Optional[str] = None,
              type: Optional[str] = None,
              opts: Optional[InvokeOptions] = None) -> GetImageResult
def get_image_output(architecture: Optional[pulumi.Input[str]] = None,
              fingerprint: Optional[pulumi.Input[str]] = None,
              name: Optional[pulumi.Input[str]] = None,
              project: Optional[pulumi.Input[str]] = None,
              remote: Optional[pulumi.Input[str]] = None,
              type: Optional[pulumi.Input[str]] = None,
              opts: Optional[InvokeOptions] = None) -> Output[GetImageResult]
Copy
func GetImage(ctx *Context, args *GetImageArgs, opts ...InvokeOption) (*GetImageResult, error)
func GetImageOutput(ctx *Context, args *GetImageOutputArgs, opts ...InvokeOption) GetImageResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetImageResult> getImage(GetImageArgs args, InvokeOptions options)
public static Output<GetImageResult> getImage(GetImageArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: lxd:index/getImage:getImage
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Architecture string
Optional - The image architecture (e.g. x86_64, aarch64). See Architectures for all possible values.
Fingerprint string
Optional - Fingerprint of the image.
Name string
Optional - Name of the image.
Project string
Optional - Name of the project where the image is stored.
Remote string
Optional - The remote in which the resource was created. If not provided, the provider's default remote is used.
Type string
Optional - Type of image. Must be one of container or virtual-machine.
Architecture string
Optional - The image architecture (e.g. x86_64, aarch64). See Architectures for all possible values.
Fingerprint string
Optional - Fingerprint of the image.
Name string
Optional - Name of the image.
Project string
Optional - Name of the project where the image is stored.
Remote string
Optional - The remote in which the resource was created. If not provided, the provider's default remote is used.
Type string
Optional - Type of image. Must be one of container or virtual-machine.
architecture String
Optional - The image architecture (e.g. x86_64, aarch64). See Architectures for all possible values.
fingerprint String
Optional - Fingerprint of the image.
name String
Optional - Name of the image.
project String
Optional - Name of the project where the image is stored.
remote String
Optional - The remote in which the resource was created. If not provided, the provider's default remote is used.
type String
Optional - Type of image. Must be one of container or virtual-machine.
architecture string
Optional - The image architecture (e.g. x86_64, aarch64). See Architectures for all possible values.
fingerprint string
Optional - Fingerprint of the image.
name string
Optional - Name of the image.
project string
Optional - Name of the project where the image is stored.
remote string
Optional - The remote in which the resource was created. If not provided, the provider's default remote is used.
type string
Optional - Type of image. Must be one of container or virtual-machine.
architecture str
Optional - The image architecture (e.g. x86_64, aarch64). See Architectures for all possible values.
fingerprint str
Optional - Fingerprint of the image.
name str
Optional - Name of the image.
project str
Optional - Name of the project where the image is stored.
remote str
Optional - The remote in which the resource was created. If not provided, the provider's default remote is used.
type str
Optional - Type of image. Must be one of container or virtual-machine.
architecture String
Optional - The image architecture (e.g. x86_64, aarch64). See Architectures for all possible values.
fingerprint String
Optional - Fingerprint of the image.
name String
Optional - Name of the image.
project String
Optional - Name of the project where the image is stored.
remote String
Optional - The remote in which the resource was created. If not provided, the provider's default remote is used.
type String
Optional - Type of image. Must be one of container or virtual-machine.

getImage Result

The following output properties are available:

Aliases List<string>
The list of aliases for the image.
Architecture string
CreatedAt double
The datetime of image creation, in Unix time.
Fingerprint string
Id string
The provider-assigned unique ID for this managed resource.
Type string
Name string
Project string
Remote string
Aliases []string
The list of aliases for the image.
Architecture string
CreatedAt float64
The datetime of image creation, in Unix time.
Fingerprint string
Id string
The provider-assigned unique ID for this managed resource.
Type string
Name string
Project string
Remote string
aliases List<String>
The list of aliases for the image.
architecture String
createdAt Double
The datetime of image creation, in Unix time.
fingerprint String
id String
The provider-assigned unique ID for this managed resource.
type String
name String
project String
remote String
aliases string[]
The list of aliases for the image.
architecture string
createdAt number
The datetime of image creation, in Unix time.
fingerprint string
id string
The provider-assigned unique ID for this managed resource.
type string
name string
project string
remote string
aliases Sequence[str]
The list of aliases for the image.
architecture str
created_at float
The datetime of image creation, in Unix time.
fingerprint str
id str
The provider-assigned unique ID for this managed resource.
type str
name str
project str
remote str
aliases List<String>
The list of aliases for the image.
architecture String
createdAt Number
The datetime of image creation, in Unix time.
fingerprint String
id String
The provider-assigned unique ID for this managed resource.
type String
name String
project String
remote String

Package Details

Repository
lxd terraform-lxd/terraform-provider-lxd
License
Notes
This Pulumi package is based on the lxd Terraform Provider.
lxd 2.5.0 published on Thursday, Mar 13, 2025 by terraform-lxd