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

lxd.getProfile

Explore with Pulumi AI

# lxd.Profile

Provides information about an existing LXD profile.

Example Usage

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

const _default = lxd.getProfile({
    name: "default",
});
const inst = new lxd.Instance("inst", {
    image: "ubuntu:24.04",
    profiles: [_default.then(_default => _default.name)],
});
Copy
import pulumi
import pulumi_lxd as lxd

default = lxd.get_profile(name="default")
inst = lxd.Instance("inst",
    image="ubuntu:24.04",
    profiles=[default.name])
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 {
		_default, err := lxd.LookupProfile(ctx, &lxd.LookupProfileArgs{
			Name: "default",
		}, nil)
		if err != nil {
			return err
		}
		_, err = lxd.NewInstance(ctx, "inst", &lxd.InstanceArgs{
			Image: pulumi.String("ubuntu:24.04"),
			Profiles: pulumi.StringArray{
				pulumi.String(_default.Name),
			},
		})
		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 @default = Lxd.GetProfile.Invoke(new()
    {
        Name = "default",
    });

    var inst = new Lxd.Instance("inst", new()
    {
        Image = "ubuntu:24.04",
        Profiles = new[]
        {
            @default.Apply(@default => @default.Apply(getProfileResult => getProfileResult.Name)),
        },
    });

});
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.GetProfileArgs;
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 default = LxdFunctions.getProfile(GetProfileArgs.builder()
            .name("default")
            .build());

        var inst = new Instance("inst", InstanceArgs.builder()
            .image("ubuntu:24.04")
            .profiles(default_.name())
            .build());

    }
}
Copy
resources:
  inst:
    type: lxd:Instance
    properties:
      image: ubuntu:24.04
      profiles:
        - ${default.name}
variables:
  default:
    fn::invoke:
      function: lxd:getProfile
      arguments:
        name: default
Copy

Using getProfile

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 getProfile(args: GetProfileArgs, opts?: InvokeOptions): Promise<GetProfileResult>
function getProfileOutput(args: GetProfileOutputArgs, opts?: InvokeOptions): Output<GetProfileResult>
Copy
def get_profile(devices: Optional[Sequence[GetProfileDevice]] = None,
                name: Optional[str] = None,
                project: Optional[str] = None,
                remote: Optional[str] = None,
                opts: Optional[InvokeOptions] = None) -> GetProfileResult
def get_profile_output(devices: Optional[pulumi.Input[Sequence[pulumi.Input[GetProfileDeviceArgs]]]] = None,
                name: Optional[pulumi.Input[str]] = None,
                project: Optional[pulumi.Input[str]] = None,
                remote: Optional[pulumi.Input[str]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetProfileResult]
Copy
func LookupProfile(ctx *Context, args *LookupProfileArgs, opts ...InvokeOption) (*LookupProfileResult, error)
func LookupProfileOutput(ctx *Context, args *LookupProfileOutputArgs, opts ...InvokeOption) LookupProfileResultOutput
Copy

> Note: This function is named LookupProfile in the Go SDK.

public static class GetProfile 
{
    public static Task<GetProfileResult> InvokeAsync(GetProfileArgs args, InvokeOptions? opts = null)
    public static Output<GetProfileResult> Invoke(GetProfileInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetProfileResult> getProfile(GetProfileArgs args, InvokeOptions options)
public static Output<GetProfileResult> getProfile(GetProfileArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: lxd:index/getProfile:getProfile
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
Required - Name of the profile.
Devices List<GetProfileDevice>
Device definition. See reference below.
Project string
Optional - Name of the project where the profile is create.
Remote string
Optional - The remote in which the resource was created. If not provided, the provider's default remote is used.
Name This property is required. string
Required - Name of the profile.
Devices []GetProfileDevice
Device definition. See reference below.
Project string
Optional - Name of the project where the profile is create.
Remote string
Optional - The remote in which the resource was created. If not provided, the provider's default remote is used.
name This property is required. String
Required - Name of the profile.
devices List<GetProfileDevice>
Device definition. See reference below.
project String
Optional - Name of the project where the profile is create.
remote String
Optional - The remote in which the resource was created. If not provided, the provider's default remote is used.
name This property is required. string
Required - Name of the profile.
devices GetProfileDevice[]
Device definition. See reference below.
project string
Optional - Name of the project where the profile is create.
remote string
Optional - The remote in which the resource was created. If not provided, the provider's default remote is used.
name This property is required. str
Required - Name of the profile.
devices Sequence[GetProfileDevice]
Device definition. See reference below.
project str
Optional - Name of the project where the profile is create.
remote str
Optional - The remote in which the resource was created. If not provided, the provider's default remote is used.
name This property is required. String
Required - Name of the profile.
devices List<Property Map>
Device definition. See reference below.
project String
Optional - Name of the project where the profile is create.
remote String
Optional - The remote in which the resource was created. If not provided, the provider's default remote is used.

getProfile Result

The following output properties are available:

Config Dictionary<string, string>
Map of key/value pairs of instance config settings.
Description string
Id string
The provider-assigned unique ID for this managed resource.
Name string
Name of the device.
Devices List<GetProfileDevice>
Device definition. See reference below.
Project string
Remote string
Config map[string]string
Map of key/value pairs of instance config settings.
Description string
Id string
The provider-assigned unique ID for this managed resource.
Name string
Name of the device.
Devices []GetProfileDevice
Device definition. See reference below.
Project string
Remote string
config Map<String,String>
Map of key/value pairs of instance config settings.
description String
id String
The provider-assigned unique ID for this managed resource.
name String
Name of the device.
devices List<GetProfileDevice>
Device definition. See reference below.
project String
remote String
config {[key: string]: string}
Map of key/value pairs of instance config settings.
description string
id string
The provider-assigned unique ID for this managed resource.
name string
Name of the device.
devices GetProfileDevice[]
Device definition. See reference below.
project string
remote string
config Mapping[str, str]
Map of key/value pairs of instance config settings.
description str
id str
The provider-assigned unique ID for this managed resource.
name str
Name of the device.
devices Sequence[GetProfileDevice]
Device definition. See reference below.
project str
remote str
config Map<String>
Map of key/value pairs of instance config settings.
description String
id String
The provider-assigned unique ID for this managed resource.
name String
Name of the device.
devices List<Property Map>
Device definition. See reference below.
project String
remote String

Supporting Types

GetProfileDevice

Name This property is required. string
Required - Name of the profile.
Properties This property is required. Dictionary<string, string>
Map of key/value pairs of device properties.
Type This property is required. string
Type of the device.
Name This property is required. string
Required - Name of the profile.
Properties This property is required. map[string]string
Map of key/value pairs of device properties.
Type This property is required. string
Type of the device.
name This property is required. String
Required - Name of the profile.
properties This property is required. Map<String,String>
Map of key/value pairs of device properties.
type This property is required. String
Type of the device.
name This property is required. string
Required - Name of the profile.
properties This property is required. {[key: string]: string}
Map of key/value pairs of device properties.
type This property is required. string
Type of the device.
name This property is required. str
Required - Name of the profile.
properties This property is required. Mapping[str, str]
Map of key/value pairs of device properties.
type This property is required. str
Type of the device.
name This property is required. String
Required - Name of the profile.
properties This property is required. Map<String>
Map of key/value pairs of device properties.
type This property is required. String
Type of the device.

Package Details

Repository
lxd terraform-lxd/terraform-provider-lxd
License
Notes
This Pulumi package is based on the lxd Terraform Provider.