1. Packages
  2. Packages
  3. Lxd Provider
  4. API Docs
  5. Image
Viewing docs for lxd 3.0.2
published on Monday, Jun 29, 2026 by terraform-lxd
Viewing docs for lxd 3.0.2
published on Monday, Jun 29, 2026 by terraform-lxd

    # lxd.Image

    Manages a locally-stored LXD image.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as lxd from "@pulumi/lxd";
    
    const xenial = new lxd.Image("xenial", {sourceImage: {
        image: "ubuntu:xenial/amd64",
    }});
    const test1 = new lxd.Instance("test1", {
        name: "test1",
        image: xenial.fingerprint,
        ephemeral: false,
    });
    
    import pulumi
    import pulumi_lxd as lxd
    
    xenial = lxd.Image("xenial", source_image={
        "image": "ubuntu:xenial/amd64",
    })
    test1 = lxd.Instance("test1",
        name="test1",
        image=xenial.fingerprint,
        ephemeral=False)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/lxd/v3/lxd"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		xenial, err := lxd.NewImage(ctx, "xenial", &lxd.ImageArgs{
    			SourceImage: &lxd.ImageSourceImageArgs{
    				Image: pulumi.String("ubuntu:xenial/amd64"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = lxd.NewInstance(ctx, "test1", &lxd.InstanceArgs{
    			Name:      pulumi.String("test1"),
    			Image:     xenial.Fingerprint,
    			Ephemeral: pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Lxd = Pulumi.Lxd;
    
    return await Deployment.RunAsync(() => 
    {
        var xenial = new Lxd.Image("xenial", new()
        {
            SourceImage = new Lxd.Inputs.ImageSourceImageArgs
            {
                Image = "ubuntu:xenial/amd64",
            },
        });
    
        var test1 = new Lxd.Instance("test1", new()
        {
            Name = "test1",
            Image = xenial.Fingerprint,
            Ephemeral = false,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.lxd.Image;
    import com.pulumi.lxd.ImageArgs;
    import com.pulumi.lxd.inputs.ImageSourceImageArgs;
    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) {
            var xenial = new Image("xenial", ImageArgs.builder()
                .sourceImage(ImageSourceImageArgs.builder()
                    .image("ubuntu:xenial/amd64")
                    .build())
                .build());
    
            var test1 = new Instance("test1", InstanceArgs.builder()
                .name("test1")
                .image(xenial.fingerprint())
                .ephemeral(false)
                .build());
    
        }
    }
    
    resources:
      xenial:
        type: lxd:Image
        properties:
          sourceImage:
            image: ubuntu:xenial/amd64
      test1:
        type: lxd:Instance
        properties:
          name: test1
          image: ${xenial.fingerprint}
          ephemeral: false
    
    Example coming soon!
    

    Notes

    • See the LXD documentation for more info on default image remotes.

    Create Image Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Image(name: string, args?: ImageArgs, opts?: CustomResourceOptions);
    @overload
    def Image(resource_name: str,
              args: Optional[ImageArgs] = None,
              opts: Optional[ResourceOptions] = None)
    
    @overload
    def Image(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              aliases: Optional[Sequence[str]] = None,
              project: Optional[str] = None,
              remote: Optional[str] = None,
              source_image: Optional[ImageSourceImageArgs] = None,
              source_instance: Optional[ImageSourceInstanceArgs] = None)
    func NewImage(ctx *Context, name string, args *ImageArgs, opts ...ResourceOption) (*Image, error)
    public Image(string name, ImageArgs? args = null, CustomResourceOptions? opts = null)
    public Image(String name, ImageArgs args)
    public Image(String name, ImageArgs args, CustomResourceOptions options)
    
    type: lxd:Image
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "lxd_image" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args ImageArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ImageArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ImageArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ImageArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ImageArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var imageResource = new Lxd.Image("imageResource", new()
    {
        Aliases = new[]
        {
            "string",
        },
        Project = "string",
        Remote = "string",
        SourceImage = new Lxd.Inputs.ImageSourceImageArgs
        {
            Image = "string",
            Architecture = "string",
            CopyAliases = false,
            Type = "string",
        },
        SourceInstance = new Lxd.Inputs.ImageSourceInstanceArgs
        {
            Name = "string",
            Snapshot = "string",
        },
    });
    
    example, err := lxd.NewImage(ctx, "imageResource", &lxd.ImageArgs{
    	Aliases: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Project: pulumi.String("string"),
    	Remote:  pulumi.String("string"),
    	SourceImage: &lxd.ImageSourceImageArgs{
    		Image:        pulumi.String("string"),
    		Architecture: pulumi.String("string"),
    		CopyAliases:  pulumi.Bool(false),
    		Type:         pulumi.String("string"),
    	},
    	SourceInstance: &lxd.ImageSourceInstanceArgs{
    		Name:     pulumi.String("string"),
    		Snapshot: pulumi.String("string"),
    	},
    })
    
    resource "lxd_image" "imageResource" {
      aliases = ["string"]
      project = "string"
      remote  = "string"
      source_image = {
        image        = "string"
        architecture = "string"
        copy_aliases = false
        type         = "string"
      }
      source_instance = {
        name     = "string"
        snapshot = "string"
      }
    }
    
    var imageResource = new Image("imageResource", ImageArgs.builder()
        .aliases("string")
        .project("string")
        .remote("string")
        .sourceImage(ImageSourceImageArgs.builder()
            .image("string")
            .architecture("string")
            .copyAliases(false)
            .type("string")
            .build())
        .sourceInstance(ImageSourceInstanceArgs.builder()
            .name("string")
            .snapshot("string")
            .build())
        .build());
    
    image_resource = lxd.Image("imageResource",
        aliases=["string"],
        project="string",
        remote="string",
        source_image={
            "image": "string",
            "architecture": "string",
            "copy_aliases": False,
            "type": "string",
        },
        source_instance={
            "name": "string",
            "snapshot": "string",
        })
    
    const imageResource = new lxd.Image("imageResource", {
        aliases: ["string"],
        project: "string",
        remote: "string",
        sourceImage: {
            image: "string",
            architecture: "string",
            copyAliases: false,
            type: "string",
        },
        sourceInstance: {
            name: "string",
            snapshot: "string",
        },
    });
    
    type: lxd:Image
    properties:
        aliases:
            - string
        project: string
        remote: string
        sourceImage:
            architecture: string
            copyAliases: false
            image: string
            type: string
        sourceInstance:
            name: string
            snapshot: string
    

    Image Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Image resource accepts the following input properties:

    Aliases List<string>
    Optional - A list of aliases to assign to the image after pulling.
    Project string
    Optional - Name of the project where the image will be stored.
    Remote string
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    SourceImage ImageSourceImage
    Optional - The source image from which the image will be copied. See reference below.
    SourceInstance ImageSourceInstance
    Optional - The source instance from which the image will be created. See reference below.
    Aliases []string
    Optional - A list of aliases to assign to the image after pulling.
    Project string
    Optional - Name of the project where the image will be stored.
    Remote string
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    SourceImage ImageSourceImageArgs
    Optional - The source image from which the image will be copied. See reference below.
    SourceInstance ImageSourceInstanceArgs
    Optional - The source instance from which the image will be created. See reference below.
    aliases list(string)
    Optional - A list of aliases to assign to the image after pulling.
    project string
    Optional - Name of the project where the image will be stored.
    remote string
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    source_image object
    Optional - The source image from which the image will be copied. See reference below.
    source_instance object
    Optional - The source instance from which the image will be created. See reference below.
    aliases List<String>
    Optional - A list of aliases to assign to the image after pulling.
    project String
    Optional - Name of the project where the image will be stored.
    remote String
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    sourceImage ImageSourceImage
    Optional - The source image from which the image will be copied. See reference below.
    sourceInstance ImageSourceInstance
    Optional - The source instance from which the image will be created. See reference below.
    aliases string[]
    Optional - A list of aliases to assign to the image after pulling.
    project string
    Optional - Name of the project where the image will be stored.
    remote string
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    sourceImage ImageSourceImage
    Optional - The source image from which the image will be copied. See reference below.
    sourceInstance ImageSourceInstance
    Optional - The source instance from which the image will be created. See reference below.
    aliases Sequence[str]
    Optional - A list of aliases to assign to the image after pulling.
    project str
    Optional - Name of the project where the image will be stored.
    remote str
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    source_image ImageSourceImageArgs
    Optional - The source image from which the image will be copied. See reference below.
    source_instance ImageSourceInstanceArgs
    Optional - The source instance from which the image will be created. See reference below.
    aliases List<String>
    Optional - A list of aliases to assign to the image after pulling.
    project String
    Optional - Name of the project where the image will be stored.
    remote String
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    sourceImage Property Map
    Optional - The source image from which the image will be copied. See reference below.
    sourceInstance Property Map
    Optional - The source instance from which the image will be created. See reference below.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Image resource produces the following output properties:

    CopiedAliases List<string>
    The list of aliases that were copied from the source_image.
    CreatedAt double
    The datetime of image creation, in Unix time.
    Fingerprint string
    The unique hash fingperint of the image.
    Id string
    The provider-assigned unique ID for this managed resource.
    ResourceId string
    CopiedAliases []string
    The list of aliases that were copied from the source_image.
    CreatedAt float64
    The datetime of image creation, in Unix time.
    Fingerprint string
    The unique hash fingperint of the image.
    Id string
    The provider-assigned unique ID for this managed resource.
    ResourceId string
    copied_aliases list(string)
    The list of aliases that were copied from the source_image.
    created_at number
    The datetime of image creation, in Unix time.
    fingerprint string
    The unique hash fingperint of the image.
    id string
    The provider-assigned unique ID for this managed resource.
    resource_id string
    copiedAliases List<String>
    The list of aliases that were copied from the source_image.
    createdAt Double
    The datetime of image creation, in Unix time.
    fingerprint String
    The unique hash fingperint of the image.
    id String
    The provider-assigned unique ID for this managed resource.
    resourceId String
    copiedAliases string[]
    The list of aliases that were copied from the source_image.
    createdAt number
    The datetime of image creation, in Unix time.
    fingerprint string
    The unique hash fingperint of the image.
    id string
    The provider-assigned unique ID for this managed resource.
    resourceId string
    copied_aliases Sequence[str]
    The list of aliases that were copied from the source_image.
    created_at float
    The datetime of image creation, in Unix time.
    fingerprint str
    The unique hash fingperint of the image.
    id str
    The provider-assigned unique ID for this managed resource.
    resource_id str
    copiedAliases List<String>
    The list of aliases that were copied from the source_image.
    createdAt Number
    The datetime of image creation, in Unix time.
    fingerprint String
    The unique hash fingperint of the image.
    id String
    The provider-assigned unique ID for this managed resource.
    resourceId String

    Look up Existing Image Resource

    Get an existing Image resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ImageState, opts?: CustomResourceOptions): Image
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            aliases: Optional[Sequence[str]] = None,
            copied_aliases: Optional[Sequence[str]] = None,
            created_at: Optional[float] = None,
            fingerprint: Optional[str] = None,
            project: Optional[str] = None,
            remote: Optional[str] = None,
            resource_id: Optional[str] = None,
            source_image: Optional[ImageSourceImageArgs] = None,
            source_instance: Optional[ImageSourceInstanceArgs] = None) -> Image
    func GetImage(ctx *Context, name string, id IDInput, state *ImageState, opts ...ResourceOption) (*Image, error)
    public static Image Get(string name, Input<string> id, ImageState? state, CustomResourceOptions? opts = null)
    public static Image get(String name, Output<String> id, ImageState state, CustomResourceOptions options)
    resources:  _:    type: lxd:Image    get:      id: ${id}
    import {
      to = lxd_image.example
      id = "${id}"
    }
    
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Aliases List<string>
    Optional - A list of aliases to assign to the image after pulling.
    CopiedAliases List<string>
    The list of aliases that were copied from the source_image.
    CreatedAt double
    The datetime of image creation, in Unix time.
    Fingerprint string
    The unique hash fingperint of the image.
    Project string
    Optional - Name of the project where the image will be stored.
    Remote string
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    ResourceId string
    SourceImage ImageSourceImage
    Optional - The source image from which the image will be copied. See reference below.
    SourceInstance ImageSourceInstance
    Optional - The source instance from which the image will be created. See reference below.
    Aliases []string
    Optional - A list of aliases to assign to the image after pulling.
    CopiedAliases []string
    The list of aliases that were copied from the source_image.
    CreatedAt float64
    The datetime of image creation, in Unix time.
    Fingerprint string
    The unique hash fingperint of the image.
    Project string
    Optional - Name of the project where the image will be stored.
    Remote string
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    ResourceId string
    SourceImage ImageSourceImageArgs
    Optional - The source image from which the image will be copied. See reference below.
    SourceInstance ImageSourceInstanceArgs
    Optional - The source instance from which the image will be created. See reference below.
    aliases list(string)
    Optional - A list of aliases to assign to the image after pulling.
    copied_aliases list(string)
    The list of aliases that were copied from the source_image.
    created_at number
    The datetime of image creation, in Unix time.
    fingerprint string
    The unique hash fingperint of the image.
    project string
    Optional - Name of the project where the image will be stored.
    remote string
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    resource_id string
    source_image object
    Optional - The source image from which the image will be copied. See reference below.
    source_instance object
    Optional - The source instance from which the image will be created. See reference below.
    aliases List<String>
    Optional - A list of aliases to assign to the image after pulling.
    copiedAliases List<String>
    The list of aliases that were copied from the source_image.
    createdAt Double
    The datetime of image creation, in Unix time.
    fingerprint String
    The unique hash fingperint of the image.
    project String
    Optional - Name of the project where the image will be stored.
    remote String
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    resourceId String
    sourceImage ImageSourceImage
    Optional - The source image from which the image will be copied. See reference below.
    sourceInstance ImageSourceInstance
    Optional - The source instance from which the image will be created. See reference below.
    aliases string[]
    Optional - A list of aliases to assign to the image after pulling.
    copiedAliases string[]
    The list of aliases that were copied from the source_image.
    createdAt number
    The datetime of image creation, in Unix time.
    fingerprint string
    The unique hash fingperint of the image.
    project string
    Optional - Name of the project where the image will be stored.
    remote string
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    resourceId string
    sourceImage ImageSourceImage
    Optional - The source image from which the image will be copied. See reference below.
    sourceInstance ImageSourceInstance
    Optional - The source instance from which the image will be created. See reference below.
    aliases Sequence[str]
    Optional - A list of aliases to assign to the image after pulling.
    copied_aliases Sequence[str]
    The list of aliases that were copied from the source_image.
    created_at float
    The datetime of image creation, in Unix time.
    fingerprint str
    The unique hash fingperint of the image.
    project str
    Optional - Name of the project where the image will be stored.
    remote str
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    resource_id str
    source_image ImageSourceImageArgs
    Optional - The source image from which the image will be copied. See reference below.
    source_instance ImageSourceInstanceArgs
    Optional - The source instance from which the image will be created. See reference below.
    aliases List<String>
    Optional - A list of aliases to assign to the image after pulling.
    copiedAliases List<String>
    The list of aliases that were copied from the source_image.
    createdAt Number
    The datetime of image creation, in Unix time.
    fingerprint String
    The unique hash fingperint of the image.
    project String
    Optional - Name of the project where the image will be stored.
    remote String
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    resourceId String
    sourceImage Property Map
    Optional - The source image from which the image will be copied. See reference below.
    sourceInstance Property Map
    Optional - The source instance from which the image will be created. See reference below.

    Supporting Types

    ImageSourceImage, ImageSourceImageArgs

    Image string
    Required - Name of the source image in the format [<remote>:]<image>. If the remote is omitted, the provider's default remote is used.
    Architecture string
    Optional - Architecture of the image to pull (e.g. amd64, arm64). If not provided, the default architecture of source_image is used.
    CopyAliases bool
    Optional - Whether to copy the aliases of the image from the remote. Valid values are true and false. Defaults to false.
    Type string
    Optional - Type of image to cache. Must be one of container or virtual-machine. Defaults to container.
    Image string
    Required - Name of the source image in the format [<remote>:]<image>. If the remote is omitted, the provider's default remote is used.
    Architecture string
    Optional - Architecture of the image to pull (e.g. amd64, arm64). If not provided, the default architecture of source_image is used.
    CopyAliases bool
    Optional - Whether to copy the aliases of the image from the remote. Valid values are true and false. Defaults to false.
    Type string
    Optional - Type of image to cache. Must be one of container or virtual-machine. Defaults to container.
    image string
    Required - Name of the source image in the format [<remote>:]<image>. If the remote is omitted, the provider's default remote is used.
    architecture string
    Optional - Architecture of the image to pull (e.g. amd64, arm64). If not provided, the default architecture of source_image is used.
    copy_aliases bool
    Optional - Whether to copy the aliases of the image from the remote. Valid values are true and false. Defaults to false.
    type string
    Optional - Type of image to cache. Must be one of container or virtual-machine. Defaults to container.
    image String
    Required - Name of the source image in the format [<remote>:]<image>. If the remote is omitted, the provider's default remote is used.
    architecture String
    Optional - Architecture of the image to pull (e.g. amd64, arm64). If not provided, the default architecture of source_image is used.
    copyAliases Boolean
    Optional - Whether to copy the aliases of the image from the remote. Valid values are true and false. Defaults to false.
    type String
    Optional - Type of image to cache. Must be one of container or virtual-machine. Defaults to container.
    image string
    Required - Name of the source image in the format [<remote>:]<image>. If the remote is omitted, the provider's default remote is used.
    architecture string
    Optional - Architecture of the image to pull (e.g. amd64, arm64). If not provided, the default architecture of source_image is used.
    copyAliases boolean
    Optional - Whether to copy the aliases of the image from the remote. Valid values are true and false. Defaults to false.
    type string
    Optional - Type of image to cache. Must be one of container or virtual-machine. Defaults to container.
    image str
    Required - Name of the source image in the format [<remote>:]<image>. If the remote is omitted, the provider's default remote is used.
    architecture str
    Optional - Architecture of the image to pull (e.g. amd64, arm64). If not provided, the default architecture of source_image is used.
    copy_aliases bool
    Optional - Whether to copy the aliases of the image from the remote. Valid values are true and false. Defaults to false.
    type str
    Optional - Type of image to cache. Must be one of container or virtual-machine. Defaults to container.
    image String
    Required - Name of the source image in the format [<remote>:]<image>. If the remote is omitted, the provider's default remote is used.
    architecture String
    Optional - Architecture of the image to pull (e.g. amd64, arm64). If not provided, the default architecture of source_image is used.
    copyAliases Boolean
    Optional - Whether to copy the aliases of the image from the remote. Valid values are true and false. Defaults to false.
    type String
    Optional - Type of image to cache. Must be one of container or virtual-machine. Defaults to container.

    ImageSourceInstance, ImageSourceInstanceArgs

    Name string
    Required - Name of the source instance.
    Snapshot string
    Optional - Name of the snapshot of the source instance.
    Name string
    Required - Name of the source instance.
    Snapshot string
    Optional - Name of the snapshot of the source instance.
    name string
    Required - Name of the source instance.
    snapshot string
    Optional - Name of the snapshot of the source instance.
    name String
    Required - Name of the source instance.
    snapshot String
    Optional - Name of the snapshot of the source instance.
    name string
    Required - Name of the source instance.
    snapshot string
    Optional - Name of the snapshot of the source instance.
    name str
    Required - Name of the source instance.
    snapshot str
    Optional - Name of the snapshot of the source instance.
    name String
    Required - Name of the source instance.
    snapshot String
    Optional - Name of the snapshot of the source instance.

    Package Details

    Repository
    lxd terraform-lxd/terraform-provider-lxd
    License
    Notes
    This Pulumi package is based on the lxd Terraform Provider.
    Viewing docs for lxd 3.0.2
    published on Monday, Jun 29, 2026 by terraform-lxd

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial