lxd.CachedImage
Explore with Pulumi AI
# lxd.CachedImage
Manages a locally-stored LXD image.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as lxd from "@pulumi/lxd";
const xenial = new lxd.CachedImage("xenial", {
    sourceRemote: "ubuntu",
    sourceImage: "xenial/amd64",
});
const test1 = new lxd.Instance("test1", {
    image: xenial.fingerprint,
    ephemeral: false,
});
import pulumi
import pulumi_lxd as lxd
xenial = lxd.CachedImage("xenial",
    source_remote="ubuntu",
    source_image="xenial/amd64")
test1 = lxd.Instance("test1",
    image=xenial.fingerprint,
    ephemeral=False)
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 {
		xenial, err := lxd.NewCachedImage(ctx, "xenial", &lxd.CachedImageArgs{
			SourceRemote: pulumi.String("ubuntu"),
			SourceImage:  pulumi.String("xenial/amd64"),
		})
		if err != nil {
			return err
		}
		_, err = lxd.NewInstance(ctx, "test1", &lxd.InstanceArgs{
			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.CachedImage("xenial", new()
    {
        SourceRemote = "ubuntu",
        SourceImage = "xenial/amd64",
    });
    var test1 = new Lxd.Instance("test1", new()
    {
        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.CachedImage;
import com.pulumi.lxd.CachedImageArgs;
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 CachedImage("xenial", CachedImageArgs.builder()
            .sourceRemote("ubuntu")
            .sourceImage("xenial/amd64")
            .build());
        var test1 = new Instance("test1", InstanceArgs.builder()
            .image(xenial.fingerprint())
            .ephemeral(false)
            .build());
    }
}
resources:
  xenial:
    type: lxd:CachedImage
    properties:
      sourceRemote: ubuntu
      sourceImage: xenial/amd64
  test1:
    type: lxd:Instance
    properties:
      image: ${xenial.fingerprint}
      ephemeral: false
Notes
- See the LXD documentation for more info on default image remotes.
Create CachedImage Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new CachedImage(name: string, args: CachedImageArgs, opts?: CustomResourceOptions);@overload
def CachedImage(resource_name: str,
                args: CachedImageArgs,
                opts: Optional[ResourceOptions] = None)
@overload
def CachedImage(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                source_image: Optional[str] = None,
                source_remote: Optional[str] = None,
                aliases: Optional[Sequence[str]] = None,
                copy_aliases: Optional[bool] = None,
                project: Optional[str] = None,
                remote: Optional[str] = None,
                type: Optional[str] = None)func NewCachedImage(ctx *Context, name string, args CachedImageArgs, opts ...ResourceOption) (*CachedImage, error)public CachedImage(string name, CachedImageArgs args, CustomResourceOptions? opts = null)
public CachedImage(String name, CachedImageArgs args)
public CachedImage(String name, CachedImageArgs args, CustomResourceOptions options)
type: lxd:CachedImage
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args CachedImageArgs
- 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 CachedImageArgs
- 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 CachedImageArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args CachedImageArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args CachedImageArgs
- 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 cachedImageResource = new Lxd.CachedImage("cachedImageResource", new()
{
    SourceImage = "string",
    SourceRemote = "string",
    Aliases = new[]
    {
        "string",
    },
    CopyAliases = false,
    Project = "string",
    Remote = "string",
    Type = "string",
});
example, err := lxd.NewCachedImage(ctx, "cachedImageResource", &lxd.CachedImageArgs{
SourceImage: pulumi.String("string"),
SourceRemote: pulumi.String("string"),
Aliases: pulumi.StringArray{
pulumi.String("string"),
},
CopyAliases: pulumi.Bool(false),
Project: pulumi.String("string"),
Remote: pulumi.String("string"),
Type: pulumi.String("string"),
})
var cachedImageResource = new CachedImage("cachedImageResource", CachedImageArgs.builder()
    .sourceImage("string")
    .sourceRemote("string")
    .aliases("string")
    .copyAliases(false)
    .project("string")
    .remote("string")
    .type("string")
    .build());
cached_image_resource = lxd.CachedImage("cachedImageResource",
    source_image="string",
    source_remote="string",
    aliases=["string"],
    copy_aliases=False,
    project="string",
    remote="string",
    type="string")
const cachedImageResource = new lxd.CachedImage("cachedImageResource", {
    sourceImage: "string",
    sourceRemote: "string",
    aliases: ["string"],
    copyAliases: false,
    project: "string",
    remote: "string",
    type: "string",
});
type: lxd:CachedImage
properties:
    aliases:
        - string
    copyAliases: false
    project: string
    remote: string
    sourceImage: string
    sourceRemote: string
    type: string
CachedImage 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 CachedImage resource accepts the following input properties:
- SourceImage string
- Required - Fingerprint or alias of image to pull.
- SourceRemote string
- Required - Name of the LXD remote from where image will be pulled.
- Aliases List<string>
- Optional - A list of aliases to assign to the image after pulling.
- CopyAliases bool
- Optional - Whether to copy the aliases of the image from
the remote. Valid values are trueandfalse. Defaults tofalse.
- 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.
- Type string
- Optional - Type of image to cache. Must be one of containerorvirtual-machine. Defaults tocontainer.
- SourceImage string
- Required - Fingerprint or alias of image to pull.
- SourceRemote string
- Required - Name of the LXD remote from where image will be pulled.
- Aliases []string
- Optional - A list of aliases to assign to the image after pulling.
- CopyAliases bool
- Optional - Whether to copy the aliases of the image from
the remote. Valid values are trueandfalse. Defaults tofalse.
- 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.
- Type string
- Optional - Type of image to cache. Must be one of containerorvirtual-machine. Defaults tocontainer.
- sourceImage String
- Required - Fingerprint or alias of image to pull.
- sourceRemote String
- Required - Name of the LXD remote from where image will be pulled.
- aliases List<String>
- Optional - A list of aliases to assign to the image after pulling.
- copyAliases Boolean
- Optional - Whether to copy the aliases of the image from
the remote. Valid values are trueandfalse. Defaults tofalse.
- 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.
- type String
- Optional - Type of image to cache. Must be one of containerorvirtual-machine. Defaults tocontainer.
- sourceImage string
- Required - Fingerprint or alias of image to pull.
- sourceRemote string
- Required - Name of the LXD remote from where image will be pulled.
- aliases string[]
- Optional - A list of aliases to assign to the image after pulling.
- copyAliases boolean
- Optional - Whether to copy the aliases of the image from
the remote. Valid values are trueandfalse. Defaults tofalse.
- 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.
- type string
- Optional - Type of image to cache. Must be one of containerorvirtual-machine. Defaults tocontainer.
- source_image str
- Required - Fingerprint or alias of image to pull.
- source_remote str
- Required - Name of the LXD remote from where image will be pulled.
- aliases Sequence[str]
- Optional - A list of aliases to assign to the image after pulling.
- copy_aliases bool
- Optional - Whether to copy the aliases of the image from
the remote. Valid values are trueandfalse. Defaults tofalse.
- 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.
- type str
- Optional - Type of image to cache. Must be one of containerorvirtual-machine. Defaults tocontainer.
- sourceImage String
- Required - Fingerprint or alias of image to pull.
- sourceRemote String
- Required - Name of the LXD remote from where image will be pulled.
- aliases List<String>
- Optional - A list of aliases to assign to the image after pulling.
- copyAliases Boolean
- Optional - Whether to copy the aliases of the image from
the remote. Valid values are trueandfalse. Defaults tofalse.
- 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.
- type String
- Optional - Type of image to cache. Must be one of containerorvirtual-machine. Defaults tocontainer.
Outputs
All input properties are implicitly available as output properties. Additionally, the CachedImage resource produces the following output properties:
- Architecture string
- The image architecture (e.g. amd64, i386).
- 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.
- Architecture string
- The image architecture (e.g. amd64, i386).
- 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.
- architecture String
- The image architecture (e.g. amd64, i386).
- 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.
- architecture string
- The image architecture (e.g. amd64, i386).
- 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.
- architecture str
- The image architecture (e.g. amd64, i386).
- 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.
- architecture String
- The image architecture (e.g. amd64, i386).
- 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.
Look up Existing CachedImage Resource
Get an existing CachedImage 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?: CachedImageState, opts?: CustomResourceOptions): CachedImage@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        aliases: Optional[Sequence[str]] = None,
        architecture: Optional[str] = None,
        copied_aliases: Optional[Sequence[str]] = None,
        copy_aliases: Optional[bool] = None,
        created_at: Optional[float] = None,
        fingerprint: Optional[str] = None,
        project: Optional[str] = None,
        remote: Optional[str] = None,
        source_image: Optional[str] = None,
        source_remote: Optional[str] = None,
        type: Optional[str] = None) -> CachedImagefunc GetCachedImage(ctx *Context, name string, id IDInput, state *CachedImageState, opts ...ResourceOption) (*CachedImage, error)public static CachedImage Get(string name, Input<string> id, CachedImageState? state, CustomResourceOptions? opts = null)public static CachedImage get(String name, Output<String> id, CachedImageState state, CustomResourceOptions options)resources:  _:    type: lxd:CachedImage    get:      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.
- Architecture string
- The image architecture (e.g. amd64, i386).
- CopiedAliases List<string>
- The list of aliases that were copied from the
source_image.
- CopyAliases bool
- Optional - Whether to copy the aliases of the image from
the remote. Valid values are trueandfalse. Defaults tofalse.
- 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.
- SourceImage string
- Required - Fingerprint or alias of image to pull.
- SourceRemote string
- Required - Name of the LXD remote from where image will be pulled.
- Type string
- Optional - Type of image to cache. Must be one of containerorvirtual-machine. Defaults tocontainer.
- Aliases []string
- Optional - A list of aliases to assign to the image after pulling.
- Architecture string
- The image architecture (e.g. amd64, i386).
- CopiedAliases []string
- The list of aliases that were copied from the
source_image.
- CopyAliases bool
- Optional - Whether to copy the aliases of the image from
the remote. Valid values are trueandfalse. Defaults tofalse.
- 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.
- SourceImage string
- Required - Fingerprint or alias of image to pull.
- SourceRemote string
- Required - Name of the LXD remote from where image will be pulled.
- Type string
- Optional - Type of image to cache. Must be one of containerorvirtual-machine. Defaults tocontainer.
- aliases List<String>
- Optional - A list of aliases to assign to the image after pulling.
- architecture String
- The image architecture (e.g. amd64, i386).
- copiedAliases List<String>
- The list of aliases that were copied from the
source_image.
- copyAliases Boolean
- Optional - Whether to copy the aliases of the image from
the remote. Valid values are trueandfalse. Defaults tofalse.
- 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.
- sourceImage String
- Required - Fingerprint or alias of image to pull.
- sourceRemote String
- Required - Name of the LXD remote from where image will be pulled.
- type String
- Optional - Type of image to cache. Must be one of containerorvirtual-machine. Defaults tocontainer.
- aliases string[]
- Optional - A list of aliases to assign to the image after pulling.
- architecture string
- The image architecture (e.g. amd64, i386).
- copiedAliases string[]
- The list of aliases that were copied from the
source_image.
- copyAliases boolean
- Optional - Whether to copy the aliases of the image from
the remote. Valid values are trueandfalse. Defaults tofalse.
- 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.
- sourceImage string
- Required - Fingerprint or alias of image to pull.
- sourceRemote string
- Required - Name of the LXD remote from where image will be pulled.
- type string
- Optional - Type of image to cache. Must be one of containerorvirtual-machine. Defaults tocontainer.
- aliases Sequence[str]
- Optional - A list of aliases to assign to the image after pulling.
- architecture str
- The image architecture (e.g. amd64, i386).
- copied_aliases Sequence[str]
- The list of aliases that were copied from the
source_image.
- copy_aliases bool
- Optional - Whether to copy the aliases of the image from
the remote. Valid values are trueandfalse. Defaults tofalse.
- 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.
- source_image str
- Required - Fingerprint or alias of image to pull.
- source_remote str
- Required - Name of the LXD remote from where image will be pulled.
- type str
- Optional - Type of image to cache. Must be one of containerorvirtual-machine. Defaults tocontainer.
- aliases List<String>
- Optional - A list of aliases to assign to the image after pulling.
- architecture String
- The image architecture (e.g. amd64, i386).
- copiedAliases List<String>
- The list of aliases that were copied from the
source_image.
- copyAliases Boolean
- Optional - Whether to copy the aliases of the image from
the remote. Valid values are trueandfalse. Defaults tofalse.
- 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.
- sourceImage String
- Required - Fingerprint or alias of image to pull.
- sourceRemote String
- Required - Name of the LXD remote from where image will be pulled.
- type String
- Optional - Type of image to cache. Must be one of containerorvirtual-machine. Defaults tocontainer.
Package Details
- Repository
- lxd terraform-lxd/terraform-provider-lxd
- License
- Notes
- This Pulumi package is based on the lxdTerraform Provider.