published on Monday, Jun 29, 2026 by terraform-lxd
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)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.
- Source
Image ImageSource Image - Optional - The source image from which the image will be copied. See reference below.
- Source
Instance ImageSource Instance - 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.
- Source
Image ImageSource Image Args - Optional - The source image from which the image will be copied. See reference below.
- Source
Instance ImageSource Instance Args - 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.
- source
Image ImageSource Image - Optional - The source image from which the image will be copied. See reference below.
- source
Instance ImageSource Instance - 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.
- source
Image ImageSource Image - Optional - The source image from which the image will be copied. See reference below.
- source
Instance ImageSource Instance - 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 ImageSource Image Args - Optional - The source image from which the image will be copied. See reference below.
- source_
instance ImageSource Instance Args - 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 Property Map - Optional - The source image from which the image will be copied. See reference below.
- source
Instance 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:
- Copied
Aliases List<string> - The list of aliases that were copied from the
source_image. - Created
At 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.
- Resource
Id string
- Copied
Aliases []string - The list of aliases that were copied from the
source_image. - Created
At 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.
- Resource
Id 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
- copied
Aliases List<String> - The list of aliases that were copied from the
source_image. - created
At 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.
- resource
Id String
- copied
Aliases 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
- 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
- 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
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) -> Imagefunc 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.
- 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 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.
- Resource
Id string - Source
Image ImageSource Image - Optional - The source image from which the image will be copied. See reference below.
- Source
Instance ImageSource Instance - 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.
- Copied
Aliases []string - The list of aliases that were copied from the
source_image. - Created
At 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.
- Resource
Id string - Source
Image ImageSource Image Args - Optional - The source image from which the image will be copied. See reference below.
- Source
Instance ImageSource Instance Args - 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.
- copied
Aliases List<String> - The list of aliases that were copied from the
source_image. - created
At 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.
- resource
Id String - source
Image ImageSource Image - Optional - The source image from which the image will be copied. See reference below.
- source
Instance ImageSource Instance - 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.
- copied
Aliases 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 ImageSource Image - Optional - The source image from which the image will be copied. See reference below.
- source
Instance ImageSource Instance - 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 ImageSource Image Args - Optional - The source image from which the image will be copied. See reference below.
- source_
instance ImageSource Instance Args - 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 Property Map - Optional - The source image from which the image will be copied. See reference below.
- source
Instance 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 ofsource_imageis used. - Copy
Aliases bool - Optional - Whether to copy the aliases of the image from
the remote. Valid values are
trueandfalse. Defaults tofalse. - Type string
- Optional - Type of image to cache. Must be one of
containerorvirtual-machine. Defaults tocontainer.
- 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 ofsource_imageis used. - Copy
Aliases bool - Optional - Whether to copy the aliases of the image from
the remote. Valid values are
trueandfalse. Defaults tofalse. - Type string
- Optional - Type of image to cache. Must be one of
containerorvirtual-machine. Defaults tocontainer.
- 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 ofsource_imageis used. - copy_
aliases bool - Optional - Whether to copy the aliases of the image from
the remote. Valid values are
trueandfalse. Defaults tofalse. - type string
- Optional - Type of image to cache. Must be one of
containerorvirtual-machine. Defaults tocontainer.
- 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 ofsource_imageis used. - copy
Aliases Boolean - Optional - Whether to copy the aliases of the image from
the remote. Valid values are
trueandfalse. Defaults tofalse. - type String
- Optional - Type of image to cache. Must be one of
containerorvirtual-machine. Defaults tocontainer.
- 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 ofsource_imageis used. - copy
Aliases boolean - Optional - Whether to copy the aliases of the image from
the remote. Valid values are
trueandfalse. Defaults tofalse. - type string
- Optional - Type of image to cache. Must be one of
containerorvirtual-machine. Defaults tocontainer.
- 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 ofsource_imageis used. - copy_
aliases bool - Optional - Whether to copy the aliases of the image from
the remote. Valid values are
trueandfalse. Defaults tofalse. - type str
- Optional - Type of image to cache. Must be one of
containerorvirtual-machine. Defaults tocontainer.
- 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 ofsource_imageis used. - copy
Aliases Boolean - Optional - Whether to copy the aliases of the image from
the remote. Valid values are
trueandfalse. Defaults tofalse. - type String
- Optional - Type of image to cache. Must be one of
containerorvirtual-machine. Defaults tocontainer.
ImageSourceInstance, ImageSourceInstanceArgs
Package Details
- Repository
- lxd terraform-lxd/terraform-provider-lxd
- License
- Notes
- This Pulumi package is based on the
lxdTerraform Provider.
published on Monday, Jun 29, 2026 by terraform-lxd